From: Ralph Boehme Date: Fri, 3 Apr 2020 06:02:23 +0000 (+0200) Subject: smbd: move files_struct.use_ofd_locks to a bitfield X-Git-Tag: ldb-2.2.0~984 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e940a41c2b2a80087086e7bd63e36c410225b586;p=thirdparty%2Fsamba.git smbd: move files_struct.use_ofd_locks to a bitfield Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index ec3bbb44465..c7f430aa646 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -372,6 +372,7 @@ typedef struct files_struct { bool delete_on_close : 1; bool is_sparse : 1; bool backup_intent : 1; + bool use_ofd_locks : 1; } fsp_flags; struct tevent_timer *update_write_time_event; @@ -393,7 +394,6 @@ typedef struct files_struct { int current_lock_count; /* Count the number of outstanding locks and pending locks. */ uint64_t posix_flags; - 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 e7d773a6f66..32f8317776e 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -585,7 +585,7 @@ int fd_close_posix(const struct files_struct *fsp) if (!lp_locking(fsp->conn->params) || !lp_posix_locking(fsp->conn->params) || - fsp->use_ofd_locks) + fsp->fsp_flags.use_ofd_locks) { /* * No locking or POSIX to worry about or we are using POSIX diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 3527d0371ce..2a7e04f79d1 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2730,7 +2730,7 @@ static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, o START_PROFILE(syscall_fcntl_lock); - if (fsp->use_ofd_locks) { + if (fsp->fsp_flags.use_ofd_locks) { op = map_process_lock_to_ofd_lock(op); } @@ -2800,7 +2800,7 @@ static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t START_PROFILE(syscall_fcntl_getlock); - if (fsp->use_ofd_locks) { + if (fsp->fsp_flags.use_ofd_locks) { op = map_process_lock_to_ofd_lock(op); } diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 6269dd94dd5..9a8a5188a1c 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -52,12 +52,12 @@ NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx, } #if defined(HAVE_OFD_LOCKS) - fsp->use_ofd_locks = true; + fsp->fsp_flags.use_ofd_locks = true; if (lp_parm_bool(SNUM(conn), "smbd", "force process locks", false)) { - fsp->use_ofd_locks = false; + fsp->fsp_flags.use_ofd_locks = false; } #endif fsp->fh->ref_count = 1;