[SCM] Samba Shared Repository - branch v4-9-test updated

Karolin Seeger kseeger at samba.org
Tue Nov 6 11:17:02 UTC 2018


The branch, v4-9-test has been updated
       via  2dd3c33 torture: Fix the clang build
       via  7354097 vfs_fruit: let fruit_open_meta() with O_CREAT return a fake-fd
       via  cf43b5d vfs_fruit: don't check for delete-on-close on the FinderInfo stream
       via  eacbfe9 vfs_fruit: let fruit_pwrite_meta_stream also ftruncate empty FinderInfo
       via  27a5a83 vfs_fruit: pass stream size to delete_invalid_meta_stream()
       via  029f64f vfs_fruit: let fruit handle all aio on the FinderInfo metadata stream
       via  d405dc3 vfs_fruit: do ino calculation
       via  c23f1da vfs_fruit: prepare fruit_pread_meta() for reading on fake-fd
       via  a5b677d vfs_fruit: prepare fruit_pwrite_meta() for on-demand opening and writing
       via  44834da vfs_fruit: prepare struct fio for fake-fd and on-demand opening
       via  a57e29e vfs_fruit: add fio->created
       via  c7ce8c8 vfs_fruit: remove resource fork special casing
       via  c8e1405 vfs_fruit: add some debugging of dev/ino
       via  42a5dbd s4:torture/vfs/fruit: add test "empty_stream"
       via  5076abb s4:torture/vfs/fruit: add check_stream_list_handle()
       via  0a16d4f s4:torture/util: add torture_smb2_open()
       via  e03f36a vfs_fruit: filter empty streams
       via  e8f1df0 vfs_fruit: use check on global_fruit_config.nego_aapl for macOS specific behaviour
       via  71d8b4a s4:torture/vfs/fruit: enable AAPL extensions in a bunch of tests
       via  a09f0a8 vfs_fruit: don't unlink 0-byte size truncated streams
       via  535abb3 s4:torture/vfs/fruit: write some data to a just created teststream
       via  e2fe019 s4:torture/vfs/fruit: expand test "setinfo eof stream"
       via  abfc211 vfs_fruit: update handling of read-only creation of resource fork
       via  816651b s4:torture/vfs/fruit: update test "creating rsrc with read-only access" for newer macOS versions
       via  cc9956e s4:torture/vfs/fruit: expand existing vfs_test "null afpinfo"
       via  530c24f s4:torture/vfs/fruit: expand existing test "setinfo delete-on-close AFP_AfpInfo" a little bit
       via  756da49 s4:torture/vfs/fruit: update test "read open rsrc after rename" to work with macOS
       via  8b5a4c3 s4:torture/vfs/fruit: ensure a directory handle is closed in all code paths
       via  1e3f8a6 s4:torture/vfs/fruit: update test "stream names" to work with macOS
       via  cca8842 s4:torture/vfs/fruit: update test "SMB2/CREATE context AAPL" to work against macOS
       via  7717809 s4:torture/vfs/fruit: set share_access to NTCREATEX_SHARE_ACCESS_MASK in check_stream_list
       via  718317b s4:torture/vfs/fruit: fix a few error checks in "delete AFP_AfpInfo by writing all 0"
       via  dd2a1d0 s4:torture/vfs/fruit: skip a few tests when running against a macOS SMB server
       via  e03bdef vfs_streams_xattr: fix open implementation
       via  53104cb ctdb-recovery: Ban a node that causes recovery failure
       via  d72319d s3:smbd: remove now unused check if fsp is NULL
       via  c1e441e s3:smbd: fix SMB2 aio cancelling
       via  a9bb620 s4:torture/smb2/read: add test for cancelling SMB aio
       via  6fa0ab1 vfs_delay_inject: implement pread_send and pwrite_send
       via  82a7e00 s4:libcli/smb2: reapply request endtime
       via  7e99105 libcli: fill endtime if smbXcli_req_create() timeout is non-zero
       via  786b6c7 libcli: add smbXcli_req_endtime
      from  a0a3ce5 dsdb group audit tests: log_membership_changes extra tests

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-9-test


- Log -----------------------------------------------------------------
commit 2dd3c3341a6f0fa577571955ed9ed24a6b63d5ac
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Nov 1 12:09:14 2018 +0100

    torture: Fix the clang build
    
    It's used uninitialized if an early torture_assert fails
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Nov  1 17:34:31 CET 2018 on sn-devel-144
    
    (cherry picked from commit 9b28d47b0d86570be5a7c5628e460e01207afb00)
    
    Autobuild-User(v4-9-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-9-test): Tue Nov  6 12:16:07 CET 2018 on sn-devel-144

commit 73540974bc8fc03bb1860581449bd6509f36d3ad
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Aug 22 15:25:26 2018 +0200

    vfs_fruit: let fruit_open_meta() with O_CREAT return a fake-fd
    
    This is the final step in implementing the needed macOS semantics on the
    FinderInfo stream: as long as the client hasn't written a non-zero
    FinderInfo blob to the stream, there mustn't be a visible filesystem
    entry for other openers.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    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): Thu Nov  1 01:14:23 CET 2018 on sn-devel-144
    
    (cherry picked from commit 1b2de44ea8114cf2025e8b8c843131e2f2dbed27)

