The branch, master has been updated
       via  7ff94b18e2e s3:vfs: Correctly check if OFD locks should be enabled 
or not
       via  2ff2594b2bd s3:vfs: Initialize pid to 0 in test_netatalk_lock()
      from  28990e4ba23 s4: torture: vfs_fruit. Change 
test_fruit_locking_conflict() to match the vfs_fruit working server code.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7ff94b18e2e39567ef7a208084cc5c914c39d3bd
Author: Andreas Schneider <[email protected]>
Date:   Wed Jan 30 18:45:34 2019 +0100

    s3:vfs: Correctly check if OFD locks should be enabled or not
    
    Also the smb.conf options should only be checked once and a reload of
    the config should not switch to a different locking mode.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Sat Feb  9 03:43:50 CET 2019 on sn-devel-144

commit 2ff2594b2bd878928cec30bc72a95a6d38bee154
Author: Andreas Schneider <[email protected]>
Date:   Wed Jan 30 18:09:52 2019 +0100

    s3:vfs: Initialize pid to 0 in test_netatalk_lock()
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h       |  2 +-
 source3/lib/util.c            |  7 ++-----
 source3/modules/vfs_default.c | 14 ++++----------
 source3/modules/vfs_fruit.c   |  2 +-
 source3/smbd/files.c          |  9 +++++++++
 5 files changed, 17 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 715bc56e286..9d6192967ba 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -360,7 +360,7 @@ void set_namearray(name_compare_entry **ppname_array, const 
char *namelist);
 void free_namearray(name_compare_entry *name_array);
 bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type);
 bool fcntl_getlock(int fd, int op, off_t *poffset, off_t *pcount, int *ptype, 
pid_t *ppid);
-int map_process_lock_to_ofd_lock(int op, bool *use_ofd_locks);
+int map_process_lock_to_ofd_lock(int op);
 bool is_myname(const char *s);
 void ra_lanman_string( const char *native_lanman );
 const char *get_remote_arch_str(void);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 5dbd67349fa..7530ea67973 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1079,7 +1079,7 @@ bool fcntl_getlock(int fd, int op, off_t *poffset, off_t 
*pcount, int *ptype, pi
 }
 
 #if defined(HAVE_OFD_LOCKS)
-int map_process_lock_to_ofd_lock(int op, bool *use_ofd_locks)
+int map_process_lock_to_ofd_lock(int op)
 {
        switch (op) {
        case F_GETLK:
@@ -1095,16 +1095,13 @@ int map_process_lock_to_ofd_lock(int op, bool 
*use_ofd_locks)
                op = F_OFD_SETLKW;
                break;
        default:
-               *use_ofd_locks = false;
                return -1;
        }
-       *use_ofd_locks = true;
        return op;
 }
 #else /* HAVE_OFD_LOCKS */
-int map_process_lock_to_ofd_lock(int op, bool *use_ofd_locks)
+int map_process_lock_to_ofd_lock(int op)
 {
-       *use_ofd_locks = false;
        return op;
 }
 #endif /* HAVE_OFD_LOCKS */
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index a27d33a6bea..cb5537e096e 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2553,11 +2553,8 @@ static bool vfswrap_lock(vfs_handle_struct *handle, 
files_struct *fsp, int op, o
 
        START_PROFILE(syscall_fcntl_lock);
 
-       if (fsp->use_ofd_locks || !lp_parm_bool(SNUM(fsp->conn),
-                                               "smbd",
-                                               "force process locks",
-                                               false)) {
-               op = map_process_lock_to_ofd_lock(op, &fsp->use_ofd_locks);
+       if (fsp->use_ofd_locks) {
+               op = map_process_lock_to_ofd_lock(op);
        }
 
        result =  fcntl_lock(fsp->fh->fd, op, offset, count, type);
@@ -2581,11 +2578,8 @@ static bool vfswrap_getlock(vfs_handle_struct *handle, 
files_struct *fsp, off_t
 
        START_PROFILE(syscall_fcntl_getlock);
 
-       if (fsp->use_ofd_locks || !lp_parm_bool(SNUM(fsp->conn),
-                                               "smbd",
-                                               "force process locks",
-                                               false)) {
-               op = map_process_lock_to_ofd_lock(op, &fsp->use_ofd_locks);
+       if (fsp->use_ofd_locks) {
+               op = map_process_lock_to_ofd_lock(op);
        }
 
        result = fcntl_getlock(fsp->fh->fd, op, poffset, pcount, ptype, ppid);
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index c801f98eafb..f54038f53d4 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -2647,7 +2647,7 @@ static bool test_netatalk_lock(files_struct *fsp, off_t 
in_offset)
        off_t offset = in_offset;
        off_t len = 1;
        int type = F_WRLCK;
-       pid_t pid;
+       pid_t pid = 0;
 
        result = SMB_VFS_GETLOCK(fsp, &offset, &len, &type, &pid);
        if (result == false) {
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 397baea84cb..99b4937c99b 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -51,6 +51,15 @@ NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX 
*mem_ctx,
                goto fail;
        }
 
+#if defined(HAVE_OFD_LOCKS)
+       fsp->use_ofd_locks = true;
+       if (lp_parm_bool(SNUM(conn),
+                        "smbd",
+                        "force process locks",
+                        false)) {
+               fsp->use_ofd_locks = false;
+       }
+#endif
        fsp->fh->ref_count = 1;
        fsp->fh->fd = -1;
 


-- 
Samba Shared Repository

Reply via email to