smbd: Only remove locks by mid if necessary
authorVolker Lendecke <vl@samba.org>
Wed, 19 Jun 2019 19:15:38 +0000 (21:15 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 20 Jun 2019 17:18:16 +0000 (17:18 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/notify.c
source3/smbd/nttrans.c
source3/smbd/proto.h

index bf3fff7b97db7f00e54bfb5422b869610c28f0f0..b36a4c0003a8cfd8cb0a286ff7704bdbb72e478f 100644 (file)
@@ -428,7 +428,7 @@ static void smbd_notify_cancel_by_map(struct notify_mid_map *map)
  Delete entries by mid from the change notify pending queue. Always send reply.
 *****************************************************************************/
 
-void remove_pending_change_notify_requests_by_mid(
+bool remove_pending_change_notify_requests_by_mid(
        struct smbd_server_connection *sconn, uint64_t mid)
 {
        struct notify_mid_map *map;
@@ -440,10 +440,11 @@ void remove_pending_change_notify_requests_by_mid(
        }
 
        if (map == NULL) {
-               return;
+               return false;
        }
 
        smbd_notify_cancel_by_map(map);
+       return true;
 }
 
 void smbd_notify_cancel_by_smbreq(const struct smb_request *smbreq)
index 8bb121a13515fe6c43a36cf9550485d642200e94..ab8110bb35947f040428ae567f630da428ad1148 100644 (file)
@@ -1395,6 +1395,7 @@ void reply_ntcancel(struct smb_request *req)
 {
        struct smbXsrv_connection *xconn = req->xconn;
        struct smbd_server_connection *sconn = req->sconn;
+       bool found;
 
        /*
         * Go through and cancel any pending change notifies.
@@ -1402,8 +1403,10 @@ void reply_ntcancel(struct smb_request *req)
 
        START_PROFILE(SMBntcancel);
        srv_cancel_sign_response(xconn);
-       remove_pending_change_notify_requests_by_mid(sconn, req->mid);
-       remove_pending_lock_requests_by_mid_smb1(sconn, req->mid);
+       found = remove_pending_change_notify_requests_by_mid(sconn, req->mid);
+       if (!found) {
+               remove_pending_lock_requests_by_mid_smb1(sconn, req->mid);
+       }
 
        DEBUG(3,("reply_ntcancel: cancel called on mid = %llu.\n",
                (unsigned long long)req->mid));
index 7b2a752d2fdc2a7e453e19b7a644690a6f08851a..f815a08723c566b4261af45460c75399d7fb3efb 100644 (file)
@@ -559,7 +559,7 @@ void smbd_notify_cancel_deleted(struct messaging_context *msg,
 void smbd_notifyd_restarted(struct messaging_context *msg,
                            void *private_data, uint32_t msg_type,
                            struct server_id server_id, DATA_BLOB *data);
-void remove_pending_change_notify_requests_by_mid(
+bool remove_pending_change_notify_requests_by_mid(
        struct smbd_server_connection *sconn, uint64_t mid);
 void remove_pending_change_notify_requests_by_fid(files_struct *fsp,
                                                  NTSTATUS status);