diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-10-29 17:29:06 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-10-31 06:07:43 +0100 |
commit | a3b333a1a2ab23ba0c59be1fc65c730e2b53e8c5 (patch) | |
tree | e3f9703d5773a636c5f5d629fb8a372329acb3cc /source3/locking | |
parent | 151b9caeef7dc4fa4816035a406acb9f1c5812c3 (diff) | |
download | samba-a3b333a1a2ab23ba0c59be1fc65c730e2b53e8c5.tar.gz |
s3:locking: remove dead code from brl_get_locks_readonly()
struct byte_range_lock *rw = NULL; will never change...
commit 105724073300af03eb0835b3c93d9b2e2bfacb07 removed the
possible assigment of 'rw'.
So we can remove all code under if (rw != NULL) { ...
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Oct 31 06:07:43 CET 2014 on sn-devel-104
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/brlock.c | 78 |
1 files changed, 28 insertions, 50 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 295e14780a4..1c4c4d0d293 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -2026,7 +2026,8 @@ static void brl_get_locks_readonly_parser(TDB_DATA key, TDB_DATA data, struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp) { struct byte_range_lock *br_lock = NULL; - struct byte_range_lock *rw = NULL; + struct brl_get_locks_readonly_state state; + NTSTATUS status; DEBUG(10, ("seqnum=%d, fsp->brlock_seqnum=%d\n", dbwrap_get_seqnum(brlock_db), fsp->brlock_seqnum)); @@ -2040,60 +2041,39 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp) return fsp->brlock_rec; } - if (rw != NULL) { - size_t lock_data_size; + /* + * Parse the record fresh from the database + */ + + state.mem_ctx = fsp; + state.br_lock = &br_lock; + status = dbwrap_parse_record( + brlock_db, + make_tdb_data((uint8_t *)&fsp->file_id, + sizeof(fsp->file_id)), + brl_get_locks_readonly_parser, &state); + + if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_FOUND)) { /* - * Make a copy of the already retrieved and sanitized rw record + * No locks on this file. Return an empty br_lock. */ - lock_data_size = rw->num_locks * sizeof(struct lock_struct); - br_lock = talloc_pooled_object( - fsp, struct byte_range_lock, 1, lock_data_size); + br_lock = talloc(fsp, struct byte_range_lock); if (br_lock == NULL) { - goto fail; + return NULL; } - br_lock->have_read_oplocks = rw->have_read_oplocks; - br_lock->num_locks = rw->num_locks; - br_lock->lock_data = (struct lock_struct *)talloc_memdup( - br_lock, rw->lock_data, lock_data_size); - } else { - struct brl_get_locks_readonly_state state; - NTSTATUS status; - - /* - * Parse the record fresh from the database - */ - state.mem_ctx = fsp; - state.br_lock = &br_lock; - - status = dbwrap_parse_record( - brlock_db, - make_tdb_data((uint8_t *)&fsp->file_id, - sizeof(fsp->file_id)), - brl_get_locks_readonly_parser, &state); - - if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_FOUND)) { - /* - * No locks on this file. Return an empty br_lock. - */ - br_lock = talloc(fsp, struct byte_range_lock); - if (br_lock == NULL) { - goto fail; - } - - br_lock->have_read_oplocks = false; - br_lock->num_locks = 0; - br_lock->lock_data = NULL; + br_lock->have_read_oplocks = false; + br_lock->num_locks = 0; + br_lock->lock_data = NULL; - } else if (!NT_STATUS_IS_OK(status)) { - DEBUG(3, ("Could not parse byte range lock record: " - "%s\n", nt_errstr(status))); - goto fail; - } - if (br_lock == NULL) { - goto fail; - } + } else if (!NT_STATUS_IS_OK(status)) { + DEBUG(3, ("Could not parse byte range lock record: " + "%s\n", nt_errstr(status))); + return NULL; + } + if (br_lock == NULL) { + return NULL; } br_lock->fsp = fsp; @@ -2117,8 +2097,6 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp) fsp->brlock_seqnum = dbwrap_get_seqnum(brlock_db); } -fail: - TALLOC_FREE(rw); return br_lock; } |