windows saves sparseness information in a sparse bit. we should do the same and not determine sparsenedd from allocation info. Patches will follow ...
Created attachment 6139 [details] 0001-s3-add-FILE_ATTRIBUTE_SPARSE-to-get_stat_dos_flags.patch
Created attachment 6140 [details] 0002-s3-remove-set_sparse_flag.patch
Created attachment 6141 [details] 0003-s3-vfs_gpfs-map-SPARSE-attribute-to-from-WINATTRs-to.patch
Created attachment 6142 [details] 0004-s3-smbd-add-file_set_sparse-function.patch
Created attachment 6143 [details] 0005-s3-smbd-don-t-filter-attribs-in-g-set_ea_dos_attribu.patch
Created attachment 6144 [details] 0006-s3-smbd-implement-FSCTL_SET_SPARSE-more-correctly.patch
Created attachment 6145 [details] 0007-s3-don-t-do-strict-allocate-with-sparse-files-minor-.patch
Created attachment 6146 [details] 0008-s3-don-t-do-strict-allocate-with-sparse-files-minor-.patch
Jeremy, Patch 1-6 should be fine for upstream, to make the thing more complete, #7 and #8 need some more work. Do you have an idea how we can get the sparseness info here without doing another call out to the filesystem?
I'm going to push 1-6, with a couple of additional patches on top to make file_set_sparse() a handle based call (which it clearly is). I'll look more closely at #7 and #8 later. Jeremy.
These patches cause the samba3.posix_s3.raw.open test to fail. I'm looking at it. Jeremy.
Created attachment 6147 [details] Replacement for 0005
Created attachment 6148 [details] 0007-file_set_sparse-needs-to-be-a-handle-based-call.patch
Created attachment 6149 [details] 0008-Move-checks-inside-file_set_sparse-to-allow-it-to-be.patch
Comment on attachment 6147 [details] Replacement for 0005 Hi Jeremy, I think that patch is wrong, as the SPARSE flag needs to be ignored in the setfileinfo and setpathinfo calls.
Created attachment 6150 [details] incomplete torture tests This is not complete, but demonstrates that FSCTL_SET_SPARSE is the only call that can change the FILE_ATTRIBUTE_SPARSE, setfileinfo and setpathinfo ignore this flag. But getfileinfo and getpathinfo show it. That's why the FILE_ATTRIBUTE_SPARSE flag just indicates that any stream of the file is sparse and FSCTL_SET_SPARSE works on the handle to the specific stream.
Created attachment 6155 [details] Additional patch to fix the get/set sparse issue. You're right metze - this is what I've added to fix that issue. Jeremy.
looks like this is in master and in 3.6. Looks like we can close this one now. Jeremy: if I'm wrong, please reopen and comment it :-)