commit cf43b5dbb9489c6717fe7c90c4c2da940ad8e604
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Oct 20 23:50:32 2018 +0200

    vfs_fruit: don't check for delete-on-close on the FinderInfo stream
    
    macOS SMB server doesn't filter out the FinderInfo stream if it has
    delete-on-close set.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit d8c1bb52018289878b9397d513ebbae63933a05f)

commit eacbfe94ae821d1ffa9e94eccd4cabb24ae21714
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Oct 20 23:40:14 2018 +0200

    vfs_fruit: let fruit_pwrite_meta_stream also ftruncate empty FinderInfo
    
    fruit_streaminfo currently filters out the FinderInfo stream is
    delete-on-close is set. We set it here internally, but the client may
    also set it over SMB. Turns out that the macOS SMB server does NOT
    filter out FinderInfo stream with delete-on-close set, so we must change
    the way filtering is done in fruit_streaminfo.
    
    Filtering is now done based on the FinderInfo stream being 0-bytes large which
    is why I'm adding the ftruncate here.
    
    No idea why the tests that check the filtering passed the commits
    leading up to this one, but if you revert this commit after applying the
    whole patchset, the "delete AFP_AfpInfo by writing all 0" test will fail.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 480695cd723cc4949e0b39ddb83560efac393412)

commit 27a5a834fafd9baf297558f2110c390fe424ff80
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Oct 20 23:46:43 2018 +0200

    vfs_fruit: pass stream size to delete_invalid_meta_stream()
    
    delete_invalid_meta_stream() is meant to guard against random data being
    present in the FinderInfo stream. If the stream size is 0, it's likely a
    freshly created stream where no data has been written to yet, so don't
    delete it.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6e13dbddaec9f8118e11309297f85c3cdfd22e43)

commit 029f64f9dc7febe7fd1d976a3f48a4249e0e1a3a
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Oct 17 16:51:34 2018 +0200

    vfs_fruit: let fruit handle all aio on the FinderInfo metadata stream
    
    This will be required to support using fake fds for the FinderInfo
    metadata stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6fd256afcd5fedc894036efbfba1fc6d2264fba9)

commit d405dc3833b5100c1a39f24a86d45bf5030b63bb
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Aug 22 16:49:23 2018 +0200

    vfs_fruit: do ino calculation
    
    As we'll start returning fake fds in open shortly, we can't rely on the
    next module to calculat correct inode numbers for streams and must take
    over that responsibility.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 80afafe398566fd622f431966808d08ba9ec6473)

commit c23f1da9ca37b5dae64350afab96b4e5f6a1fb0f
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Aug 22 15:22:08 2018 +0200

    vfs_fruit: prepare fruit_pread_meta() for reading on fake-fd
    
    If the read on the stream fails we may have hit a handle on a just
    created stream (fio->created=true) with no data written yet.
    
    If that's the case return an empty initialized FinderInfo blob.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit d7d92710711f6e555ed45c1dda528cd6a83e1bf5)

commit a5b677d383b88072b789bb4c6ec0f590de0ab153
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Aug 22 15:21:08 2018 +0200

    vfs_fruit: prepare fruit_pwrite_meta() for on-demand opening and writing
    
    This avoid creating files or blobs in our streams backend when a client
    creates a stream but hasn't written anything yet. This is the only sane
    way to implement the following semantics:
    
    * client 1: create stream "file:foo"
    
    * client 2: open stream "file:foo"
    
    The second operation of client 2 must fail with NT_STATUS_NOT_FOUND.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4a5c9a9e73230f640eb045a3c47af75b5be9f1d6)

commit 44834da34b23aa92c8405b3433bc85c1e6fbc50b
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Aug 22 15:22:57 2018 +0200

    vfs_fruit: prepare struct fio for fake-fd and on-demand opening
    
    Not used for now, that comes in the subsequent commits.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 96320eccc9a63b793ff8d05842bce54f120286f9)

commit a57e29e38c0771f61cd6e6b3e9e2caad80d91113
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 22 16:56:46 2018 +0200

    vfs_fruit: add fio->created
    
    fio->created tracks whether a create created a stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1e055a79541eb69eb2deeae897dde3665c5ffee2)

commit c7ce8c871a15295a6a0a5195c6a165a925486467
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 15 18:38:33 2018 +0200

    vfs_fruit: remove resource fork special casing
    
    Directly unlinking a file with open handles is not good, don't do it.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit a26032c3f68028b01fb6a7d38851409db1858161)

commit c8e1405c82f609dc77cb9c071f8b00c6a2524c0c
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Oct 17 19:07:11 2018 +0200

    vfs_fruit: add some debugging of dev/ino
    
    Aids in debugging dev/ino mismatch failures in open_file_ntcreate.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 993c7c4e711612225bd07b8fa5544c4bfef88a9e)

