The Samba-Bugzilla – Attachment 13883 Details for
Bug 13195
g_lock conflict detection broken when processing stale entries.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Backport for v4-7-test
tmp47.diff.txt (text/plain), 1.58 KB, created by
Stefan Metzmacher
on 2017-12-21 21:18:03 UTC
(
hide
)
Description:
Backport for v4-7-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2017-12-21 21:18:03 UTC
Size:
1.58 KB
patch
obsolete
>From 56afbbdd2e51385d946965a2161335c233ade578 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Wed, 20 Dec 2017 08:25:19 +0100 >Subject: [PATCH] g_lock: fix cleanup of stale entries in g_lock_trylock() > >g_lock_trylock() always incremented the counter 'i', even after cleaning a stale >entry at position 'i', which means it skipped checking for a conflict against >the new entry at position 'i'. > >As result a process could get a write lock, while there're still >some read lock holders. Once we get into that problem, also more than >one write lock are possible. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13195 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Volker Lendecke <vl@samba.org> > >Autobuild-User(master): Volker Lendecke <vl@samba.org> >Autobuild-Date(master): Wed Dec 20 20:31:48 CET 2017 on sn-devel-144 >(similar to commit 576fb4fb5dc506bf55e5cf87973999dca444149b) >--- > source3/lib/g_lock.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c >index 198fe56..76b4af5 100644 >--- a/source3/lib/g_lock.c >+++ b/source3/lib/g_lock.c >@@ -301,9 +301,11 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self, > } > } > >- for (i=0; i<num_locks; i++) { >+ i=0; > >+ while (i < num_locks) { > if (i == my_lock) { >+ i++; > continue; > } > >@@ -329,7 +331,9 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self, > locks[i] = locks[num_locks-1]; > num_locks -= 1; > modified = true; >+ continue; > } >+ i++; > } > > if (my_lock >= num_locks) { >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
vl
:
review+
Actions:
View
Attachments on
bug 13195
:
13881
|
13882
| 13883 |
13884
|
14421