Bug 15172 - Compound SMB2 FLUSH+CLOSE requests from MacOSX are not handled correctly.
Summary: Compound SMB2 FLUSH+CLOSE requests from MacOSX are not handled correctly.
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
: 15119 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-09-13 22:56 UTC by Jeremy Allison
Modified: 2022-09-22 23:14 UTC (History)
4 users (show)

See Also:


Attachments
"Raw" patch that fixes it for master. (1.63 KB, patch)
2022-09-14 00:10 UTC, Jeremy Allison
no flags Details
WIP patches for master. (10.33 KB, patch)
2022-09-22 22:30 UTC, Jeremy Allison
no flags Details
WIP patches for master. (14.64 KB, patch)
2022-09-22 23:13 UTC, Jeremy Allison
no flags Details
WIP patches for master. (19.55 KB, patch)
2022-09-22 23:14 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2022-09-13 22:56:30 UTC

    
Comment 1 Jeremy Allison 2022-09-14 00:10:09 UTC
Created attachment 17515 [details]
"Raw" patch that fixes it for master.
Comment 2 Jeremy Allison 2022-09-14 04:48:23 UTC
More importantly, given our current code - when the SMB2 FLUSH is cancelled and returns NT_STATUS_INTERNAL_ERROR, the pthreadpool thread is left running and when it completes after the close has finished the server crashes.

So whatever we eventually decide for dealing with potentially async compound requests, we'll have to use the smb2_request_set_async_internal() trick for compound SMB2 FLUSH requests.
Comment 3 Jeremy Allison 2022-09-15 21:32:58 UTC
*** Bug 15119 has been marked as a duplicate of this bug. ***
Comment 4 Jeremy Allison 2022-09-21 20:08:25 UTC
Metze requested 4 tests, which I am now coding up.

1). Opendir foo
    notify foo
    create foo/bar
    notify recv
    delete foo/bar
 C   --------------
     notify
     close (compound handle).
     --------------

2). Opendir foo
    notify foo
    create foo/bar
    notify recv
    delete foo/bar
 C   --------------
     getinfo foo-handle
     notify
     close (compound handle).
     --------------

3). Opendir foo
    notify foo
    create foo/bar
    notify recv
 C   --------------
     notify
     close (compound handle).
     --------------

4). Opendir foo
    notify foo
    create foo/bar
    notify recv
 C   --------------
     getinfo foo-handle
     notify
     close (compound handle).
     --------------

I now have test #1 done, and when I send the compound notify+close, I get NT_STATUS_INTERNAL_ERROR against Windows 2020 returned for the notify (which should not have gone async as it had a pending notify to reply). So it isn't as simple as always allowing async in a compound.

Brad, I think you need to rethink what your client is doing here.
Comment 5 Jeremy Allison 2022-09-22 22:30:43 UTC
Created attachment 17526 [details]
WIP patches for master.

Implement tests 1 and 2 against Windows (pass).
Comment 6 Jeremy Allison 2022-09-22 23:13:18 UTC
Created attachment 17527 [details]
WIP patches for master.

All 4 tests requested by Metze. Requested clarification from dochelp.
Comment 7 Jeremy Allison 2022-09-22 23:14:46 UTC
Created attachment 17528 [details]
WIP patches for master.

Now with all 4 tests :-).