s3/vfs: remove SMB_VFS_STRICT_UNLOCK
authorRalph Boehme <slow@samba.org>
Sun, 9 Jul 2017 12:21:21 +0000 (14:21 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 10 Jul 2017 21:22:10 +0000 (23:22 +0200)
It's just a noop, so let's remove it. SMB_VFS_STRICT_LOCK doesn't set
logs, it just checks for the presence of incompatible locks.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12887

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
18 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/locking/locking.c
source3/locking/proto.h
source3/modules/vfs_btrfs.c
source3/modules/vfs_catia.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_time_audit.c
source3/smbd/aio.c
source3/smbd/reply.c
source3/smbd/smb2_ioctl_filesys.c
source3/smbd/smb2_read.c
source3/smbd/smb2_write.c
source3/smbd/vfs.c

index fed9d2f3ddb3c5e2361c4d4bee87d393043c9556..072ec8036b1a28952c6da05cec70ab423a8c60eb 100644 (file)
@@ -695,13 +695,6 @@ static bool skel_strict_lock(struct vfs_handle_struct *handle,
        return false;
 }
 
-static void skel_strict_unlock(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp,
-                              struct lock_struct *plock)
-{
-       ;
-}
-
 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
                                    const char *mapped_name,
                                    enum vfs_translate_direction direction,
@@ -1023,7 +1016,6 @@ struct vfs_fn_pointers skel_opaque_fns = {
        .brl_unlock_windows_fn = skel_brl_unlock_windows,
        .brl_cancel_windows_fn = skel_brl_cancel_windows,
        .strict_lock_fn = skel_strict_lock,
-       .strict_unlock_fn = skel_strict_unlock,
        .translate_name_fn = skel_translate_name,
        .fsctl_fn = skel_fsctl,
        .readdir_attr_fn = skel_readdir_attr,
index d9123e091c1403b5188232802bfa661149072906..9592c17414a4a845f2974fd6461792e2cf9f9207 100644 (file)
@@ -863,13 +863,6 @@ static bool skel_strict_lock(struct vfs_handle_struct *handle,
        return SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
 }
 
-static void skel_strict_unlock(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp,
-                              struct lock_struct *plock)
-{
-       SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
-}
-
 static NTSTATUS skel_translate_name(struct vfs_handle_struct *handle,
                                    const char *mapped_name,
                                    enum vfs_translate_direction direction,
@@ -1196,7 +1189,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .brl_unlock_windows_fn = skel_brl_unlock_windows,
        .brl_cancel_windows_fn = skel_brl_cancel_windows,
        .strict_lock_fn = skel_strict_lock,
-       .strict_unlock_fn = skel_strict_unlock,
        .translate_name_fn = skel_translate_name,
        .fsctl_fn = skel_fsctl,
        .readdir_attr_fn = skel_readdir_attr,
index 7b9a6f8f0857e73e903dd20c68a48dc89ca837fb..bd00e8f031860461190c57db2202fb44fcb924c6 100644 (file)
 /* Version 37 - Add SMB_VFS_OFFLOAD_READ_SEND/RECV */
 /* Version 37 - Rename SMB_VFS_COPY_CHUNK_SEND/RECV to
                 SMB_VFS_OFFLOAD_READ_SEND/RECV */
+/* Version 37 - Remove SMB_VFS_STRICT_UNLOCK */
 
 #define SMB_VFS_INTERFACE_VERSION 37
 
@@ -852,10 +853,6 @@ struct vfs_fn_pointers {
                               struct files_struct *fsp,
                               struct lock_struct *plock);
 
-       void (*strict_unlock_fn)(struct vfs_handle_struct *handle,
-                                struct files_struct *fsp,
-                                struct lock_struct *plock);
-
        NTSTATUS (*translate_name_fn)(struct vfs_handle_struct *handle,
                                      const char *name,
                                      enum vfs_translate_direction direction,
@@ -1318,9 +1315,6 @@ bool smb_vfs_call_brl_cancel_windows(struct vfs_handle_struct *handle,
 bool smb_vfs_call_strict_lock(struct vfs_handle_struct *handle,
                              struct files_struct *fsp,
                              struct lock_struct *plock);
-void smb_vfs_call_strict_unlock(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp,
-                               struct lock_struct *plock);
 NTSTATUS smb_vfs_call_translate_name(struct vfs_handle_struct *handle,
                                     const char *name,
                                     enum vfs_translate_direction direction,
index 69fa85b297b7cb40b05d05f568851af10f6d88cc..843d62617d3ebb1af0ab3c7e4a66e8be2b289a24 100644 (file)
 #define SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock) \
        smb_vfs_call_strict_lock((handle)->next, (fsp), (plock))
 
-#define SMB_VFS_STRICT_UNLOCK(conn, fsp, plock) \
-       smb_vfs_call_strict_unlock((conn)->vfs_handles, (fsp), (plock))
-#define SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock) \
-       smb_vfs_call_strict_unlock((handle)->next, (fsp), (plock))
-
 #define SMB_VFS_TRANSLATE_NAME(conn, name, direction, mem_ctx, mapped_name) \
        smb_vfs_call_translate_name((conn)->vfs_handles, (name), (direction), (mem_ctx), (mapped_name))
 #define SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx, mapped_name) \
index 037a987666876a85805383663822e6ecea94ea52..d344731a7266f08daa1dd097a36f47d09082c437 100644 (file)
@@ -164,10 +164,6 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
        return ret;
 }
 
-void strict_unlock_default(files_struct *fsp, struct lock_struct *plock)
-{
-}
-
 /****************************************************************************
  Find out if a lock could be granted - return who is blocking us if we can't.
 ****************************************************************************/
index 6fb2bf2fafe0809b1ed7a8c7c5635186deef3728..ebd80f2963162e83d19c6ae5cd11aa3c557ca432 100644 (file)
@@ -107,8 +107,6 @@ void init_strict_lock_struct(files_struct *fsp,
                                struct lock_struct *plock);
 bool strict_lock_default(files_struct *fsp,
                                struct lock_struct *plock);
-void strict_unlock_default(files_struct *fsp,
-                               struct lock_struct *plock);
 NTSTATUS query_lock(files_struct *fsp,
                        uint64_t *psmblctx,
                        uint64_t *pcount,
index 0fd4c6cb0d86771a4e7c46769dda7412417e7734..a90f583d06423569026eb0b221f4ce4047eb1f65 100644 (file)
@@ -322,7 +322,6 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
                        return tevent_req_post(req, ev);
                }
                if (!SMB_VFS_STRICT_LOCK(dest_fsp->conn, dest_fsp, &dest_lck)) {
-                       SMB_VFS_STRICT_UNLOCK(src_fsp->conn, src_fsp, &src_lck);
                        tevent_req_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
                        return tevent_req_post(req, ev);
                }
@@ -335,10 +334,6 @@ static struct tevent_req *btrfs_offload_write_send(struct vfs_handle_struct *han
        cr_args.src_length = (uint64_t)num;
 
        ret = ioctl(dest_fsp->fh->fd, BTRFS_IOC_CLONE_RANGE, &cr_args);
-       if (do_locking) {
-               SMB_VFS_STRICT_UNLOCK(dest_fsp->conn, dest_fsp, &dest_lck);
-               SMB_VFS_STRICT_UNLOCK(src_fsp->conn, src_fsp, &src_lck);
-       }
        if (ret < 0) {
                /*
                 * BTRFS_IOC_CLONE_RANGE only supports 'sectorsize' aligned
index 6adf4414af6cefc848ae024c78f8c9b3685b6f72..6e623bce8aa49ff2e6ba7d3f5f00e4ab1996fd16 100644 (file)
@@ -2390,23 +2390,6 @@ static bool catia_strict_lock(struct vfs_handle_struct *handle,
        return ok;
 }
 
-static void catia_strict_unlock(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp,
-                               struct lock_struct *plock)
-{
-       struct catia_cache *cc = NULL;
-       int ret;
-
-       ret = CATIA_FETCH_FSP_PRE_NEXT(talloc_tos(), handle, fsp, &cc);
-       if (ret != 0) {
-               smb_panic("CATIA_FETCH_FSP_PRE_NEXT failed\n");
-       }
-
-       SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
-
-       CATIA_FETCH_FSP_POST_NEXT(&cc, fsp);
-}
-
 static NTSTATUS catia_fsctl(struct vfs_handle_struct *handle,
                            struct files_struct *fsp,
                            TALLOC_CTX *ctx,
@@ -2624,7 +2607,6 @@ static struct vfs_fn_pointers vfs_catia_fns = {
        .chflags_fn = catia_chflags,
        .streaminfo_fn = catia_streaminfo,
        .strict_lock_fn = catia_strict_lock,
-       .strict_unlock_fn = catia_strict_unlock,
        .translate_name_fn = catia_translate_name,
        .fsctl_fn = catia_fsctl,
        .get_dos_attributes_fn = catia_get_dos_attributes,
index 111a0c3aa7128ba2fa9f1f9368d62a9a15be77f3..a03fd8da7b6c30a8c3c0f6ec01f719ab1b229abe 100644 (file)
@@ -1686,9 +1686,7 @@ struct vfswrap_offload_write_state {
        struct tevent_context *ev;
        uint8_t *buf;
        bool read_lck_locked;
-       struct lock_struct read_lck;
        bool write_lck_locked;
-       struct lock_struct write_lck;
        DATA_BLOB *token;
        struct files_struct *src_fsp;
        off_t src_off;
@@ -1827,6 +1825,7 @@ static NTSTATUS vfswrap_offload_write_loop(struct tevent_req *req)
        struct vfswrap_offload_write_state *state = tevent_req_data(
                req, struct vfswrap_offload_write_state);
        struct tevent_req *subreq = NULL;
+       struct lock_struct read_lck;
        bool ok;
 
        state->next_io_size = MIN(state->remaining, talloc_array_length(state->buf));
@@ -1836,11 +1835,11 @@ static NTSTATUS vfswrap_offload_write_loop(struct tevent_req *req)
                                state->src_off,
                                state->next_io_size,
                                READ_LOCK,
-                               &state->read_lck);
+                               &read_lck);
 
        ok = SMB_VFS_STRICT_LOCK(state->src_fsp->conn,
                                 state->src_fsp,
-                                &state->read_lck);
+                                &read_lck);
        if (!ok) {
                return NT_STATUS_FILE_LOCK_CONFLICT;
        }
@@ -1868,14 +1867,10 @@ static void vfswrap_offload_write_read_done(struct tevent_req *subreq)
        struct vfswrap_offload_write_state *state = tevent_req_data(
                req, struct vfswrap_offload_write_state);
        struct vfs_aio_state aio_state;
+       struct lock_struct write_lck;
        ssize_t nread;
        bool ok;
 
-       SMB_VFS_STRICT_UNLOCK(state->src_fsp->conn,
-                             state->src_fsp,
-                             &state->read_lck);
-       ZERO_STRUCT(state->read_lck);
-
        nread = SMB_VFS_PREAD_RECV(subreq, &aio_state);
        TALLOC_FREE(subreq);
        if (nread == -1) {
@@ -1897,11 +1892,11 @@ static void vfswrap_offload_write_read_done(struct tevent_req *subreq)
                                state->dst_off,
                                state->next_io_size,
                                WRITE_LOCK,
-                               &state->write_lck);
+                               &write_lck);
 
        ok = SMB_VFS_STRICT_LOCK(state->dst_fsp->conn,
                                 state->dst_fsp,
-                                &state->write_lck);
+                                &write_lck);
        if (!ok) {
                tevent_req_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
                return;
@@ -1930,11 +1925,6 @@ static void vfswrap_offload_write_write_done(struct tevent_req *subreq)
        ssize_t nwritten;
        NTSTATUS status;
 
-       SMB_VFS_STRICT_UNLOCK(state->dst_fsp->conn,
-                             state->dst_fsp,
-                             &state->write_lck);
-       ZERO_STRUCT(state->write_lck);
-
        nwritten = SMB_VFS_PWRITE_RECV(subreq, &aio_state);
        TALLOC_FREE(subreq);
        if (nwritten == -1) {
@@ -2760,16 +2750,6 @@ static bool vfswrap_strict_lock(struct vfs_handle_struct *handle,
        return strict_lock_default(fsp, plock);
 }
 
-static void vfswrap_strict_unlock(struct vfs_handle_struct *handle,
-                               files_struct *fsp,
-                               struct lock_struct *plock)
-{
-       SMB_ASSERT(plock->lock_type == READ_LOCK ||
-           plock->lock_type == WRITE_LOCK);
-
-       strict_unlock_default(fsp, plock);
-}
-
 /* NT ACL operations. */
 
 static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle,
@@ -3099,7 +3079,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
        .brl_unlock_windows_fn = vfswrap_brl_unlock_windows,
        .brl_cancel_windows_fn = vfswrap_brl_cancel_windows,
        .strict_lock_fn = vfswrap_strict_lock,
-       .strict_unlock_fn = vfswrap_strict_unlock,
        .translate_name_fn = vfswrap_translate_name,
        .fsctl_fn = vfswrap_fsctl,
        .set_dos_attributes_fn = vfswrap_set_dos_attributes,
index bd31fadec7869f464a9685d5e3ff4f03755d2002..af5c2c6591fbdf1da330c6718e13159da0d2dd2b 100644 (file)
@@ -165,7 +165,6 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_BRL_UNLOCK_WINDOWS,
        SMB_VFS_OP_BRL_CANCEL_WINDOWS,
        SMB_VFS_OP_STRICT_LOCK,
-       SMB_VFS_OP_STRICT_UNLOCK,
        SMB_VFS_OP_TRANSLATE_NAME,
        SMB_VFS_OP_FSCTL,
        SMB_VFS_OP_OFFLOAD_READ_SEND,
@@ -309,7 +308,6 @@ static struct {
        { SMB_VFS_OP_BRL_UNLOCK_WINDOWS, "brl_unlock_windows" },
        { SMB_VFS_OP_BRL_CANCEL_WINDOWS, "brl_cancel_windows" },
        { SMB_VFS_OP_STRICT_LOCK, "strict_lock" },
-       { SMB_VFS_OP_STRICT_UNLOCK, "strict_unlock" },
        { SMB_VFS_OP_TRANSLATE_NAME,    "translate_name" },
        { SMB_VFS_OP_FSCTL,             "fsctl" },
        { SMB_VFS_OP_OFFLOAD_READ_SEND, "offload_read_send" },
@@ -1849,17 +1847,6 @@ static bool smb_full_audit_strict_lock(struct vfs_handle_struct *handle,
        return result;
 }
 
-static void smb_full_audit_strict_unlock(struct vfs_handle_struct *handle,
-                                        struct files_struct *fsp,
-                                        struct lock_struct *plock)
-{
-       SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
-
-       do_log(SMB_VFS_OP_STRICT_UNLOCK, true, handle,
-           "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
-           plock->size, plock->lock_type);
-}
-
 static NTSTATUS smb_full_audit_translate_name(struct vfs_handle_struct *handle,
                                              const char *name,
                                              enum vfs_translate_direction direction,
@@ -2590,7 +2577,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .brl_unlock_windows_fn = smb_full_audit_brl_unlock_windows,
        .brl_cancel_windows_fn = smb_full_audit_brl_cancel_windows,
        .strict_lock_fn = smb_full_audit_strict_lock,
-       .strict_unlock_fn = smb_full_audit_strict_unlock,
        .translate_name_fn = smb_full_audit_translate_name,
        .fsctl_fn = smb_full_audit_fsctl,
        .get_dos_attributes_fn = smb_full_audit_get_dos_attributes,
index 1dafe8d4089ae991510cc8d40e1593554ac3e159..662892bce8ef0bafd7fec0efc5c94786ab98f3d4 100644 (file)
@@ -1481,7 +1481,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
        .brl_unlock_windows_fn = NULL,
        .brl_cancel_windows_fn = NULL,
        .strict_lock_fn = NULL,
-       .strict_unlock_fn = NULL,
        .translate_name_fn = NULL,
        .fsctl_fn = NULL,
 
index 164f56da7ac90cff5d60664b4aed76f3155d4530..5985394dd2c2427718817b162b9a2cd1cef17760 100644 (file)
@@ -1730,23 +1730,6 @@ static bool smb_time_audit_strict_lock(struct vfs_handle_struct *handle,
        return result;
 }
 
-static void smb_time_audit_strict_unlock(struct vfs_handle_struct *handle,
-                                        struct files_struct *fsp,
-                                        struct lock_struct *plock)
-{
-       struct timespec ts1,ts2;
-       double timediff;
-
-       clock_gettime_mono(&ts1);
-       SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
-       clock_gettime_mono(&ts2);
-       timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
-       if (timediff > audit_timeout) {
-               smb_time_audit_log_fsp("strict_unlock", timediff, fsp);
-       }
-}
-
 static NTSTATUS smb_time_audit_translate_name(struct vfs_handle_struct *handle,
                                              const char *name,
                                              enum vfs_translate_direction direction,
@@ -2786,7 +2769,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
        .brl_unlock_windows_fn = smb_time_audit_brl_unlock_windows,
        .brl_cancel_windows_fn = smb_time_audit_brl_cancel_windows,
        .strict_lock_fn = smb_time_audit_strict_lock,
-       .strict_unlock_fn = smb_time_audit_strict_unlock,
        .translate_name_fn = smb_time_audit_translate_name,
        .fsctl_fn = smb_time_audit_fsctl,
        .get_dos_attributes_fn = smb_time_get_dos_attributes,
index ff1be13824634f7978cee68ef20e501394b8e973..a9d6c0a5948bce5c954a2f81496927c0068a57de 100644 (file)
@@ -242,7 +242,6 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
        if (req == NULL) {
                DEBUG(0,("schedule_aio_read_and_X: aio_read failed. "
                         "Error %s\n", strerror(errno) ));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -250,7 +249,6 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
 
        if (!aio_add_req_to_fsp(fsp, req)) {
                DEBUG(1, ("Could not add req to fsp\n"));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -289,9 +287,6 @@ static void aio_pread_smb1_done(struct tevent_req *req)
                return;
        }
 
-       /* Unlock now we're done. */
-       SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &aio_ex->lock);
-
        if (nread < 0) {
                DEBUG( 3, ("handle_aio_read_complete: file %s nread == %d. "
                           "Error = %s\n", fsp_str_dbg(fsp), (int)nread,
@@ -491,7 +486,6 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
        if (req == NULL) {
                DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. "
                         "Error %s\n", strerror(errno) ));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -499,7 +493,6 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
 
        if (!aio_add_req_to_fsp(fsp, req)) {
                DEBUG(1, ("Could not add req to fsp\n"));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -563,9 +556,6 @@ static void aio_pwrite_smb1_done(struct tevent_req *req)
                return;
        }
 
-       /* Unlock now we're done. */
-       SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &aio_ex->lock);
-
        mark_file_modified(fsp);
 
        if (fsp->aio_write_behind) {
@@ -735,7 +725,6 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
        if (req == NULL) {
                DEBUG(0, ("smb2: SMB_VFS_PREAD_SEND failed. "
                          "Error %s\n", strerror(errno)));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -743,7 +732,6 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
 
        if (!aio_add_req_to_fsp(fsp, req)) {
                DEBUG(1, ("Could not add req to fsp\n"));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -785,9 +773,6 @@ static void aio_pread_smb2_done(struct tevent_req *req)
                return;
        }
 
-       /* Unlock now we're done. */
-       SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &aio_ex->lock);
-
        /* Common error or success code processing for async or sync
           read returns. */
 
@@ -886,7 +871,6 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
        if (req == NULL) {
                DEBUG(3, ("smb2: SMB_VFS_PWRITE_SEND failed. "
                          "Error %s\n", strerror(errno)));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -894,7 +878,6 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
 
        if (!aio_add_req_to_fsp(fsp, req)) {
                DEBUG(1, ("Could not add req to fsp\n"));
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &aio_ex->lock);
                TALLOC_FREE(aio_ex);
                return NT_STATUS_RETRY;
        }
@@ -951,9 +934,6 @@ static void aio_pwrite_smb2_done(struct tevent_req *req)
                return;
        }
 
-       /* Unlock now we're done. */
-       SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &aio_ex->lock);
-
        mark_file_modified(fsp);
 
         status = smb2_write_complete_nosync(subreq, nwritten, err);
index d102b7a876ca9e43d43f431827866df75ef25cf7..30015f6a8a8f1b8642f527bfbbfeab604355c897 100644 (file)
@@ -3711,8 +3711,6 @@ void reply_readbraw(struct smb_request *req)
 
        DEBUG(5,("reply_readbraw finished\n"));
 
-       SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-
        END_PROFILE(SMBreadbraw);
        return;
 }
@@ -3903,7 +3901,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
 
        if (nread < 0) {
                reply_nterror(req, map_nt_error_from_unix(errno));
-               goto strict_unlock;
+               goto out;
        }
 
        srv_set_message((char *)req->outbuf, 5, nread+3, False);
@@ -3916,9 +3914,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
        DEBUG(3, ("read %s num=%d nread=%d\n",
                  fsp_fnum_dbg(fsp), (int)numtoread, (int)nread));
 
-strict_unlock:
-       SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-
+out:
        END_PROFILE(SMBread);
        return;
 }
@@ -3991,7 +3987,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
 
                if(fsp_stat(fsp) == -1) {
                        reply_nterror(req, map_nt_error_from_unix(errno));
-                       goto strict_unlock;
+                       goto out;
                }
 
                if (!S_ISREG(fsp->fsp_name->st.st_ex_mode) ||
@@ -4053,7 +4049,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
                                DEBUG(3, ("send_file_readX: fake_sendfile %s max=%d nread=%d\n",
                                          fsp_fnum_dbg(fsp), (int)smb_maxcnt, (int)nread));
                                /* No outbuf here means successful sendfile. */
-                               goto strict_unlock;
+                               goto out;
                        }
 
                        DEBUG(0,("send_file_readX: sendfile failed for file "
@@ -4094,7 +4090,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
                /* No outbuf here means successful sendfile. */
                SMB_PERFCOUNT_SET_MSGLEN_OUT(&req->pcd, nread);
                SMB_PERFCOUNT_END(&req->pcd);
-               goto strict_unlock;
+               goto out;
        }
 
 normal_read:
@@ -4144,7 +4140,7 @@ normal_read:
                        errno = saved_errno;
                        exit_server_cleanly("send_file_readX: fake_sendfile failed");
                }
-               goto strict_unlock;
+               goto out;
        }
 
 nosendfile_read:
@@ -4157,8 +4153,6 @@ nosendfile_read:
                          startpos, smb_maxcnt);
        saved_errno = errno;
 
-       SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-
        if (nread < 0) {
                reply_nterror(req, map_nt_error_from_unix(saved_errno));
                return;
@@ -4170,8 +4164,7 @@ nosendfile_read:
                  fsp_fnum_dbg(fsp), (int)smb_maxcnt, (int)nread));
        return;
 
- strict_unlock:
-       SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
+out:
        TALLOC_FREE(req->outbuf);
        return;
 }
@@ -4513,7 +4506,7 @@ void reply_writebraw(struct smb_request *req)
        if (nwritten < (ssize_t)numtowrite)  {
                reply_nterror(req, NT_STATUS_DISK_FULL);
                error_to_writebrawerr(req);
-               goto strict_unlock;
+               goto out;
        }
 
        total_written = nwritten;
@@ -4523,7 +4516,7 @@ void reply_writebraw(struct smb_request *req)
        if (!buf) {
                reply_nterror(req, NT_STATUS_NO_MEMORY);
                error_to_writebrawerr(req);
-               goto strict_unlock;
+               goto out;
        }
 
        /* Return a SMBwritebraw message to the redirector to tell
@@ -4586,7 +4579,7 @@ void reply_writebraw(struct smb_request *req)
                        TALLOC_FREE(buf);
                        reply_nterror(req, map_nt_error_from_unix(errno));
                        error_to_writebrawerr(req);
-                       goto strict_unlock;
+                       goto out;
                }
 
                if (nwritten < (ssize_t)numtowrite) {
@@ -4608,7 +4601,7 @@ void reply_writebraw(struct smb_request *req)
                         fsp_str_dbg(fsp), nt_errstr(status)));
                reply_nterror(req, status);
                error_to_writebrawerr(req);
-               goto strict_unlock;
+               goto out;
        }
 
        DEBUG(3,("reply_writebraw: secondart write %s start=%.0f num=%d "
@@ -4616,10 +4609,6 @@ void reply_writebraw(struct smb_request *req)
                fsp_fnum_dbg(fsp), (double)startpos, (int)numtowrite,
                (int)total_written));
 
-       if (!fsp->print_file) {
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-       }
-
        /* We won't return a status if write through is not selected - this
         * follows what WfWg does */
        END_PROFILE(SMBwritebraw);
@@ -4641,11 +4630,7 @@ void reply_writebraw(struct smb_request *req)
        }
        return;
 
-strict_unlock:
-       if (!fsp->print_file) {
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-       }
-
+out:
        END_PROFILE(SMBwritebraw);
        return;
 }
@@ -4721,17 +4706,17 @@ void reply_writeunlock(struct smb_request *req)
                DEBUG(5,("reply_writeunlock: sync_file for %s returned %s\n",
                         fsp_str_dbg(fsp), nt_errstr(status)));
                reply_nterror(req, status);
-               goto strict_unlock;
+               goto out;
        }
 
        if(nwritten < 0) {
                reply_nterror(req, map_nt_error_from_unix(saved_errno));
-               goto strict_unlock;
+               goto out;
        }
 
        if((nwritten < numtowrite) && (numtowrite != 0)) {
                reply_nterror(req, NT_STATUS_DISK_FULL);
-               goto strict_unlock;
+               goto out;
        }
 
        if (numtowrite && !fsp->print_file) {
@@ -4744,7 +4729,7 @@ void reply_writeunlock(struct smb_request *req)
 
                if (NT_STATUS_V(status)) {
                        reply_nterror(req, status);
-                       goto strict_unlock;
+                       goto out;
                }
        }
 
@@ -4755,11 +4740,7 @@ void reply_writeunlock(struct smb_request *req)
        DEBUG(3, ("writeunlock %s num=%d wrote=%d\n",
                  fsp_fnum_dbg(fsp), (int)numtowrite, (int)nwritten));
 
-strict_unlock:
-       if (numtowrite && !fsp->print_file) {
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-       }
-
+out:
        END_PROFILE(SMBwriteunlock);
        return;
 }
