Current SMB2 leases patchset (WIP).
Stefan (metze) Metzmacher
metze at samba.org
Thu Oct 30 09:33:49 MDT 2014
Hi Jeremy,
one more...
> here's a first independent patchset set that can go to master now.
> Mostly the strict rename patches.
>
> The rest of the patches is in the following branch:
> https://git.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/heads/master3-leases
>
> I'll post more review details on the rest once I looked at it more closely.
>
> metze
-------------- next part --------------
From a95f4aa84457e1f638cf5502d23c3daacc35882d Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Wed, 29 Oct 2014 17:29:06 +0100
Subject: [PATCH] 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 at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
---
source3/locking/brlock.c | 78 +++++++++++++++++-------------------------------
1 file changed, 28 insertions(+), 50 deletions(-)
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 295e147..1c4c4d0 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;
}
--
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141030/e10016cc/attachment.pgp>
More information about the samba-technical
mailing list