From: Volker Lendecke Date: Wed, 19 Jun 2019 19:15:38 +0000 (+0200) Subject: smbd: Only remove locks by mid if necessary X-Git-Tag: ldb-2.0.5~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c00c7bfb7e275cce89ec95b7e282dda1dee97d48;p=thirdparty%2Fsamba.git smbd: Only remove locks by mid if necessary Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index bf3fff7b97d..b36a4c0003a 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -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) diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 8bb121a1351..ab8110bb359 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -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)); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 7b2a752d2fd..f815a08723c 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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);