Date: Wed, 26 Jun 2019 00:03:37 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r349397 - in projects/fuse2: sys/fs/fuse tests/sys/fs/fusefs Message-ID: <201906260003.x5Q03bHh032788@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Wed Jun 26 00:03:37 2019 New Revision: 349397 URL: https://svnweb.freebsd.org/changeset/base/349397 Log: fusefs: set ctime during FUSE_SETATTR following a write As of r349396 the kernel will internally update the mtime and ctime of files on write. It will also flush the mtime should a SETATTR happen before the data cache gets flushed. Now it will flush the ctime too, if the server is using protocol 7.23 or higher. This is the only case in which the kernel will explicitly set a file's ctime, since neither utimensat(2) nor any other user interfaces allow it. Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/sys/fs/fuse/fuse_internal.c projects/fuse2/tests/sys/fs/fusefs/write.cc Modified: projects/fuse2/sys/fs/fuse/fuse_internal.c ============================================================================== --- projects/fuse2/sys/fs/fuse/fuse_internal.c Tue Jun 25 23:40:18 2019 (r349396) +++ projects/fuse2/sys/fs/fuse/fuse_internal.c Wed Jun 26 00:03:37 2019 (r349397) @@ -1074,6 +1074,11 @@ int fuse_internal_setattr(struct vnode *vp, struct vat fsai->mtimensec = fvdat->cached_attrs.va_mtime.tv_nsec; fsai->valid |= FATTR_MTIME; } + if (fuse_libabi_geq(data, 7, 23) && fvdat->flag & FN_CTIMECHANGE) { + fsai->ctime = fvdat->cached_attrs.va_ctime.tv_sec; + fsai->ctimensec = fvdat->cached_attrs.va_ctime.tv_nsec; + fsai->valid |= FATTR_CTIME; + } if (vap->va_mode != (mode_t)VNOVAL) { fsai->mode = vap->va_mode & ALLPERMS; fsai->valid |= FATTR_MODE; Modified: projects/fuse2/tests/sys/fs/fusefs/write.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/write.cc Tue Jun 25 23:40:18 2019 (r349396) +++ projects/fuse2/tests/sys/fs/fusefs/write.cc Wed Jun 26 00:03:37 2019 (r349397) @@ -1117,8 +1117,7 @@ TEST_F(WriteBackAsync, timestamps_during_setattr) expect_open(ino, 0, 1); EXPECT_CALL(*m_mock, process( ResultOf([=](auto in) { - /* In protocol 7.23, ctime will be changed too */ - uint32_t valid = FATTR_MODE | FATTR_MTIME; + uint32_t valid = FATTR_MODE | FATTR_MTIME | FATTR_CTIME; return (in.header.opcode == FUSE_SETATTR && in.header.nodeid == ino && in.body.setattr.valid == valid);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906260003.x5Q03bHh032788>