@@ -4840,12 +4821,12 @@ void reply_write(struct smb_request *req)
                nwritten = vfs_allocate_file_space(fsp, (off_t)startpos);
                if (nwritten < 0) {
                        reply_nterror(req, NT_STATUS_DISK_FULL);
-                       goto strict_unlock;
+                       goto out;
                }
                nwritten = vfs_set_filelen(fsp, (off_t)startpos);
                if (nwritten < 0) {
                        reply_nterror(req, NT_STATUS_DISK_FULL);
-                       goto strict_unlock;
+                       goto out;
                }
                trigger_write_time_update_immediate(fsp);
        } else {
@@ -4857,17 +4838,17 @@ void reply_write(struct smb_request *req)
                DEBUG(5,("reply_write: sync_file for %s returned %s\n",
                         fsp_str_dbg(fsp), nt_errstr(status)));
                reply_nterror(req, status);
-               goto strict_unlock;
+               goto out;
        }
 
        if(nwritten < 0) {
                reply_nterror(req, map_nt_error_from_unix(saved_errno));
-               goto strict_unlock;
+               goto out;
        }
 
        if((nwritten == 0) && (numtowrite != 0)) {
                reply_nterror(req, NT_STATUS_DISK_FULL);
-               goto strict_unlock;
+               goto out;
        }
 
        reply_outbuf(req, 1, 0);
