Created attachment 17407 [details] SambaFailWindowsWorksPackets Configuration: QNAP TVS-h1288X (QuTS hero) Firmware: h5.0.0.1892 smbd (samba daemon) Version 4.13.14 Steps to Reproduce: 1. SMB Client logs into the server 2. testfile is created 3. Named stream of AFP_Resource is created in testfile 4. Data is written to the AFP_Resource resulting in a length of 63 5. AFP_Resource is closed 6. AFP_Resource is deleted 7. Create/QueryInfo(SMB2_FILE_STRAM_INFO)/Close is done on testfile Expected Results: The AFP_Resource named stream should be deleted Actual Results: Samba server return the QueryInfo showing that AFP_Resource is still present and still has a length of 63 I have attached a packet trace showing the incorrect behavior from Samba (QueryInfo at 185) and the correct behavior from Windows (QueryInfo at 407).
Created attachment 17514 [details] "Raw" patch that fixes it for master. Confirmed by Brad from Apple at SNIA SDC 2022.
Adding Ralph so he can see the problem.
Comment on attachment 17514 [details] "Raw" patch that fixes it for master. Does this pass make test TESTS=vfs.fruit ?
Don't know. Haven't done a: make test TESTS=vfs.fruit yet. It fixes the problem for Brad with his Apple client code. It also seems to make the code match the comment :-).
make test TESTS=vfs.fruit fails: checking whether create with delete-on-close is ignored for AFP_AfpResource Opening not existing AFP_AfpResource i[0] exp[::$DATA] got[::$DATA] Trying to delete AFP_AfpResource via create with delete-on-close Open stream vfs_fruit_dir\file:AFP_Resource i[0] exp[::$DATA] got[::$DATA] i[1] exp[:AFP_Resource:$DATA] got[:AFP_Resource:$DATA] WARNING!: ../../source4/torture/vfs/fruit.c:3751: finfo.stream_info.out.num_streams was 1 (0x1), expected 2 (0x2): stream count UNEXPECTED(failure): samba3.vfs.fruit metadata_netatalk.create delete-on-close AFP_AfpResource(nt4_dc) REASON: Exception: Exception: ../../source4/torture/vfs/fruit.c:4599: Expression `ret == 1' failed: Bad streams Trying to delete AFP_AfpResource via setinfo with delete-on-close WARNING!: ../../source4/torture/vfs/fruit.c:3751: finfo.stream_info.out.num_streams was 1 (0x1), expected 2 (0x2): stream count UNEXPECTED(failure): samba3.vfs.fruit metadata_netatalk.setinfo delete-on-close AFP_AfpResource(nt4_dc) REASON: Exception: Exception: ../../source4/torture/vfs/fruit.c:4666: Expression `ret == 1' failed: Bad streams which is this test: test_create_delete_on_close_resource(). Did you test this against a Mac SMB2 server ? If it passes against a Mac, then there's something different here I'm not seeing.
Created attachment 17517 [details] Patch for vfs_fruit test to allow unique filename for delete on close AFP_Resource test.
Created attachment 17518 [details] pcap file of smbtorture vfs_fruit test running against MacOSX "Ventura" 10.13 server. Look at packet number 1449 - this is the open with DELETE_ON_CLOSE set for filename "vfs_fruit_dir\del_on_close_file:AFP_Resource" - and showing that the MacOSX server *does* delete this stream (of size 10 bytes).
Created attachment 17519 [details] Text result (stdout) from smbtorture vfs_fruit run against MacOSX server Relevant lines from file - showing MacOSX server will delete a 10 byte AFP_AfpResource stream: 130 test: create delete-on-close AFP_AfpResource 131 time: 2022-09-15 16:29:06.016219 132 Checking whether create with delete-on-close is ignored for AFP_AfpResource 133 Opening not existing AFP_AfpResource 134 i[0] exp[::$DATA] got[::$DATA] 135 Trying to delete AFP_AfpResource via create with delete-on-close 136 Open stream vfs_fruit_dir\del_on_close_file:AFP_Resource 137 i[0] exp[::$DATA] got[::$DATA] 138 i[1] exp[:AFP_Resource:$DATA] got[:AFP_Resource:$DATA] 139 WARNING!: ../../source4/torture/vfs/fruit.c:3751: finfo.stream_info.out.num_streams was 1 (0x1), expected 2 (0x2): stream count 140 time: 2022-09-15 16:29:06.183082 141 failure: create delete-on-close AFP_AfpResource [ 142 ../../source4/torture/vfs/fruit.c:4599: Expression `ret == 1' failed: Bad streams 143 ]
Ralph, these last attachments show that MacOSX *will* delete a non-zero AFP_Resource stream. Our vfs_fruit tests are incorrect here.