commit 42a5dbdb461326b2e859004b46223e9f31fe8443
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 22 16:21:21 2018 +0200

    s4:torture/vfs/fruit: add test "empty_stream"
    
    One to rule them all: consistently test critical operations on all
    streams relevant to macOS clients: the FinderInfo stream, the Resource
    Fork stream and an arbitrary stream that macOS maps to xattrs when
    written to on a macOS SMB server.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9d8751db64de75a0de442365b317c1b9ce194170)

commit 5076abb55072532e3cb31fdd38b51c4d1d329d93
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Oct 11 17:14:50 2018 +0200

    s4:torture/vfs/fruit: add check_stream_list_handle()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit aba502d440ae3478543d3be5c5bbcea39fb0a463)

commit 0a16d4fc03b903a536581fa15066860a4e0cbb90
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Oct 10 18:45:56 2018 +0200

    s4:torture/util: add torture_smb2_open()
    
    This seems to be missing: a simple wrapper to just open a file without
    fancy options.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 64b28e4a94365092f46052712a38e6fcfbb9f20c)

commit e03f36aac4587e0620a6e3d577c10c111f6137a1
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Oct 20 14:53:50 2018 +0200

    vfs_fruit: filter empty streams
    
    First step in achieving macOS compliant behaviour wrt to empty streams:
    - hide empty streams in streaminfo
    - prevent opens of empty streams
    
    This means that we may carry 0-byte sized streams in our streams
    backend, but this shouldn't really hurt.
    
    The previous attempt of deleting the streams when an SMB setinfo eof to
    0 request came in, turned out be a road into desaster.
    
    We could set delete-on-close on the stream, but that means we'd have to
    check for it for every write on a stream and checking the
    delete-on-close bits requires fetching the locking.tdb record, so this
    is expensive and I'd like to avoid that overhead.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ebfcf75e993b1a792db76b94aa898532e1c81eeb)

commit e8f1df015d6335aad02f846d39e86ef94eefdfb7
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Oct 20 15:28:06 2018 +0200

    vfs_fruit: use check on global_fruit_config.nego_aapl for macOS specific behaviour
    
    Ensure any non MS compliant protocol behaviour targetted at supporting
    macOS clients are only effective if the client negotiated AAPL.
    
    Currently this only guards the resource fork which only macOS client are
    going to use, but subsequent commits add more this at this place.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 046456fca60b9fef38a0cdf5a116883fb1c7dffe)

commit 71d8b4a2f49274e1f7eca8ce6fbf7a3aa935e9ef
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 22 14:01:34 2018 +0200

    s4:torture/vfs/fruit: enable AAPL extensions in a bunch of tests
    
    These tests check for macOS SMB server specific behaviour. They work
    currently against Samba without enabling AAPL because in vfs_fruit we're
    currently don't check whether AAPL has been negotiated in one place. A
    subsequent commit will change that and this commit prepares for that
    change.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 7485007bb0a69dc8237c78be90f4bae06aad49b2)

commit a09f0a80589a7c362cb8aca6b3bd22e5318ec58d
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Oct 20 14:54:48 2018 +0200

    vfs_fruit: don't unlink 0-byte size truncated streams
    
    This caused all sort of havoc with subsequent SMB request that acted on
    the handle of the then deleted backend storage (file or blob, depending
    on the used streams module).
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 287082d739362ad068df37076712927ccd7ca90c)

commit 535abb333ef1dd67614d9eb7e0bf7e05420fdbfb
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Oct 20 14:52:23 2018 +0200

    s4:torture/vfs/fruit: write some data to a just created teststream
    
    Doesn't currently make a difference, but this prepares for a later
    change in vfs_fruit that will filter out empty streams (which is the
    macOS behaviour).
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 3195ff9547824dd129e3fbcbbb8823fb10a0a5d4)

commit e2fe019762a0548c446a3588bc9f0c9e9559d1e7
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 22 12:43:16 2018 +0200

    s4:torture/vfs/fruit: expand test "setinfo eof stream"
    
    o Adds checks verifying that after setting eof to 0 on a stream, a
      subsequent open gets ENOENT, before and after closing the handle that
      had been used to set eof to 0.
    
    o Verify that a write to a handle succeeds after that handle has been
      used to set eof to 0 on a stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit b35d9e74028727da24f349242cb0bc62403a9b09)

commit abfc2110d8af8523a6a8b6bd4b7a570407b133b9
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 22 12:32:09 2018 +0200

    vfs_fruit: update handling of read-only creation of resource fork
    
    macOS SMB server versions supports this since 10.12, so we adapt our
    behaviour.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 055ca448f1a2bd995291af1810c9ec94f90f32dd)

