diff --git a/source3/smbd/close.c b/source3/smbd/close.c index da28559e49b..70f870619ee 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -636,7 +636,8 @@ static NTSTATUS ntstatus_keeperror(NTSTATUS s1, NTSTATUS s2) return s2; } -static void assert_no_pending_aio(struct files_struct *fsp, +static void assert_no_pending_aio(struct smb_request *req, + struct files_struct *fsp, enum file_close_type close_type) { unsigned num_requests = fsp->num_aio_requests; @@ -645,6 +646,11 @@ static void assert_no_pending_aio(struct files_struct *fsp, return; } + if (close_type == SHUTDOWN_CLOSE && + !NT_STATUS_IS_OK(req->xconn->transport.status)) { + return; + } + DBG_ERR("fsp->num_aio_requests=%u\n", num_requests); smb_panic("can not close with outstanding aio requests"); return; @@ -666,7 +672,7 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp, connection_struct *conn = fsp->conn; bool is_durable = false; - assert_no_pending_aio(fsp, close_type); + assert_no_pending_aio(req, fsp, close_type); while (talloc_array_length(fsp->blocked_smb1_lock_reqs) != 0) { smbd_smb1_brl_finish_by_req( @@ -1122,7 +1128,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp, notify_status = NT_STATUS_OK; } - assert_no_pending_aio(fsp, close_type); + assert_no_pending_aio(req, fsp, close_type); /* * NT can set delete_on_close of the last open