Bug 15751 - copy_chunk on POSIX handle fails with STATUS_INVALID_HANDLE
Summary: copy_chunk on POSIX handle fails with STATUS_INVALID_HANDLE
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: Ralph Böhme
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-11 10:02 UTC by Ralph Böhme
Modified: 2025-01-07 23:06 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2024-11-11 10:02:28 UTC
Samba master if mount with "posix" then FSCTL_SRV_COPYCHUNK_WRITE will return "STATUS_INVALID_HANDLE" where the same thing works fine if you mount without "posix".

Client requests an access_mask including FILE_APPEND_DATA on the destination handle which lets us take the true path in this if condition

        if (posix_open && (access_mask & FILE_APPEND_DATA)) {
                flags |= O_APPEND;
        } 

so we open the destination file with O_APPEND. This then failes in copy_file_range() because O_APPEND is not allowed on the destination file handle.
Comment 1 Samba QA Contact 2025-01-07 23:06:03 UTC
This bug was referenced in samba master:

aa0d0e3c91f914464d7b22391d74be9845cf17f9
5c7b8793d753fe47720a95cff3fad72827ca4f82
63d59c15bb81daf55d21bbab1d868f034d125a78
c9001999ca3e3a43e197767420dd7649dad4f858
5c36cd2b9e6e2df7b9bedef71a9ba32820d89449
47c5d97d82b4ed6ad3cd4bf91b5824234af1b319