commit 816651be1187c1cc36e6fb07a85cb901d247cadc
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 15 15:17:08 2018 +0200

    s4:torture/vfs/fruit: update test "creating rsrc with read-only access" for newer macOS versions
    
    While this operation failed against older macOS versions, it passes
    against versions 10.12 and newer. Update the test accordingly, a
    subsequent commit will then update our implementation.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit c3cf09a0791ed4dfb7ca18d175396ac1aca5d2ed)

commit cc9956ef6f2f969b90e13aa5b8bf010ec010199a
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Oct 10 12:47:07 2018 +0200

    s4:torture/vfs/fruit: expand existing vfs_test "null afpinfo"
    
    This adds a check that a read on a seperate handle also sees the
    previously created AFP_AfpInfo stream.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 6f428607e35055b9ce1a04a625d43740bf5c76b2)

commit 530c24f880693e4e76a39775108d66d62064b42d
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Oct 9 18:48:08 2018 +0200

    s4:torture/vfs/fruit: expand existing test "setinfo delete-on-close AFP_AfpInfo" a little bit
    
    Add a check that verifies a create on a stream gets
    NT_STATUS_DELETE_PENDING after delete-on-close has been set.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 0d9a80b6b2e3f51cad122ee0dc78c2f4dfdebcb5)

commit 756da49288f64f5de466a7647bcbc1c88b9f3434
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 15 16:24:19 2018 +0200

    s4:torture/vfs/fruit: update test "read open rsrc after rename" to work with macOS
    
    macOS SMB server seems to return NT_STATUS_SHARING_VIOLATION in this
    case while Windows 2016 returns NT_STATUS_ACCESS_DENIED.
    
    Lets stick with the Windows error code for now in the Samba fileserver,
    but let the test pass against macOS.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9cd9859dc10d425d29774d221ec9ad697192b466)

commit 8b5a4c3d6d3c4953c2757a58acb05e3d187627c9
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Oct 31 15:49:45 2018 +0100

    s4:torture/vfs/fruit: ensure a directory handle is closed in all code paths
    
    Otherwise we get a sharing violation when running against Samba and
    opening the directory a second time.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit f7551d8fb3599a6a71dd0570bad02bdc48324107)

commit 1e3f8a6fca6207d9a5c163f41dfea2d97187b2e6
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 15 15:39:12 2018 +0200

    s4:torture/vfs/fruit: update test "stream names" to work with macOS
    
    o create the basefile before trying to create a stream on it, otherwise
      this fails on macOS
    
    o write something to the stream, otherwise the stream is not listed as
      macOS hides 0-byte sized streams
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 125498861abeeed5bde727ff98d88d9ce4af6c75)

commit cca88421a5ddb207b60afa8c77c24089064b8119
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 15 15:31:21 2018 +0200

    s4:torture/vfs/fruit: update test "SMB2/CREATE context AAPL" to work against macOS
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit dba9a4743fc42b57f03b6ace24753ce8091f629f)

commit 7717809db47e55715d29e4173f4f76862544a693
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Oct 11 17:13:52 2018 +0200

    s4:torture/vfs/fruit: set share_access to NTCREATEX_SHARE_ACCESS_MASK in check_stream_list
    
    Avoid sharing conflicts with other opens on the basefile.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1d4e50649b02c7c2314aa04e08f9946e21b6b37d)

commit 718317bdf3182fe68a65ad24d5e0ff2a904f0273
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Oct 17 10:51:45 2018 +0200

    s4:torture/vfs/fruit: fix a few error checks in "delete AFP_AfpInfo by writing all 0"
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 394d1fc9ac8373ea7419ea9514750422bd6e504d)

commit dd2a1d04c4436d7e5ad06212301ae898fe2a0659
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Oct 19 22:21:10 2018 +0200

    s4:torture/vfs/fruit: skip a few tests when running against a macOS SMB server
    
    These tests are designed to test specific vfs_fruit functionality.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 242f42ef79e51e35ab33331e2f2d7c9feaac36f8)

commit e03bdef32153215fe3d9075f1a3ab25e385647d9
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Aug 23 12:07:20 2018 +0200

    vfs_streams_xattr: fix open implementation
    
    Since a long time the modules's open function happily returned success
    when opening a non existent stream without O_CREAT.
    
    This change fixes it to return -1 and errno=ENOATTR if
    
    o get_ea_value() returns NT_STATUS_NOT_FOUND (eg mapped from
      getxattr() = -1, errno=ENOATTR) and
    
    o flags doesn't contain O_CREAT
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 9f58997d7a1ab0358963a45cb8bf291e7afa8068)

