[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Mar 18 19:41:05 UTC 2020


The branch, master has been updated
       via  86dd5a08096 smbd: enforce AIO requests draining
       via  9a5b79c6634 Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pread_state."
       via  43d5d9b0208 Revert "s3: VFS: vfs_default. Pass in struct vfswrap_pread_state as the callback data to the subreq."
       via  ce0235be276 Revert "s3: VFS: vfs_default. Protect vfs_pread_done() from accessing a freed req pointer."
       via  6041a936126 Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pwrite_state."
       via  a6c186b6831 Revert "s3: VFS: vfs_default. Pass in struct vfswrap_pwrite_state as the callback data to the subreq."
       via  106f83e6d8f Revert "s3: VFS: vfs_default. Protect vfs_pwrite_done() from accessing a freed req pointer."
       via  ddd14d36f67 Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_fsync_state."
       via  22ebf32f3e8 Revert "s3: VFS: vfs_default. Pass in struct vfswrap_fsync_state as the callback data to the subreq."
       via  27e1bfcecca Revert "s3: VFS: vfs_default. Protect vfs_fsync_done() from accessing a freed req pointer."
       via  7acec67ad4a Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pread_state."
       via  097e48fa2c1 Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pread_state as the callback data to the subreq."
       via  e189d707fe2 Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pread_done() from accessing a freed req pointer."
       via  d9b00159a68 Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pwrite_state."
       via  e8c0bdb4231 Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callback data to the subreq."
       via  f2d5e1a8c60 Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pwrite_done() from accessing a freed req pointer."
       via  aac29930009 Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_fsync_state."
       via  a4e51f2681b Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_fsync_state as the callback data to the subreq."
       via  3616d399efb Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_fsync_done() from accessing a freed req pointer."
       via  626b2b0e3d9 Revert "vfs_default: pass in state as the callback data to the subreq"
       via  1a52e635039 Revert "vfs_default: Protect vfs_getxattrat_done() from accessing a freed req pointer"
       via  584933439c7 s3: smbd: Remove file_close_pid().
       via  1de0daa715f s3: smbd: Remove old synchronous SMB1 reply_exit().
       via  8f58feab58a s3: smbd: Add async internals of reply_exit().
       via  446b64ca665 s3: smbd: Remove old synchronous SMB1 reply_ulogoffX().
       via  9cda76ad29d s3: smbd: reply_ulogoffX() Update to modern coding standards.
       via  5c073aa01b3 s3: smbd: In reply_ulogoffX(), replace req -> smb1req.
       via  4dd3012cb1b s3: smbd: Add async internals of reply_ulogoffX.
       via  7613998e10c s3: smbd: Remove old synchronous SMB1 reply_tdis().
       via  71725f1c4ad s3: smbd: reply_tdis() Update to modern coding standards.
       via  ca4521f1dd9 s3: smbd: In reply_tdis(), replace req -> smb1req.
       via  86cc67d5a7d s3: smbd: Add async internals of reply_tdis().
       via  7891302ab8e s3: smbd: Replace synchronous conn_force_tdis() with the async version.
       via  4f9e0459cd0 s3: smbd: Add async internals of conn_force_tdis().
       via  ac800ca6bcb s3: smbd: Don't allow force disconnect of a connection already being disconnected.
       via  4287ea138e8 s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing.
       via  b7d09b30ad1 s3: smbd: In async SMB1 reply_close() set fsp->closing = true, as we already do in SMB2 async close.
       via  b90bc0f2891 s3: smbd: Now we free fsp->aio_requests when it gets zero entries, talloc in chunks of 10 instead of 1.
       via  0c952bba1ed s3: smbd: In aio_del_req_from_fsp() talloc_free(fsp->aio_requests[]) when fsp->num_aio_requests reaches zero.
       via  566658d9141 s3: tests: Slight tweak to the force-close share test.
      from  319c93f0c6a ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 86dd5a080969e14ab0d131d8cb1054ec624a41ba
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Mar 17 11:17:46 2020 +0100

    smbd: enforce AIO requests draining
    
    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: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Mar 18 19:40:00 UTC 2020 on sn-devel-184

commit 9a5b79c6634d55f070c8ad5ae291530872518c6b
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:40:50 2020 -0700

    Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pread_state."
    
    This reverts commit 594a435b33e8447625ca83b50daec2d08cf66d64.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 43d5d9b02085edb3388f39392fa4c88d1380375d
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:40:33 2020 -0700

    Revert "s3: VFS: vfs_default. Pass in struct vfswrap_pread_state as the callback data to the subreq."
    
    This reverts commit e102908f112866d657b8c0cd6a5b217d070210c8.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit ce0235be27693b76af8f01e25a25415797b590f7
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:40:19 2020 -0700

    Revert "s3: VFS: vfs_default. Protect vfs_pread_done() from accessing a freed req pointer."
    
    This reverts commit b9ad06079fe362385cc4c77f8e8d54f5f74d6db6.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 6041a936126400e5f222242830968c279bb60d0e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:40:02 2020 -0700

    Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_pwrite_state."
    
    This reverts commit 86cc7439501ab9b9eb018a18dbbef9567eb9b6f9.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a6c186b6831febc398ed071b89241c0d5d695b04
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:39:46 2020 -0700

    Revert "s3: VFS: vfs_default. Pass in struct vfswrap_pwrite_state as the callback data to the subreq."
    
    This reverts commit 13e25d68385aa951115e0e063ec6a9a281fea4a4.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 106f83e6d8f0d3419ee0f52c65821e267080e48f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:39:31 2020 -0700

    Revert "s3: VFS: vfs_default. Protect vfs_pwrite_done() from accessing a freed req pointer."
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit ddd14d36f67451813369cec15748c84a8cb02929
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:39:07 2020 -0700

    Revert "s3: VFS: vfs_default: Add tevent_req pointer to state struct in vfswrap_fsync_state."
    
    This reverts commit 4adde71b99d4ab09914072458329d5f1008b77e3.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 22ebf32f3e8d404e9b4fccadbeb4ee94dff8b2cc
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:38:18 2020 -0700

    Revert "s3: VFS: vfs_default. Pass in struct vfswrap_fsync_state as the callback data to the subreq."
    
    This reverts commit d623779913e0d4a46d7e299dc41b5c83cb127872.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 27e1bfcecca1a1a243b566edfd18b98b2e7ca42c
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:38:03 2020 -0700

    Revert "s3: VFS: vfs_default. Protect vfs_fsync_done() from accessing a freed req pointer."
    
    This reverts commit 18671534e42f66b904e51c3fbe887e998ff79493.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 7acec67ad4a20716c7ba0ac497caf54771931f89
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:37:48 2020 -0700

    Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pread_state."
    
    This reverts commit 0e3dc0078ebd6aa79553bf2afa8e72945e23dfb0.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 097e48fa2c190e79a14730d054e163f6c01a2663
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:37:30 2020 -0700

    Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pread_state as the callback data to the subreq."
    
    This reverts commit c6c4e2de22cd3d84f45f5c21e6b09b09274f7f7b.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e189d707fe2636636ee2941debfc31eb8a6fce72
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:37:16 2020 -0700

    Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pread_done() from accessing a freed req pointer."
    
    This reverts commit 99283871c5230e640a8102943ebed685459ed9af.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit d9b00159a68e69d3338fe0e60166b55139c23c88
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:36:59 2020 -0700

    Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_pwrite_state."
    
    This reverts commit 058a7effd00b47e4778f7d680cc9c2a7d40d5fa8.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e8c0bdb423156ebcbdba04843d0dc2dfba383197
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:36:39 2020 -0700

    Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callback data to the subreq."
    
    This reverts commit 3357a77d0823eddc1b0db68cfa251a0d54058c88.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit f2d5e1a8c6070fdbd4eb3fe7e354f9ef663bdbb6
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:36:19 2020 -0700

    Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_pwrite_done() from accessing a freed req pointer."
    
    This reverts commit 67910c751c9f5ce8cdd1e57b34e51e5b7163838b.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit aac2993000988231f780cbecc7db9d802f2d1b50
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:36:03 2020 -0700

    Revert "s3: VFS: vfs_glusterfs: Add tevent_req pointer to state struct in vfs_gluster_fsync_state."
    
    This reverts commit c0c088b1b786f0ba248960114191277e91bbba2f.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a4e51f2681b36e25389dc56987b9f4756c16d5c9
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:35:44 2020 -0700

    Revert "s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_fsync_state as the callback data to the subreq."
    
    This reverts commit cdde55a69d0dacd2f9939c2f00cd356c0186f791.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 3616d399efb1773e91d33b4f9a8ac50490085936
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:35:21 2020 -0700

    Revert "s3: VFS: vfs_glusterfs. Protect vfs_gluster_fsync_done() from accessing a freed req pointer."
    
    This reverts commit 9ecbda263f102a24257fd47142b7c24d1f429d8d.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 626b2b0e3d9350edd1baaf12c6768cdd2979951f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:35:04 2020 -0700

    Revert "vfs_default: pass in state as the callback data to the subreq"
    
    This reverts commit 0e894f3e48285415f72cf7a68e26f1802fe8045d.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 1a52e63503907d53d140bbff57771d323d5a2e3d
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 10:34:46 2020 -0700

    Revert "vfs_default: Protect vfs_getxattrat_done() from accessing a freed req pointer"
    
    This reverts commit 95cfcda13fe9a70b9955a7c44173d619eacb34c1.
    
    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 at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 584933439c70af3d2fd047e62a3456c1c2eca45e
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 11:02:19 2020 -0700

    s3: smbd: Remove file_close_pid().
    
    The old synchronous reply_exit() was the only user.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 1de0daa715f3324e3620ae8152b7fbaeb40ee9d9
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 11:01:05 2020 -0700

    s3: smbd: Remove old synchronous SMB1 reply_exit().
    
    SMB1 exit is now fully async.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 8f58feab58afbc7aa214fac2a1728dda68303c6b
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 10:59:16 2020 -0700

    s3: smbd: Add async internals of reply_exit().
    
    Waits until all aio requests on all fsp's owned by this
    vuid are finished before returning to the client.
    
    Charges the profile time in the done function. Not strictly
    correct but better than the other SMB1 async code that
    double-charges profiling in both send and done at the
    moment.
    
    Done this way (commented out) so it is a clean
    diff and it's clear what is being added.
    
    A later commit will remove the old synchronous version.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 446b64ca66591d8ae5b4bf1aabdd46a1e8cb1c1c
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 10:19:31 2020 -0700

    s3: smbd: Remove old synchronous SMB1 reply_ulogoffX().
    
    SMB1 user logoff is now fully async.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 9cda76ad29db0cfbffa3dbb0764ec5dda24490f9
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 10:16:42 2020 -0700

    s3: smbd: reply_ulogoffX() Update to modern coding standards.
    
    Minimizes the diff in the later commits.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 5c073aa01b304f54a0039d9cd9dc74123191eb4b
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 10:15:10 2020 -0700

    s3: smbd: In reply_ulogoffX(), replace req -> smb1req.
    
    Minimises the diff in later commits.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 4dd3012cb1b5e000ccf68d2601dbdbcb7ff538b5
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 10:11:14 2020 -0700

    s3: smbd: Add async internals of reply_ulogoffX.
    
    Waits until all aio requests on all fsp's owned by this
    vuid are finished before returning to the client.
    
    Charges the profile time in the done function. Not strictly
    correct but better than the other SMB1 async code that
    double-charges profiling in both send and done at the
    moment.
    
    Done this way (commented out) so it is a clean
    diff and it's clear what is being added.
    
    A later commit will remove the old synchronous version.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 7613998e10c5f13c896667257fdef33824a45d2a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 10:03:27 2020 -0700

    s3: smbd: Remove old synchronous SMB1 reply_tdis().
    
    SMB1 tree disconnect is now fully async.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 71725f1c4adaa04ef04c0dd400c49399952ef5fa
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 09:59:47 2020 -0700

    s3: smbd: reply_tdis() Update to modern coding standards.
    
    Minimizes the diff in the next commit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit ca4521f1dd97bc5a05e381c652b05ae1eb8bd29b
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 09:55:30 2020 -0700

    s3: smbd: In reply_tdis(), replace req -> smb1req.
    
    Minimises the diff in the next commit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 86cc67d5a7de0a81131b11447dad57b2681d8e01
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 09:51:53 2020 -0700

    s3: smbd: Add async internals of reply_tdis().
    
    Waits until all aio requests on all fsp's under this
    conn struct are finished before returning to the client.
    
    Charges the profile time in the done function. Not strictly
    correct but better than the other SMB1 async code that
    double-charges profiling in both send and done at the
    moment.
    
    Done this way (commented out) so it is a clean
    diff and it's clear what is being added.
    
    A later commit will remove the old synchronous version.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 7891302ab8eeba8261b92171a4d429e2f538b89a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 09:47:26 2020 -0700

    s3: smbd: Replace synchronous conn_force_tdis() with the async version.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 4f9e0459cd06f0332083a4a465f49b5f258838fa
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 09:28:21 2020 -0700

    s3: smbd: Add async internals of conn_force_tdis().
    
    Commented out so it can be seen complete as
    a diff. The next commit will replace the old
    synchronous conn_force_tdis() code with the
    new async code.
    
    Uses a wait_queue to cause the force close
    requests to stay pending until all outstanding
    aio is finished on all file handles opened
    on the connection.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit ac800ca6bcb43c74a1a6ef508b900e2e6cb532dc
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Mar 10 12:25:58 2020 -0700

    s3: smbd: Don't allow force disconnect of a connection already being disconnected.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 4287ea138e82103cce0a939e504f9810636b4747
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 11 15:16:35 2020 -0700

    s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing.
    
    Eventually this will allow us to remove fsp->deferred_close
    from the fsp struct (and also source3/lib/tevent_wait.[ch]).
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b7d09b30ad14d51bbcbe368a11348754121f6ff8
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 11 17:25:59 2020 -0700

    s3: smbd: In async SMB1 reply_close() set fsp->closing = true, as we already do in SMB2 async close.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b90bc0f28918133badbf6810d5e298fc326bd1aa
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 11 14:47:50 2020 -0700

    s3: smbd: Now we free fsp->aio_requests when it gets zero entries, talloc in chunks of 10 instead of 1.
    
    Prevents incremental +1 tallocs, and the original
    idea of this array was that it wasn't freed for
    io efficiency reasons. Add paranoia integer wrap
    protection also.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 0c952bba1edf7c8173d05ccdc6fdaa7232d2c6aa
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Mar 10 10:55:22 2020 -0700

    s3: smbd: In aio_del_req_from_fsp() talloc_free(fsp->aio_requests[]) when fsp->num_aio_requests reaches zero.
    
    The add code in aio_add_req_to_fsp() re-tallocs
    this array on demand, and talloc freeing it here
    allows it to be used as the parent for a tevent
    wait queue, so callers can get notified when
    all outstanding aio on an fsp is finished.
    
    We'll deal with any performance issues in
    the next commit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 566658d914176c41942e3c6aba404ae369aeb123
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 13 15:45:16 2020 -0700

    s3: tests: Slight tweak to the force-close share test.
    
    Turns out on a fast desktop machine 10MB is too small,
    and by the time we've done the 'sleep 1' to make sure
    the smbclient got scheduled and started processing
    the 'put' command, it's already done.
    
    Tweak the file size to be 20MB from 10MB. 10MB
    seems to work reliably on gitlab-ci and on
    sn-devel, but making the put size 20MB makes
    sure it's still in flight when we force-close
    the share, even on a fast desktop box. 20MB
    shouldn't be too burdonsome even on ci VM's.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/offload_token.c                |  10 +
 source3/modules/vfs_default.c                  | 121 +----
 source3/modules/vfs_glusterfs.c                |  93 +---
 source3/script/tests/test_force_close_share.sh |   2 +-
 source3/smbd/aio.c                             |  13 +-
 source3/smbd/close.c                           |  68 +--
 source3/smbd/conn_idle.c                       | 179 ++++++-
 source3/smbd/files.c                           |  31 +-
 source3/smbd/proto.h                           |   2 -
 source3/smbd/reply.c                           | 639 +++++++++++++++++++++++--
 10 files changed, 832 insertions(+), 326 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/offload_token.c b/source3/modules/offload_token.c
index 3fb84dabdff..03bb3309f38 100644
--- a/source3/modules/offload_token.c
+++ b/source3/modules/offload_token.c
@@ -280,6 +280,16 @@ NTSTATUS vfs_offload_token_check_handles(uint32_t fsctl,
 		return NT_STATUS_ACCESS_DENIED;
 	}
 
+	if (src_fsp->closing) {
+		DBG_INFO("copy chunk src handle with closing in progress.\n");
+		return NT_STATUS_ACCESS_DENIED;
+	}
+
+	if (dst_fsp->closing) {
+		DBG_INFO("copy chunk dst handle with closing in progress.\n");
+		return NT_STATUS_ACCESS_DENIED;
+	}
+
 	if (src_fsp->is_directory) {
 		DBG_INFO("copy chunk no read on src directory handle (%s).\n",
 			 smb_fname_str_dbg(src_fsp->fsp_name));
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index cf24e66e048..a30f3ba1d31 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -780,7 +780,6 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons
 }
 
 struct vfswrap_pread_state {
-	struct tevent_req *req;
 	ssize_t ret;
 	int fd;
 	void *buf;
@@ -810,7 +809,6 @@ static struct tevent_req *vfswrap_pread_send(struct vfs_handle_struct *handle,
 		return NULL;
 	}
 
-	state->req = req;
 	state->ret = -1;
 	state->fd = fsp->fh->fd;
 	state->buf = data;
@@ -827,7 +825,7 @@ static struct tevent_req *vfswrap_pread_send(struct vfs_handle_struct *handle,
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, vfs_pread_done, state);
+	tevent_req_set_callback(subreq, vfs_pread_done, req);
 
 	talloc_set_destructor(state, vfs_pread_state_destructor);
 
@@ -863,40 +861,21 @@ static void vfs_pread_do(void *private_data)
 
 static int vfs_pread_state_destructor(struct vfswrap_pread_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;
 }
 
 static void vfs_pread_done(struct tevent_req *subreq)
 {
-	struct vfswrap_pread_state *state = tevent_req_callback_data(
-		subreq, struct vfswrap_pread_state);
-	struct tevent_req *req = state->req;
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfswrap_pread_state *state = tevent_req_data(
+		req, struct vfswrap_pread_state);
 	int ret;
 
 	ret = pthreadpool_tevent_job_recv(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("pread request abandoned in flight\n");
-		TALLOC_FREE(state);
-		return;
-	}
 	if (ret != 0) {
 		if (ret != EAGAIN) {
 			tevent_req_error(req, ret);
@@ -929,7 +908,6 @@ static ssize_t vfswrap_pread_recv(struct tevent_req *req,
 }
 
 struct vfswrap_pwrite_state {
-	struct tevent_req *req;
 	ssize_t ret;
 	int fd;
 	const void *buf;
@@ -959,7 +937,6 @@ static struct tevent_req *vfswrap_pwrite_send(struct vfs_handle_struct *handle,
 		return NULL;
 	}
 
-	state->req = req;
 	state->ret = -1;
 	state->fd = fsp->fh->fd;
 	state->buf = data;
@@ -976,7 +953,7 @@ static struct tevent_req *vfswrap_pwrite_send(struct vfs_handle_struct *handle,
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, vfs_pwrite_done, state);
+	tevent_req_set_callback(subreq, vfs_pwrite_done, req);
 
 	talloc_set_destructor(state, vfs_pwrite_state_destructor);
 
@@ -1012,40 +989,21 @@ 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;
 }
 
 static void vfs_pwrite_done(struct tevent_req *subreq)
 {
-	struct vfswrap_pwrite_state *state = tevent_req_callback_data(
-		subreq, struct vfswrap_pwrite_state);
-	struct tevent_req *req = state->req;
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfswrap_pwrite_state *state = tevent_req_data(
+		req, struct vfswrap_pwrite_state);
 	int ret;
 
 	ret = pthreadpool_tevent_job_recv(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);
@@ -1078,7 +1036,6 @@ static ssize_t vfswrap_pwrite_recv(struct tevent_req *req,
 }
 
 struct vfswrap_fsync_state {
-	struct tevent_req *req;
 	ssize_t ret;
 	int fd;
 
@@ -1103,7 +1060,6 @@ static struct tevent_req *vfswrap_fsync_send(struct vfs_handle_struct *handle,
 		return NULL;
 	}
 
-	state->req = req;
 	state->ret = -1;
 	state->fd = fsp->fh->fd;
 
@@ -1116,7 +1072,7 @@ static struct tevent_req *vfswrap_fsync_send(struct vfs_handle_struct *handle,
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, vfs_fsync_done, state);
+	tevent_req_set_callback(subreq, vfs_fsync_done, req);
 
 	talloc_set_destructor(state, vfs_fsync_state_destructor);
 
@@ -1151,40 +1107,21 @@ static void vfs_fsync_do(void *private_data)
 
 static int vfs_fsync_state_destructor(struct vfswrap_fsync_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;
 }
 
 static void vfs_fsync_done(struct tevent_req *subreq)
 {
-	struct vfswrap_fsync_state *state = tevent_req_callback_data(
-		subreq, struct vfswrap_fsync_state);
-	struct tevent_req *req = state->req;
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfswrap_fsync_state *state = tevent_req_data(
+		req, struct vfswrap_fsync_state);
 	int ret;
 
 	ret = pthreadpool_tevent_job_recv(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("fsync request abandoned in flight\n");
-		TALLOC_FREE(state);
-		return;
-	}
 	if (ret != 0) {
 		if (ret != EAGAIN) {
 			tevent_req_error(req, ret);
@@ -3289,15 +3226,6 @@ struct vfswrap_getxattrat_state {
 static int vfswrap_getxattrat_state_destructor(
 		struct vfswrap_getxattrat_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;
 }
 
@@ -3417,7 +3345,7 @@ static struct tevent_req *vfswrap_getxattrat_send(
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, vfswrap_getxattrat_done, state);
+	tevent_req_set_callback(subreq, vfswrap_getxattrat_done, req);
 
 	talloc_set_destructor(state, vfswrap_getxattrat_state_destructor);
 
@@ -3512,9 +3440,10 @@ end_profile:
 
 static void vfswrap_getxattrat_done(struct tevent_req *subreq)
 {
-	struct vfswrap_getxattrat_state *state = tevent_req_callback_data(
-		subreq, struct vfswrap_getxattrat_state);
-	struct tevent_req *req = state->req;
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfswrap_getxattrat_state *state = tevent_req_data(
+		req, struct vfswrap_getxattrat_state);
 	int ret;
 	bool ok;
 
@@ -3528,16 +3457,6 @@ static void vfswrap_getxattrat_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("getxattr request abandoned in flight\n");
-		TALLOC_FREE(state);
-		return;
-	}
 	if (ret != 0) {
 		if (ret != EAGAIN) {
 			tevent_req_error(req, ret);
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index b5300282b7b..d4b68fba376 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -713,7 +713,6 @@ static ssize_t vfs_gluster_pread(struct vfs_handle_struct *handle,
 }
 
 struct vfs_gluster_pread_state {
-	struct tevent_req *req;
 	ssize_t ret;
 	glfs_fd_t *fd;
 	void *buf;
@@ -749,7 +748,6 @@ static struct tevent_req *vfs_gluster_pread_send(struct vfs_handle_struct
 		return NULL;
 	}
 
-	state->req = req;
 	state->ret = -1;
 	state->fd = glfd;
 	state->buf = data;
@@ -766,7 +764,7 @@ static struct tevent_req *vfs_gluster_pread_send(struct vfs_handle_struct
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, vfs_gluster_pread_done, state);
+	tevent_req_set_callback(subreq, vfs_gluster_pread_done, req);
 
 	talloc_set_destructor(state, vfs_gluster_pread_state_destructor);
 
@@ -807,40 +805,21 @@ static void vfs_gluster_pread_do(void *private_data)
 
 static int vfs_gluster_pread_state_destructor(struct vfs_gluster_pread_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;
 }
 
 static void vfs_gluster_pread_done(struct tevent_req *subreq)
 {
-	struct vfs_gluster_pread_state *state = tevent_req_callback_data(
-		subreq, struct vfs_gluster_pread_state);
-	struct tevent_req *req = state->req;
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_gluster_pread_state *state = tevent_req_data(
+		req, struct vfs_gluster_pread_state);
 	int ret;
 
 	ret = pthreadpool_tevent_job_recv(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("gluster pread request abandoned in flight\n");
-		TALLOC_FREE(state);
-		return;
-	}
 	if (ret != 0) {
 		if (ret != EAGAIN) {
 			tevent_req_error(req, ret);
@@ -873,7 +852,6 @@ static ssize_t vfs_gluster_pread_recv(struct tevent_req *req,
 }
 
 struct vfs_gluster_pwrite_state {
-	struct tevent_req *req;
 	ssize_t ret;
 	glfs_fd_t *fd;
 	const void *buf;
@@ -909,7 +887,6 @@ static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct
 		return NULL;
 	}
 
-	state->req = req;
 	state->ret = -1;
 	state->fd = glfd;
 	state->buf = data;
@@ -926,7 +903,7 @@ static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, vfs_gluster_pwrite_done, state);
+	tevent_req_set_callback(subreq, vfs_gluster_pwrite_done, req);
 
 	talloc_set_destructor(state, vfs_gluster_pwrite_state_destructor);
 
@@ -967,40 +944,21 @@ static void vfs_gluster_pwrite_do(void *private_data)
 
 static int vfs_gluster_pwrite_state_destructor(struct vfs_gluster_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;
 }
 
 static void vfs_gluster_pwrite_done(struct tevent_req *subreq)
 {
-	struct vfs_gluster_pwrite_state *state = tevent_req_callback_data(
-		subreq, struct vfs_gluster_pwrite_state);
-	struct tevent_req *req = state->req;
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_gluster_pwrite_state *state = tevent_req_data(
+		req, struct vfs_gluster_pwrite_state);
 	int ret;
 
 	ret = pthreadpool_tevent_job_recv(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("gluster pwrite request abandoned in flight\n");
-		TALLOC_FREE(state);
-		return;
-	}
 	if (ret != 0) {
 		if (ret != EAGAIN) {
 			tevent_req_error(req, ret);
@@ -1114,7 +1072,6 @@ static int vfs_gluster_renameat(struct vfs_handle_struct *handle,
 }
 
 struct vfs_gluster_fsync_state {
-	struct tevent_req *req;
 	ssize_t ret;
 	glfs_fd_t *fd;
 
@@ -1145,7 +1102,6 @@ static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
 		return NULL;
 	}
 
-	state->req = req;
 	state->ret = -1;
 	state->fd = glfd;
 
@@ -1158,7 +1114,7 @@ static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, vfs_gluster_fsync_done, state);
+	tevent_req_set_callback(subreq, vfs_gluster_fsync_done, req);
 
 	talloc_set_destructor(state, vfs_gluster_fsync_state_destructor);
 
@@ -1197,40 +1153,21 @@ static void vfs_gluster_fsync_do(void *private_data)
 
 static int vfs_gluster_fsync_state_destructor(struct vfs_gluster_fsync_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;
 }
 
 static void vfs_gluster_fsync_done(struct tevent_req *subreq)
 {
-	struct vfs_gluster_fsync_state *state = tevent_req_callback_data(
-		subreq, struct vfs_gluster_fsync_state);
-	struct tevent_req *req = state->req;
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_gluster_fsync_state *state = tevent_req_data(
+		req, struct vfs_gluster_fsync_state);
 	int ret;
 
 	ret = pthreadpool_tevent_job_recv(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("gluster fsync request abandoned in flight\n");
-		TALLOC_FREE(state);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list