Message ID | 20190515145639.5206-1-ddiss@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ceph: fix "ceph.dir.rctime" vxattr value | expand |
On Wed, 15 May 2019, David Disseldorp wrote: > The vxattr value incorrectly places a "09" prefix to the nanoseconds > field, instead of providing it as a zero-pad width specifier after '%'. > > Link: https://tracker.ceph.com/issues/39943 > Fixes: 3489b42a72a4 ("ceph: fix three bugs, two in ceph_vxattrcb_file_layout()") > Signed-off-by: David Disseldorp <ddiss@suse.de> > --- > > @Yan, Zheng: given that the padding has been broken for so long, another > option might be to drop the "09" completely and keep it > variable width. Since the old value was just wrong, I'd just make it correct here and not worry about compatibility with a something that wasn't valid anyway. sage > fs/ceph/xattr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c > index 0cc42c8879e9..aeb8550fb863 100644 > --- a/fs/ceph/xattr.c > +++ b/fs/ceph/xattr.c > @@ -224,7 +224,7 @@ static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val, > static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, > size_t size) > { > - return snprintf(val, size, "%lld.09%ld", ci->i_rctime.tv_sec, > + return snprintf(val, size, "%lld.%09ld", ci->i_rctime.tv_sec, > ci->i_rctime.tv_nsec); > } > > -- > 2.16.4 > > >
On Wed, May 15, 2019 at 5:47 PM Sage Weil <sage@newdream.net> wrote: > > On Wed, 15 May 2019, David Disseldorp wrote: > > The vxattr value incorrectly places a "09" prefix to the nanoseconds > > field, instead of providing it as a zero-pad width specifier after '%'. > > > > Link: https://tracker.ceph.com/issues/39943 > > Fixes: 3489b42a72a4 ("ceph: fix three bugs, two in ceph_vxattrcb_file_layout()") > > Signed-off-by: David Disseldorp <ddiss@suse.de> > > --- > > > > @Yan, Zheng: given that the padding has been broken for so long, another > > option might be to drop the "09" completely and keep it > > variable width. > > Since the old value was just wrong, I'd just make it correct here and not > worry about compatibility with a something that wasn't valid anyway. (Chiming in because I can't parse whether you want David to keep "09" or drop it...) FWIW it's zero-padded in ceph_read_dir(): "rctime: %10lld.%09ld\n" Not sure if anyone actually mounts with -o dirstat and does reads on directories, but I'd keep "09" for consistency. Thanks, Ilya
On Wed, May 15, 2019 at 10:56 PM David Disseldorp <ddiss@suse.de> wrote: > > The vxattr value incorrectly places a "09" prefix to the nanoseconds > field, instead of providing it as a zero-pad width specifier after '%'. > > Link: https://tracker.ceph.com/issues/39943 > Fixes: 3489b42a72a4 ("ceph: fix three bugs, two in ceph_vxattrcb_file_layout()") > Signed-off-by: David Disseldorp <ddiss@suse.de> > --- > > @Yan, Zheng: given that the padding has been broken for so long, another > option might be to drop the "09" completely and keep it > variable width. > > fs/ceph/xattr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c > index 0cc42c8879e9..aeb8550fb863 100644 > --- a/fs/ceph/xattr.c > +++ b/fs/ceph/xattr.c > @@ -224,7 +224,7 @@ static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val, > static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, > size_t size) > { > - return snprintf(val, size, "%lld.09%ld", ci->i_rctime.tv_sec, > + return snprintf(val, size, "%lld.%09ld", ci->i_rctime.tv_sec, > ci->i_rctime.tv_nsec); > } > > -- > 2.16.4 > Both patches applied. Thanks Yan, Zheng
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 0cc42c8879e9..aeb8550fb863 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -224,7 +224,7 @@ static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val, static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, size_t size) { - return snprintf(val, size, "%lld.09%ld", ci->i_rctime.tv_sec, + return snprintf(val, size, "%lld.%09ld", ci->i_rctime.tv_sec, ci->i_rctime.tv_nsec); }
The vxattr value incorrectly places a "09" prefix to the nanoseconds field, instead of providing it as a zero-pad width specifier after '%'. Link: https://tracker.ceph.com/issues/39943 Fixes: 3489b42a72a4 ("ceph: fix three bugs, two in ceph_vxattrcb_file_layout()") Signed-off-by: David Disseldorp <ddiss@suse.de> --- @Yan, Zheng: given that the padding has been broken for so long, another option might be to drop the "09" completely and keep it variable width. fs/ceph/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)