]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: move files_struct.closing to a bitfield
authorRalph Boehme <slow@samba.org>
Fri, 3 Apr 2020 06:06:27 +0000 (08:06 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 3 Apr 2020 19:05:44 +0000 (19:05 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/vfs.h
source3/modules/offload_token.c
source3/smbd/conn_idle.c
source3/smbd/files.c
source3/smbd/reply.c
source3/smbd/smb2_close.c
source3/smbd/smb2_lock.c

index c7f430aa646e9392894d601239070ea7079f9bdd..a6d0b2175181a1f5c177ce114719a08f070cc42f 100644 (file)
@@ -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
index a5975811f5db4fbb54a8cce8f2b35acb4cf06d05..e13806efe9aa4b2a6cf0dc3e967f158544730730 100644 (file)
@@ -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;
        }
index cf5a417bff762847df1ae4056818e85d4c187830..ca697383877135db5b51543e6e64b278b3bf9842 100644 (file)
@@ -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) {
                        /*
index 9a8a5188a1c368d27c5fcbcf9ba83f037d0e371b..e5bb3d2c268e72e94138f7890e0fb42fa7fe3641 100644 (file)
@@ -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;
index 32b3e5dd4ce23e7c919c9dee4aa52c09baa9cd25..9703363d11e678aec75ac92e31252ee70f675e5f 100644 (file)
@@ -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) {
                        /*
index 2f9a73cb69f448ffddb4590b45b57c9e7566b8f1..a7f1eb7ae4679a9e411589eed25a4c3dcd2e536e 100644 (file)
@@ -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) {
index d1e6301575395692af2348098369f29c0dd12883..97e5e994e4ef34866332b9016b9985fc961bedb0 100644 (file)
@@ -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);