]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: reuse close_free_pending_aio() in close_directory()
authorRalph Boehme <slow@samba.org>
Mon, 9 Mar 2020 10:18:23 +0000 (11:18 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 9 Mar 2020 19:34:27 +0000 (19:34 +0000)
A directory fsp can have outstanding aio requests as well.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Mar  9 19:34:27 UTC 2020 on sn-devel-184

source3/smbd/close.c

index 639c4844b35645b74de71261093b32f5278a2d08..73f9c75762d9d520c1bbb8e62d92e45116a1ad59 100644 (file)
@@ -1165,30 +1165,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
                notify_status = NT_STATUS_OK;
        }
 
-       if (fsp->num_aio_requests != 0) {
-               if (close_type != SHUTDOWN_CLOSE) {
-                       /*
-                        * We panic here because if we close() the fd while we
-                        * have outstanding async I/O requests, an async IO
-                        * request might use the fd. For directories the fd is
-                        * read-only, so this is not as bad as with files, but
-                        * still, better safe then sorry.
-                        */
-                       DBG_ERR("fsp->num_aio_requests=%u\n",
-                               fsp->num_aio_requests);
-                       smb_panic("close with outstanding aio requests");
-                       return NT_STATUS_INTERNAL_ERROR;
-               }
-
-               while (fsp->num_aio_requests != 0) {
-                       /*
-                        * The destructor of the req will remove itself from the
-                        * fsp.  Don't use TALLOC_FREE here, this will overwrite
-                        * what the destructor just wrote into aio_requests[0].
-                        */
-                       talloc_free(fsp->aio_requests[0]);
-               }
-       }
+       close_free_pending_aio(fsp, close_type);
 
        /*
         * NT can set delete_on_close of the last open