From: Jeremy Allison Date: Thu, 12 May 2016 19:03:57 +0000 (+0200) Subject: s3: VFS: Add bool use_ofd_locks member to struct files_struct. X-Git-Tag: tdb-1.3.10~1084 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=da9b7056fcd6f68795db3a28564fca8bd8eb8605;p=thirdparty%2Fsamba.git s3: VFS: Add bool use_ofd_locks member to struct files_struct. 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 Reviewed-by: Jeff Layton --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index a849443f023..dca6cef8704 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -192,6 +192,7 @@ 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. */ diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 0c729adc703..f3a89fdf508 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -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); }