commit 53104cbc32bf633d18ce5cae3bcd16d74419fa72
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Oct 29 14:33:08 2018 +1100

    ctdb-recovery: Ban a node that causes recovery failure
    
    ... instead of applying banning credits.
    
    There have been a couple of cases where recovery repeatedly takes just
    over 2 minutes to fail.  Therefore, banning credits expire between
    failures and a continuously problematic node is never banned,
    resulting in endless recoveries.  This is because it takes 2
    applications of banning credits before a node is banned, which
    generally involves 2 recovery failures.
    
    The recovery helper makes up to 3 attempts to recover each database
    during a single run.  If a node causes 3 failures then this is really
    equivalent to 3 recovery failures in the model that existed before the
    recovery helper added retries.  In that case the node would have been
    banned after 2 failures.
    
    So, instead of applying banning credits to the "most failing" node,
    simply ban it directly from the recovery helper.
    
    If multiple nodes are causing recovery failures then this can cause a
    node to be banned more quickly than it might otherwise have been, even
    pre-recovery-helper.  However, 90 seconds (i.e. 3 failures) is a long
    time to be in recovery, so banning earlier seems like the best
    approach.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13670
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Mon Nov  5 06:52:33 CET 2018 on sn-devel-144
    
    (cherry picked from commit 27df4f002a594dbb2f2a38afaccf3e22f19818e1)

commit d72319d5cfd360ea573a05e162410d56d73f92b4
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Oct 31 10:21:31 2018 +0100

    s3:smbd: remove now unused check if fsp is NULL
    
    This was used internally to mark an aio request as cancelled. As the aio
    cancellation functionality has been removed, we can now also remove this
    check.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 3fa45900c0ada6596daf09aa4c5054974f3394b0)

commit c1e441e69cfc7cbca8586da3c70f0088762bf5a3
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 28 19:35:59 2018 +0100

    s3:smbd: fix SMB2 aio cancelling
    
    As we currently don't attempt to cancel the internal aio request, we
    must ignore the SMB2 cancel request and continue to process the SMB2
    request, cf MS-SM2 3.3.5.16:
    
      If the target request is not successfully canceled, processing of the
      target request MUST continue and no response is sent to the cancel
      request.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 07eb805cde4db6ac74740e3cfbc56ab6f8e2118a)

commit a9bb62020255fabdb04fdc22996f3a142542e721
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 28 19:29:26 2018 +0100

    s4:torture/smb2/read: add test for cancelling SMB aio
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e37ff8c5fe18d400e378bf2591e209b30473d9f9)

commit 6fa0ab1f439e4e8f68f4b7f057b91c0bdb7367b8
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 28 19:28:42 2018 +0100

    vfs_delay_inject: implement pread_send and pwrite_send
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 35f9bc06722fb07143c832442d784beb204bd367)

commit 82a7e00c086b4e8bf36f08db23c2a4899dcb4a48
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 28 02:05:45 2018 +0100

    s4:libcli/smb2: reapply request endtime
    
    tevent_req_finish() removed a possible request timeout, make sure to
    reinstall it. This happened when an interim SMB2 response was received.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit a6de555c51ca34ef24ac4b4cb672cd748d3197a1)

commit 7e99105948149d42e075db11de0fcdbce3c2e770
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 28 02:04:51 2018 +0100

    libcli: fill endtime if smbXcli_req_create() timeout is non-zero
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit e7eec24d27b8694fd7626577a2aca05e99045964)

commit 786b6c79444d6e0fc1b78a0813fa651bc3426e3d
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Oct 28 02:03:28 2018 +0100

    libcli: add smbXcli_req_endtime
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 94ad5ee662a5bfe1c79d8a9c3fcf51d0a1d652c7)

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

Summary of changes:
 ctdb/server/ctdb_recovery_helper.c  |  46 +-
 libcli/smb/smbXcli_base.c           |  22 +-
 libcli/smb/smbXcli_base.h           |   1 +
 selftest/target/Samba3.pm           |   6 +
 source3/modules/vfs_delay_inject.c  | 262 +++++++++++
 source3/modules/vfs_fruit.c         | 501 +++++++++++----------
 source3/modules/vfs_streams_xattr.c |  64 +--
 source3/selftest/tests.py           |   2 +
 source3/smbd/aio.c                  |  28 +-
 source4/libcli/smb2/transport.c     |  17 +
 source4/selftest/tests.py           |   1 +
 source4/torture/smb2/read.c         | 116 +++++
 source4/torture/smb2/smb2.c         |   1 +
 source4/torture/smb2/util.c         |  30 ++
 source4/torture/vfs/fruit.c         | 876 ++++++++++++++++++++++++++++++++++--
 15 files changed, 1637 insertions(+), 336 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_recovery_helper.c b/ctdb/server/ctdb_recovery_helper.c
