From: Ralph Boehme Date: Fri, 3 Apr 2020 06:06:27 +0000 (+0200) Subject: smbd: move files_struct.closing to a bitfield X-Git-Tag: ldb-2.2.0~983 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16a485d1be39f511a8d36c979e25aa0fcb1ce1b0;p=thirdparty%2Fsamba.git smbd: move files_struct.closing 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 c7f430aa646..a6d0b217518 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -373,6 +373,7 @@ typedef struct files_struct { bool is_sparse : 1; bool backup_intent : 1; bool use_ofd_locks : 1; + bool closing : 1; } fsp_flags; struct tevent_timer *update_write_time_event; @@ -430,7 +431,6 @@ typedef struct files_struct { */ unsigned num_aio_requests; struct tevent_req **aio_requests; - bool closing; /* * Requests waiting for smb1 byte range locks. They are diff --git a/source3/modules/offload_token.c b/source3/modules/offload_token.c index a5975811f5d..e13806efe9a 100644 --- a/source3/modules/offload_token.c +++ b/source3/modules/offload_token.c @@ -270,12 +270,12 @@ NTSTATUS vfs_offload_token_check_handles(uint32_t fsctl, return NT_STATUS_ACCESS_DENIED; } - if (src_fsp->closing) { + if (src_fsp->fsp_flags.closing) { DBG_INFO("copy chunk src handle with closing in progress.\n"); return NT_STATUS_ACCESS_DENIED; } - if (dst_fsp->closing) { + if (dst_fsp->fsp_flags.closing) { DBG_INFO("copy chunk dst handle with closing in progress.\n"); return NT_STATUS_ACCESS_DENIED; } diff --git a/source3/smbd/conn_idle.c b/source3/smbd/conn_idle.c index cf5a417bff7..ca697383877 100644 --- a/source3/smbd/conn_idle.c +++ b/source3/smbd/conn_idle.c @@ -174,7 +174,7 @@ static struct tevent_req *conn_force_tdis_send(connection_struct *conn) * done on it. Not strictly needed, but * doesn't hurt to flag it as closing. */ - fsp->closing = true; + fsp->fsp_flags.closing = true; if (fsp->num_aio_requests > 0) { /* diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 9a8a5188a1c..e5bb3d2c268 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -663,7 +663,7 @@ files_struct *file_fsp(struct smb_request *req, uint16_t fid) } if (req->chain_fsp != NULL) { - if (req->chain_fsp->closing) { + if (req->chain_fsp->fsp_flags.closing) { return NULL; } return req->chain_fsp; @@ -686,7 +686,7 @@ files_struct *file_fsp(struct smb_request *req, uint16_t fid) return NULL; } - if (fsp->closing) { + if (fsp->fsp_flags.closing) { return NULL; } @@ -733,7 +733,7 @@ struct files_struct *file_fsp_get(struct smbd_smb2_request *smb2req, return NULL; } - if (fsp->closing) { + if (fsp->fsp_flags.closing) { return NULL; } @@ -747,7 +747,7 @@ struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, struct files_struct *fsp; if (smb2req->compat_chain_fsp != NULL) { - if (smb2req->compat_chain_fsp->closing) { + if (smb2req->compat_chain_fsp->fsp_flags.closing) { return NULL; } return smb2req->compat_chain_fsp; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 32b3e5dd4ce..9703363d11e 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2712,7 +2712,7 @@ static struct tevent_req *reply_ulogoffX_send(struct smb_request *smb1req, * This will prevent any more IO being * done on it. */ - fsp->closing = true; + fsp->fsp_flags.closing = true; if (fsp->num_aio_requests > 0) { /* @@ -5847,7 +5847,7 @@ static struct tevent_req *reply_exit_send(struct smb_request *smb1req) * This will prevent any more IO being * done on it. */ - fsp->closing = true; + fsp->fsp_flags.closing = true; if (fsp->num_aio_requests > 0) { /* @@ -5974,7 +5974,7 @@ static void reply_exit_done(struct tevent_req *req) if (fsp->vuid != smb1req->vuid) { continue; } - if (!fsp->closing) { + if (!fsp->fsp_flags.closing) { continue; } @@ -6119,7 +6119,7 @@ static struct tevent_req *reply_close_send(struct smb_request *smb1req, * This will prevent any more IO being * done on it. */ - fsp->closing = true; + fsp->fsp_flags.closing = true; /* * Now wait until all aio requests on this fsp are @@ -6564,7 +6564,7 @@ static struct tevent_req *reply_tdis_send(struct smb_request *smb1req) * done on it. Not strictly needed, but * doesn't hurt to flag it as closing. */ - fsp->closing = true; + fsp->fsp_flags.closing = true; if (fsp->num_aio_requests > 0) { /* diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c index 2f9a73cb69f..a7f1eb7ae46 100644 --- a/source3/smbd/smb2_close.c +++ b/source3/smbd/smb2_close.c @@ -327,7 +327,7 @@ static struct tevent_req *smbd_smb2_close_send(TALLOC_CTX *mem_ctx, state->in_fsp = in_fsp; state->in_flags = in_flags; - in_fsp->closing = true; + in_fsp->fsp_flags.closing = true; i = 0; while (i < in_fsp->num_aio_requests) { diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index d1e63015753..97e5e994e4e 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -629,7 +629,7 @@ static bool smbd_smb2_lock_cancel(struct tevent_req *req) * the status is NT_STATUS_RANGE_NOT_LOCKED instead of * NT_STATUS_CANCELLED. */ - if (state->fsp->closing || + if (state->fsp->fsp_flags.closing || !NT_STATUS_IS_OK(smb2req->session->status) || !NT_STATUS_IS_OK(smb2req->tcon->status)) { tevent_req_nterror(req, NT_STATUS_RANGE_NOT_LOCKED);