@@ -4881,11 +4862,7 @@ void reply_write(struct smb_request *req)
 
        DEBUG(3, ("write %s num=%d wrote=%d\n", fsp_fnum_dbg(fsp), (int)numtowrite, (int)nwritten));
 
-strict_unlock:
-       if (!fsp->print_file) {
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-       }
-
+out:
        END_PROFILE(SMBwrite);
        return;
 }
@@ -5120,8 +5097,6 @@ void reply_write_and_X(struct smb_request *req)
 
                nwritten = write_file(req,fsp,data,startpos,numtowrite);
                saved_errno = errno;
-
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
        }
 
        if(nwritten < 0) {
@@ -5516,10 +5491,6 @@ void reply_writeclose(struct smb_request *req)
 
        nwritten = write_file(req,fsp,data,startpos,numtowrite);
 
-       if (fsp->print_file == NULL) {
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-       }
-
        set_close_write_time(fsp, mtime);
 
        /*
index 732e3ab96fcd5f99cc02a59ad8e360769c109b3a..054fd936fcc89c4149585e0c2741de8ed42b96cf 100644 (file)
@@ -503,7 +503,6 @@ static NTSTATUS fsctl_zero_data(TALLOC_CTX *mem_ctx,
                status = map_nt_error_from_unix_common(errno);
                DEBUG(2, ("zero-data fallocate(0x%x) failed: %s\n", mode,
                      strerror(errno)));
-               SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &lck);
                return status;
        }
 
@@ -522,12 +521,10 @@ static NTSTATUS fsctl_zero_data(TALLOC_CTX *mem_ctx,
                if (ret == -1)  {
                        status = map_nt_error_from_unix_common(errno);
                        DEBUG(0, ("fallocate failed: %s\n", strerror(errno)));
-                       SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &lck);
                        return status;
                }
        }
 
-       SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &lck);
        return NT_STATUS_OK;
 }
 
index d639bbf9285841ad729fc06ed90a2ca155aaeed8..6aa62cd82042e3e2b5099e85b66a5f72f84bfc33 100644 (file)
@@ -324,8 +324,6 @@ normal_read:
                                READ_LOCK,
                                &lock);
 
-       SMB_VFS_STRICT_UNLOCK(fsp->conn, fsp, &lock);
-
        *pstatus = NT_STATUS_OK;
        return 0;
 }
@@ -557,7 +555,6 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        } else {
                if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
-                       SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
                        tevent_req_nterror(req, status);
                        return tevent_req_post(req, ev);
                }
@@ -566,7 +563,6 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
        /* Ok, read into memory. Allocate the out buffer. */
        state->out_data = data_blob_talloc(state, NULL, in_length);
        if (in_length > 0 && tevent_req_nomem(state->out_data.data, req)) {
-               SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
                return tevent_req_post(req, ev);
        }
 
@@ -577,8 +573,6 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx,
 
        saved_errno = errno;
 
-       SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-
        DEBUG(10,("smbd_smb2_read: file %s, %s, offset=%llu "
                "len=%llu returned %lld\n",
                fsp_str_dbg(fsp),
index da583c9de8e144fb823d41b3c72fbe8bcd8fc01e..a8ebac873707a0f5db2befcaa1fc9d308c4de2f9 100644 (file)
@@ -369,8 +369,6 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
 
        status = smb2_write_complete(req, nwritten, errno);
 
-       SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock);
-
        DEBUG(10,("smb2: write on "
                "file %s, offset %.0f, requested %u, written = %u\n",
                fsp_str_dbg(fsp),
index 67b79ef621b031f9dacd5cfd6d9b2a76f130f779..f2861e24dfafde61542c61e8b7d755f864fc865d 100644 (file)
@@ -2282,14 +2282,6 @@ bool smb_vfs_call_strict_lock(struct vfs_handle_struct *handle,
        return handle->fns->strict_lock_fn(handle, fsp, plock);
 }
 
-void smb_vfs_call_strict_unlock(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp,
-                               struct lock_struct *plock)
-{
-       VFS_FIND(strict_unlock);
-       handle->fns->strict_unlock_fn(handle, fsp, plock);
-}
-
 NTSTATUS smb_vfs_call_translate_name(struct vfs_handle_struct *handle,
                                     const char *name,
                                     enum vfs_translate_direction direction,