index 7495eb3..7fdcc2e 100644
--- a/ctdb/server/ctdb_recovery_helper.c
+++ b/ctdb/server/ctdb_recovery_helper.c
@@ -2571,22 +2571,28 @@ static void recovery_db_recovery_done(struct tevent_req *subreq)
 
 		/* If pulling database fails multiple times */
 		if (max_credits >= NUM_RETRIES) {
-			struct ctdb_req_message message;
-
-			D_ERR("Assigning banning credits to node %u\n",
-			      max_pnn);
-
-			message.srvid = CTDB_SRVID_BANNING;
-			message.data.pnn = max_pnn;
-
-			subreq = ctdb_client_message_send(
-					state, state->ev, state->client,
-					ctdb_client_pnn(state->client),
-					&message);
+			struct ctdb_ban_state ban_state = {
+				.pnn = max_pnn,
+				.time = state->tun_list->recovery_ban_period,
+			};
+
+			D_ERR("Banning node %u for %u seconds\n",
+			      ban_state.pnn,
+			      ban_state.time);
+
+			ctdb_req_control_set_ban_state(&request,
+						       &ban_state);
+			subreq = ctdb_client_control_send(state,
+							  state->ev,
+							  state->client,
+							  ban_state.pnn,
+							  TIMEOUT(),
+							  &request);
 			if (tevent_req_nomem(subreq, req)) {
 				return;
 			}
-			tevent_req_set_callback(subreq, recovery_failed_done,
+			tevent_req_set_callback(subreq,
+						recovery_failed_done,
 						req);
 		} else {
 			tevent_req_error(req, EIO);
@@ -2609,15 +2615,25 @@ static void recovery_failed_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
 		subreq, struct tevent_req);
+	struct recovery_state *state = tevent_req_data(
+		req, struct recovery_state);
+	struct ctdb_reply_control *reply;
 	int ret;
 	bool status;
 
-	status = ctdb_client_message_recv(subreq, &ret);
+	status = ctdb_client_control_recv(subreq, &ret, state, &reply);
 	TALLOC_FREE(subreq);
 	if (! status) {
-		D_ERR("failed to assign banning credits, ret=%d\n", ret);
+		D_ERR("failed to ban node, ret=%d\n", ret);
+		goto done;
+	}
+
+	ret = ctdb_reply_control_set_ban_state(reply);
+	if (ret != 0) {
+		D_ERR("control SET_BAN_STATE failed, ret=%d\n", ret);
 	}
 
+done:
 	tevent_req_error(req, EIO);
 }
 
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index d94b4d8..9edb629 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -227,6 +227,8 @@ struct smbXcli_req_state {
 
 	struct tevent_req *write_req;
 
+	struct timeval endtime;
+
 	struct {
 		/* Space for the header including the wct */
 		uint8_t hdr[HDR_VWV];
@@ -1583,10 +1585,8 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
 	state->smb1.iov_count = iov_count + 4;
 
 	if (timeout_msec > 0) {
-		struct timeval endtime;
-
-		endtime = timeval_current_ofs_msec(timeout_msec);
-		if (!tevent_req_set_endtime(req, ev, endtime)) {
+		state->endtime = timeval_current_ofs_msec(timeout_msec);
+		if (!tevent_req_set_endtime(req, ev, state->endtime)) {
 			return req;
 		}
 	}
@@ -2892,6 +2892,14 @@ static void smb2cli_req_cancel_done(struct tevent_req *subreq)
 	TALLOC_FREE(subreq);
 }
 
+struct timeval smbXcli_req_endtime(struct tevent_req *req)
+{
+	struct smbXcli_req_state *state = tevent_req_data(
+		req, struct smbXcli_req_state);
+
+	return state->endtime;
+}
+
 struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
 				      struct tevent_context *ev,
 				      struct smbXcli_conn *conn,
@@ -3041,10 +3049,8 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
 	}
 
 	if (timeout_msec > 0) {
-		struct timeval endtime;
-
-		endtime = timeval_current_ofs_msec(timeout_msec);
-		if (!tevent_req_set_endtime(req, ev, endtime)) {
+		state->endtime = timeval_current_ofs_msec(timeout_msec);
+		if (!tevent_req_set_endtime(req, ev, state->endtime)) {
 			return req;
 		}
 	}
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 20ef26e..536c7ab 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -74,6 +74,7 @@ NTSTATUS smbXcli_conn_samba_suicide(struct smbXcli_conn *conn,
 
 void smbXcli_req_unset_pending(struct tevent_req *req);
 bool smbXcli_req_set_pending(struct tevent_req *req);
+struct timeval smbXcli_req_endtime(struct tevent_req *req);
 
 uint32_t smb1cli_conn_capabilities(struct smbXcli_conn *conn);
 uint32_t smb1cli_conn_max_xmit(struct smbXcli_conn *conn);
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index a5835d2..50f579a 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -2201,6 +2201,12 @@ sub provision($$$$$$$$$)
 	kernel oplocks = no
 	posix locking = no
 	include = $libdir/delay_inject.conf
+
+[aio_delay_inject]
+	copy = tmp
+	vfs objects = delay_inject
+	delay_inject:pread_send = 2000
+	delay_inject:pwrite_send = 2000
 	";
 	close(CONF);
 
diff --git a/source3/modules/vfs_delay_inject.c b/source3/modules/vfs_delay_inject.c
index 21fea9b..d561fad 100644
--- a/source3/modules/vfs_delay_inject.c
+++ b/source3/modules/vfs_delay_inject.c
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "smbd/smbd.h"
+#include "lib/util/tevent_unix.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
@@ -46,8 +47,269 @@ static int vfs_delay_inject_ntimes(vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
 }
 
+struct vfs_delay_inject_pread_state {
+	struct tevent_context *ev;
+	struct vfs_handle_struct *handle;
+	struct files_struct *fsp;
+	void *data;
+	size_t n;
+	off_t offset;
+	ssize_t ret;
+	struct vfs_aio_state vfs_aio_state;
+};
+
+static void vfs_delay_inject_pread_wait_done(struct tevent_req *subreq);
+static void vfs_delay_inject_pread_done(struct tevent_req *subreq);
+
+static struct tevent_req *vfs_delay_inject_pread_send(
+				struct vfs_handle_struct *handle,
+				TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				struct files_struct *fsp,
+				void *data,
+				size_t n,
+				off_t offset)
+{
+	struct tevent_req *req = NULL, *subreq = NULL;
+	struct vfs_delay_inject_pread_state *state = NULL;
+	int delay;
+	struct timeval delay_tv;
+
+	delay = lp_parm_int(
+		SNUM(handle->conn), "delay_inject", "pread_send", 0);
+	delay_tv = tevent_timeval_current_ofs(delay / 1000,
+					      (delay * 1000) % 1000000);
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct vfs_delay_inject_pread_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	*state = (struct vfs_delay_inject_pread_state) {
+		.ev = ev,
+		.handle = handle,
+		.fsp = fsp,
+		.data = data,
+		.n = n,
+		.offset = offset,
+	};
+
+	if (delay == 0) {
+		subreq = SMB_VFS_NEXT_PREAD_SEND(state,
+						 state->ev,
+						 state->handle,
+						 state->fsp,
+						 state->data,
+						 state->n,
+						 state->offset);
+		if (tevent_req_nomem(subreq, req)) {
+			return tevent_req_post(req, ev);
+		}
+		tevent_req_set_callback(subreq,
+					vfs_delay_inject_pread_done,
+					req);
+		return req;
+	}
+
+	subreq = tevent_wakeup_send(state, ev, delay_tv);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, vfs_delay_inject_pread_wait_done, req);
+	return req;
+}
+
+
+static void vfs_delay_inject_pread_wait_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_delay_inject_pread_state *state = tevent_req_data(
+		req, struct vfs_delay_inject_pread_state);
+	bool ok;
+
+	ok = tevent_wakeup_recv(subreq);
+	TALLOC_FREE(subreq);
+	if (!ok) {
+		tevent_req_error(req, EIO);
+		return;
+	}
+
+	subreq = SMB_VFS_NEXT_PREAD_SEND(state,
+					 state->ev,
+					 state->handle,
+					 state->fsp,
+					 state->data,
+					 state->n,
+					 state->offset);
+	if (tevent_req_nomem(subreq, req)) {
+		return;
+	}
+	tevent_req_set_callback(subreq, vfs_delay_inject_pread_done, req);
+}
+
+static void vfs_delay_inject_pread_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_delay_inject_pread_state *state = tevent_req_data(
+		req, struct vfs_delay_inject_pread_state);
+
+	state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
+	TALLOC_FREE(subreq);
+
+	tevent_req_done(req);
+}
+
+static ssize_t vfs_delay_inject_pread_recv(struct tevent_req *req,
+				struct vfs_aio_state *vfs_aio_state)
+{
+	struct vfs_delay_inject_pread_state *state = tevent_req_data(
+		req, struct vfs_delay_inject_pread_state);
+
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
+		return -1;
+	}
+
+	*vfs_aio_state = state->vfs_aio_state;
+	return state->ret;
+}
+
+struct vfs_delay_inject_pwrite_state {
+	struct tevent_context *ev;
+	struct vfs_handle_struct *handle;
+	struct files_struct *fsp;
+	const void *data;
+	size_t n;
+	off_t offset;
+	ssize_t ret;
+	struct vfs_aio_state vfs_aio_state;
+};
+
+static void vfs_delay_inject_pwrite_wait_done(struct tevent_req *subreq);
+static void vfs_delay_inject_pwrite_done(struct tevent_req *subreq);
+
+static struct tevent_req *vfs_delay_inject_pwrite_send(
+				struct vfs_handle_struct *handle,
+				TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				struct files_struct *fsp,
+				const void *data,
+				size_t n,
+				off_t offset)
+{
+	struct tevent_req *req = NULL, *subreq = NULL;
+	struct vfs_delay_inject_pwrite_state *state = NULL;
+	int delay;
+	struct timeval delay_tv;
+
+	delay = lp_parm_int(
+		SNUM(handle->conn), "delay_inject", "pwrite_send", 0);
+	delay_tv = tevent_timeval_current_ofs(delay / 1000,
+					      (delay * 1000) % 1000000);
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct vfs_delay_inject_pwrite_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	*state = (struct vfs_delay_inject_pwrite_state) {
+		.ev = ev,
+		.handle = handle,
+		.fsp = fsp,
+		.data = data,
+		.n = n,
+		.offset = offset,
+	};
+
+	if (delay == 0) {
+		subreq = SMB_VFS_NEXT_PWRITE_SEND(state,
+						 state->ev,
+						 state->handle,
+						 state->fsp,
+						 state->data,
+						 state->n,
+						 state->offset);
+		if (tevent_req_nomem(subreq, req)) {
+			return tevent_req_post(req, ev);
+		}
+		tevent_req_set_callback(subreq,
+					vfs_delay_inject_pwrite_done,
+					req);
+		return req;
+	}
+
+	subreq = tevent_wakeup_send(state, ev, delay_tv);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(
+		subreq, vfs_delay_inject_pwrite_wait_done, req);
+	return req;
+}
+
+
+static void vfs_delay_inject_pwrite_wait_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_delay_inject_pwrite_state *state = tevent_req_data(
+		req, struct vfs_delay_inject_pwrite_state);
+	bool ok;
+
+	ok = tevent_wakeup_recv(subreq);
+	TALLOC_FREE(subreq);
+	if (!ok) {
+		tevent_req_error(req, EIO);
+		return;
+	}
+
+	subreq = SMB_VFS_NEXT_PWRITE_SEND(state,
+					 state->ev,
+					 state->handle,
+					 state->fsp,
+					 state->data,
+					 state->n,
+					 state->offset);
+	if (tevent_req_nomem(subreq, req)) {
+		return;
+	}
+	tevent_req_set_callback(subreq, vfs_delay_inject_pwrite_done, req);
+}
+
+static void vfs_delay_inject_pwrite_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_delay_inject_pwrite_state *state = tevent_req_data(
+		req, struct vfs_delay_inject_pwrite_state);
+
+	state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
+	TALLOC_FREE(subreq);
+
+	tevent_req_done(req);
+}
+
+static ssize_t vfs_delay_inject_pwrite_recv(struct tevent_req *req,
+				struct vfs_aio_state *vfs_aio_state)
+{
+	struct vfs_delay_inject_pwrite_state *state = tevent_req_data(
+		req, struct vfs_delay_inject_pwrite_state);
+
+	if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
+		return -1;
+	}
+
+	*vfs_aio_state = state->vfs_aio_state;
+	return state->ret;
+}
+
 static struct vfs_fn_pointers vfs_delay_inject_fns = {
 	.ntimes_fn = vfs_delay_inject_ntimes,
+	.pread_send_fn = vfs_delay_inject_pread_send,
+	.pread_recv_fn = vfs_delay_inject_pread_recv,
+	.pwrite_send_fn = vfs_delay_inject_pwrite_send,
+	.pwrite_recv_fn = vfs_delay_inject_pwrite_recv,
 };
 
 static_decl_vfs;
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 5c986a7..14d7a79 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -514,6 +514,20 @@ struct fio {
 
 	/* Denote stream type, meta or rsrc */
 	adouble_type_t type;
+
+	/* Whether the create created the stream */
+	bool created;
+
+	/*
+	 * AFP_AfpInfo stream created, but not written yet, thus still a fake
+	 * pipe fd. This is set to true in fruit_open_meta if there was no
+	 * exisiting stream but the caller requested O_CREAT. It is later set to
+	 * false when we get a write on the stream that then does open and
+	 * create the stream.
+	 */
+	bool fake_fd;
+	int flags;
+	int mode;
 };
 
 /*
@@ -2374,6 +2388,10 @@ static SMB_INO_T fruit_inode(const SMB_STRUCT_STAT *sbuf, const char *sname)
 	SMB_INO_T result;
 	char *upper_sname;
 
+	DBG_DEBUG("fruit_inode called for %ju/%ju [%s]\n",
+		  (uintmax_t)sbuf->st_ex_dev,
+		  (uintmax_t)sbuf->st_ex_ino, sname);
+
 	upper_sname = talloc_strdup_upper(talloc_tos(), sname);
 	SMB_ASSERT(upper_sname != NULL);
 
@@ -2391,8 +2409,8 @@ static SMB_INO_T fruit_inode(const SMB_STRUCT_STAT *sbuf, const char *sname)
 	/* Hopefully all the variation is in the lower 4 (or 8) bytes! */
 	memcpy(&result, hash, sizeof(result));
 
-	DEBUG(10, ("fruit_inode \"%s\": ino=0x%llu\n",
-		   sname, (unsigned long long)result));
+	DBG_DEBUG("fruit_inode \"%s\": ino=%ju\n",
+		  sname, (uintmax_t)result);
 
 	return result;
 }
@@ -3385,66 +3403,68 @@ static int fruit_connect(vfs_handle_struct *handle,
 	return rc;
 }
 
+static int fruit_fake_fd(void)
+{
+	int pipe_fds[2];
+	int fd;
+	int ret;
+
+	/*
+	 * Return a valid fd, but ensure any attempt to use it returns
+	 * an error (EPIPE). Once we get a write on the handle, we open
+	 * the real fd.


-- 
Samba Shared Repository



More information about the samba-cvs mailing list