The Samba-Bugzilla – Attachment 12120 Details for
Bug 11919
SMB_VFS_KERNEL_FLOCK should only be called when 'kernel share modes = yes'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for v4-4-test, cherry-picked from master
bug-11919.v4-4-test.patch (text/plain), 3.50 KB, created by
Michael Adam
on 2016-05-20 12:17:35 UTC
(
hide
)
Description:
patch for v4-4-test, cherry-picked from master
Filename:
MIME Type:
Creator:
Michael Adam
Created:
2016-05-20 12:17:35 UTC
Size:
3.50 KB
patch
obsolete
>From a6b1a8e9095efe4d739add05bea7b0f7b117e021 Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Mon, 16 May 2016 01:39:09 +0200 >Subject: [PATCH 1/2] s3:vfs: add 'kernel_share_modes_taken' to files_struct > >This will allow to track whether kernel share modes have been >taken at open and correclty remove them again on close. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11919 > >Signed-off-by: Michael Adam <obnox@samba.org> >Reviewed-by: Christian Ambach <ambi@samba.org> >(cherry picked from commit 356487345724ce5dffdddf9c60735b2c965f30bc) >--- > source3/include/vfs.h | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/source3/include/vfs.h b/source3/include/vfs.h >index c18ea59..fb3b8aa 100644 >--- a/source3/include/vfs.h >+++ b/source3/include/vfs.h >@@ -237,6 +237,8 @@ typedef struct files_struct { > uint32_t access_mask; /* NTCreateX access bits (FILE_READ_DATA etc.) */ > uint32_t share_access; /* NTCreateX share constants (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE). */ > >+ bool kernel_share_modes_taken; >+ > bool update_write_time_triggered; > struct tevent_timer *update_write_time_event; > bool update_write_time_on_close; >-- >2.5.5 > > >From 2733878a08ef9a73bcae7b3397ed00d6f8e33985 Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Sun, 15 May 2016 23:24:08 +0200 >Subject: [PATCH 2/2] smbd:close: only remove kernel share modes if they had > been taken at open > >This avoids errors due to 'not implemented' for SMB_VFS_KERNEL_FLOCK >on some file systems like glusterfs (with the vfs module). The only >other code path where SMB_VFS_KERNEL_FLOCK is called, is already protected. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=11919 > >Signed-off-by: Michael Adam <obnox@samba.org> >Reviewed-by: Christian Ambach <ambi@samba.org> > >Autobuild-User(master): Christian Ambach <ambi@samba.org> >Autobuild-Date(master): Thu May 19 02:34:36 CEST 2016 on sn-devel-144 > >(cherry picked from commit 6b232b2720a3d71bc0b4b5603215b3f9d3de5ca6) >--- > source3/smbd/close.c | 17 ++++++++++------- > source3/smbd/open.c | 2 ++ > 2 files changed, 12 insertions(+), 7 deletions(-) > >diff --git a/source3/smbd/close.c b/source3/smbd/close.c >index 1cb5460..3ab04b7 100644 >--- a/source3/smbd/close.c >+++ b/source3/smbd/close.c >@@ -246,7 +246,6 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, > const struct security_token *del_nt_token = NULL; > bool got_tokens = false; > bool normal_close; >- int ret_flock; > > /* Ensure any pending write time updates are done. */ > if (fsp->update_write_time_event) { >@@ -470,12 +469,16 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp, > pop_sec_ctx(); > } > >- /* remove filesystem sharemodes */ >- ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, 0, 0); >- if (ret_flock == -1) { >- DEBUG(2, ("close_remove_share_mode: removing kernel flock for " >- "%s failed: %s\n", fsp_str_dbg(fsp), >- strerror(errno))); >+ if (fsp->kernel_share_modes_taken) { >+ int ret_flock; >+ >+ /* remove filesystem sharemodes */ >+ ret_flock = SMB_VFS_KERNEL_FLOCK(fsp, 0, 0); >+ if (ret_flock == -1) { >+ DEBUG(2, ("close_remove_share_mode: removing kernel " >+ "flock for %s failed: %s\n", >+ fsp_str_dbg(fsp), strerror(errno))); >+ } > } > > if (!del_share_mode(lck, fsp)) { >diff --git a/source3/smbd/open.c b/source3/smbd/open.c >index 0d90c99..61b7145 100644 >--- a/source3/smbd/open.c >+++ b/source3/smbd/open.c >@@ -3084,6 +3084,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, > > return NT_STATUS_SHARING_VIOLATION; > } >+ >+ fsp->kernel_share_modes_taken = true; > } > > /* >-- >2.5.5 >
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:
obnox
:
review+
ambi
:
review+
Actions:
View
Attachments on
bug 11919
:
12105
| 12120