[PATCH] correctly guard SMB_VFS_KERNEL_FLOCK with lp_kernel_share_modes (bug 11919)
Michael Adam
obnox at samba.org
Sun May 15 21:48:40 UTC 2016
Please review attached patch.
Thanks - Michael
-------------- next part --------------
From 0b2d3ffcdb5aba067e74348df3772b56d689474c Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Sun, 15 May 2016 23:24:08 +0200
Subject: [PATCH] smbd:close: only call VFS_KERNEL_FLOCK of 'kernel share modes
= yes'
This avoids errors due to 'not implemented' on some file systems
like glusterfs (with the vfs module). The only other code path
wher 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 at samba.org>
---
source3/smbd/close.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 0302c67..2333683 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -250,7 +250,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) {
@@ -474,12 +473,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 (lp_kernel_share_modes(SNUM(conn))) {
+ 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)) {
--
2.5.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160515/37a34ba6/signature.sig>
More information about the samba-technical
mailing list