Revert "s3: VFS: vfs_default. Protect vfs_pwrite_done() from accessing a freed req...
authorJeremy Allison <jra@samba.org>
Fri, 13 Mar 2020 17:39:31 +0000 (10:39 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 18 Mar 2020 18:03:31 +0000 (18:03 +0000)
This reverts commit c8cd93dd54cb9f78665928d4bc8fcc3baf084b6f.

Now we wait for all aio to finish on all SHUTDOWN_CLOSE
cases, this is no longer needed.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_default.c

index 3425ee31dcbb33728e9ec43d1a035597afcee37c..641764e41f1fcea9636848701a8e292782f0c6a3 100644 (file)
@@ -1012,15 +1012,6 @@ static void vfs_pwrite_do(void *private_data)
 
 static int vfs_pwrite_state_destructor(struct vfswrap_pwrite_state *state)
 {
-       /*
-        * This destructor only gets called if the request is still
-        * in flight, which is why we deny it by returning -1. We
-        * also set the req pointer to NULL so the _done function
-        * can detect the caller doesn't want the result anymore.
-        *
-        * Forcing the fsp closed by a SHUTDOWN_CLOSE can cause this.
-        */
-       state->req = NULL;
        return -1;
 }
 
@@ -1035,17 +1026,6 @@ static void vfs_pwrite_done(struct tevent_req *subreq)
        TALLOC_FREE(subreq);
        SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
        talloc_set_destructor(state, NULL);
-       if (req == NULL) {
-               /*
-                * We were shutdown closed in flight. No one
-                * wants the result, and state has been reparented
-                * to the NULL context, so just free it so we
-                * don't leak memory.
-                */
-               DBG_NOTICE("pwrite request abandoned in flight\n");
-               TALLOC_FREE(state);
-               return;
-       }
        if (ret != 0) {
                if (ret != EAGAIN) {
                        tevent_req_error(req, ret);