New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cephfs: expose snapshot creation time as new ceph.snap.btime vxattr #27077
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation LGTM.
Reviewed-by: Greg Farnum gfarnum@redhat.com
The updated test compares the ceph.snap.btime between an older and newer snapshot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please make a tracker feature ticket and add the fixes line to your commits. Do you want this backported?
New version adds Fixes: https://tracker.ceph.com/issues/38838 tags and reworks the infomap.size() == 1 logic. |
LGTM |
Thanks for the feedback so far - the corresponding kernel changes were proposed (and subsequently acked) via https://www.spinics.net/lists/ceph-devel/msg44894.html . @batrick any further comment on the proposed $secs.$nsecs format? |
I've posted the Samba changes to https://lists.samba.org/archive/samba-technical/2019-March/133089.html - would be good to get final feedback on the time format soon if possible, as that appears to be the only thing holding up all three patch-sets. |
* refs/pull/27077/head: test: add libcephfs snap.btime xattr test client: add ceph.snap.btime vxattr mds: carry snapshot creation time with InodeStat Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Greg Farnum <gfarnum@redhat.com>
* refs/pull/27077/head: test: add libcephfs snap.btime xattr test client: add ceph.snap.btime vxattr mds: carry snapshot creation time with InodeStat Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Greg Farnum <gfarnum@redhat.com>
Investigating a possible QA failure caused by this PR: http://pulpito.ceph.com/pdonnell-2019-04-02_00:10:11-fs-master-distro-basic-smithi/ |
I think I've finally worked out what's going on here: Client::_listxattr() returns a length based on the static _vxattrs_name_size() value. Client::_vxattrs_calcu_name_size() only takes into account whether the vxattr is hidden, not whether the vxattr.exists_cb() returns true/false. |
It seems that "ceph.snap.btime" is the only vxattr to set hidden=false and fill the exists_cb(), so I don't think this client bug affects existing releases.
I'll proceed with option (1), but any other feedback would still be appreciated. |
Changes since previous version:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM
This allows for a future vxattr exposing the snapshot creation time to users. The InodeStat encoding version is bumped to account for the new snap_btime member. Fixes: https://tracker.ceph.com/issues/38838 Signed-off-by: David Disseldorp <ddiss@suse.de>
The ceph.snap.btime vxattr carries the snapshot creation time for files and directories residing within a snapshot. Fixes: https://tracker.ceph.com/issues/38838 Signed-off-by: David Disseldorp <ddiss@suse.de>
Test that the new "ceph.snap.btime" xattr is present following snapshot, and that the corresponding $secs.$nsecs value changes between old and new snapshots. Fixes: https://tracker.ceph.com/issues/38838 Signed-off-by: David Disseldorp <ddiss@suse.de>
Client::_listxattr() incorrectly returns a length based on the static _vxattrs_name_size() value. _vxattrs_calcu_name_size() only takes into account whether vxattrs are hidden, ignoring vxattr.exists_cb(). When filling the xattr buffer, Client::_listxattr() checks vxattr.hidden and vxattr.exists_cb(). When the latter returns false (as is the case for ceph.snap.btime on non-snapshots), we return a length which is larger than the amount that we wrote to the buffer. Fix this behaviour by always calculating the vxattrs length at runtime, taking both vxattr.hidden and vxattr.exists_cb() into account. Signed-off-by: David Disseldorp <ddiss@suse.de>
_listxattr() now calculates the length of vxattrs dynamically, so these helpers, which incorrectly ignore vxattr.exists_cb(), can be removed. Signed-off-by: David Disseldorp <ddiss@suse.de>
Additionally check that: - a zero buflen returns the needed length - a non-zero buflen less than needed fails - the list-length is non-zero following setxattr Signed-off-by: David Disseldorp <ddiss@suse.de>
Extend LibCephFS.SnapXattrs to also test ceph_listxattr() against snapshot and non-snapshot files. Signed-off-by: David Disseldorp <ddiss@suse.de>
Changes since previous version:
|
FWIW, it looks like the kernel ceph_listxattr() function has similar behaviour, so I'll respin my kernel patchset with a corresponding fix once this gets merged. |
* refs/pull/27077/head: test: check listattr for snapshot btime entry test: extend LibCephFS.Xattrs test client: remove unused vxattr length helpers client: fix _listxattr() vxattr buffer length calculation test: add libcephfs snap.btime xattr test client: add ceph.snap.btime vxattr mds: carry snapshot creation time with InodeStat Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Greg Farnum <gfarnum@redhat.com>
Samba requires the snapshot creation time for the purpose of tracking and identifying Previous Versions for files and directories.
Fixes: https://tracker.ceph.com/issues/38838