s3: VFS: Add bool use_ofd_locks member to struct files_struct.
authorJeremy Allison <jra@samba.org>
Thu, 12 May 2016 19:03:57 +0000 (21:03 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 20 May 2016 23:28:28 +0000 (01:28 +0200)
Not yet used. We will set this if we translate a process-associated
lock operation to a open file description lock operation.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
source3/include/vfs.h
source3/locking/posix.c

index a849443f023833dc6ca3571a3aeb2e35b5a812d5..dca6cef8704c297ffcb803529b4b8e0a8773f594 100644 (file)
                const struct smb_filename * */
 /* Version 35 - Add uint32_t flags to struct smb_filename */
 /* Version 35 - Add get/set/fget/fset dos attribute functions. */
+/* Version 35 - Add bool use_ofd_locks to struct files_struct */
 
 #define SMB_VFS_INTERFACE_VERSION 35
 
@@ -287,6 +288,7 @@ typedef struct files_struct {
        bool backup_intent; /* Handle was successfully opened with backup intent
                                and opener has privilege to do so. */
        bool aapl_copyfile_supported;
+       bool use_ofd_locks; /* Are we using open file description locks ? */
        struct smb_filename *fsp_name;
        uint32_t name_hash;             /* Jenkins hash of full pathname. */
        uint64_t mid;                   /* Mid of the operation that created us. */
index 0c729adc703fad54fbaf90c38d0edcb4eeb61a1c..f3a89fdf508cf47c5f0f15c6a9eff040ed48d34a 100644 (file)
@@ -591,12 +591,13 @@ int fd_close_posix(const struct files_struct *fsp)
        size_t count, i;
 
        if (!lp_locking(fsp->conn->params) ||
-           !lp_posix_locking(fsp->conn->params))
+           !lp_posix_locking(fsp->conn->params) ||
+           fsp->use_ofd_locks)
        {
                /*
-                * No locking or POSIX to worry about or we want POSIX semantics
-                * which will lose all locks on all fd's open on this dev/inode,
-                * just close.
+                * No locking or POSIX to worry about or we are using POSIX
+                * open file description lock semantics which only removes
+                * locks on the file descriptor we're closing. Just close.
                 */
                return close(fsp->fh->fd);
        }