summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-03-17 10:08:56 +0100
committerStefan Metzmacher <metze@samba.org>2011-03-18 13:00:51 +0100
commit2f048e458bbd47307949293cf8436c2d8f879439 (patch)
tree2929dae15b5211daceba04e28ab0333bdf94d650
parente8411d6f9f1827ea88754fa97a2671cdf27a5554 (diff)
downloadsamba-2f048e458bbd47307949293cf8436c2d8f879439.tar.gz
samba-2f048e458bbd47307949293cf8436c2d8f879439.tar.bz2
samba-2f048e458bbd47307949293cf8436c2d8f879439.zip
s3:locking: simplify the non cluster case of brl_get_locks_readonly()
Pair-Programmed-With: Michael Adam <obnox@samba.org> metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Fri Mar 18 13:00:51 CET 2011 on sn-devel-104
-rw-r--r--source3/locking/brlock.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 8033dbad45..95194dad16 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1946,34 +1946,15 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp)
TALLOC_FREE(fsp->brlock_rec);
- br_lock = brl_get_locks_internal(talloc_tos(), fsp, false);
+ br_lock = brl_get_locks_internal(talloc_tos(), fsp, true);
if (br_lock == NULL) {
return NULL;
}
fsp->brlock_seqnum = brlock_db->get_seqnum(brlock_db);
- fsp->brlock_rec = talloc_zero(fsp, struct byte_range_lock);
- if (fsp->brlock_rec == NULL) {
- goto fail;
- }
- fsp->brlock_rec->fsp = fsp;
- fsp->brlock_rec->num_locks = br_lock->num_locks;
- fsp->brlock_rec->read_only = true;
- fsp->brlock_rec->key = br_lock->key;
-
- fsp->brlock_rec->lock_data = (struct lock_struct *)
- talloc_memdup(fsp->brlock_rec, br_lock->lock_data,
- sizeof(struct lock_struct) * br_lock->num_locks);
- if (fsp->brlock_rec->lock_data == NULL) {
- goto fail;
- }
+ fsp->brlock_rec = talloc_move(fsp, &br_lock);
- TALLOC_FREE(br_lock);
return fsp->brlock_rec;
-fail:
- TALLOC_FREE(br_lock);
- TALLOC_FREE(fsp->brlock_rec);
- return NULL;
}
struct brl_revalidate_state {