Bug 13807 - vfs_ceph strict_allocate_ftruncate calls (local FS) ftruncate and fallocate
Summary: vfs_ceph strict_allocate_ftruncate calls (local FS) ftruncate and fallocate
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-26 14:45 UTC by David Disseldorp
Modified: 2019-03-06 08:58 UTC (History)
1 user (show)

See Also:


Attachments
backport for 4.8.next (7.80 KB, patch)
2019-02-27 18:13 UTC, David Disseldorp
gd: review+
Details
cherry-pick for 4.9.next (7.59 KB, patch)
2019-02-27 18:13 UTC, David Disseldorp
gd: review+
Details
cherry-pick for 4.10.next (7.59 KB, patch)
2019-02-27 18:14 UTC, David Disseldorp
gd: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Disseldorp 2019-02-26 14:45:32 UTC
I stumbled across another local FS call in vfs_ceph:

1025 static int strict_allocate_ftruncate(struct vfs_handle_struct *handle, files_struct *fsp, off_t len)
1026 {
...
1048         /* Shrink - just ftruncate. */
1049         if (pst->st_ex_size > len)
1050                 return ftruncate(fsp->fh->fd, len);

This is in the disabled-by-default "strict allocate = yes" vfs_ceph ftruncate code path, so is unlikely to be tripped, but still needs to be fixed.

Alongside this fix, it should also be possible to rip out the unnecessary ceph_ftruncate() and ceph_fallocate() fallback logic.
Comment 1 David Disseldorp 2019-02-26 17:59:30 UTC
In testing a fix for this I've found that vfs_ceph is also missing an .fallocate_fn hook, which sees it also fallback to local FS I/O (vfs_default) for SMB_VFS_FALLOCATE(), which also happens to be called by strict_allocate_ftruncate().
I'll add an extra fix to address this for this ticket.
Comment 2 David Disseldorp 2019-02-27 18:13:26 UTC
Created attachment 14874 [details]
backport for 4.8.next
Comment 3 David Disseldorp 2019-02-27 18:13:52 UTC
Created attachment 14875 [details]
cherry-pick for 4.9.next
Comment 4 David Disseldorp 2019-02-27 18:14:21 UTC
Created attachment 14876 [details]
cherry-pick for 4.10.next
Comment 5 David Disseldorp 2019-03-01 13:37:29 UTC
hi Günther, did you get a chance to look at the backports?
Comment 6 Guenther Deschner 2019-03-01 13:42:55 UTC
Comment on attachment 14876 [details]
cherry-pick for 4.10.next

LGTM
Comment 7 Guenther Deschner 2019-03-01 13:43:38 UTC
Comment on attachment 14875 [details]
cherry-pick for 4.9.next

LGTM
Comment 8 Guenther Deschner 2019-03-01 13:44:14 UTC
Comment on attachment 14874 [details]
backport for 4.8.next

LGTM
Comment 9 Guenther Deschner 2019-03-01 13:44:35 UTC
Karolin, please add to 4.8, 4.9 and 4.10. Thanks!
Comment 10 Karolin Seeger 2019-03-04 10:38:42 UTC
(In reply to Guenther Deschner from comment #9)
Pushed to autobuild-v4-{10,9,8}-test
Comment 11 Karolin Seeger 2019-03-06 08:58:31 UTC
(In reply to Karolin Seeger from comment #10)
Pushed to all branches.
Closing out bug report.

Thanks!