git: 1484574843a3 - main - Fix inode birthtime updating logic.
Fedor Uporov
fsu at FreeBSD.org
Fri May 7 07:09:47 UTC 2021
The branch main has been updated by fsu:
URL: https://cgit.FreeBSD.org/src/commit/?id=1484574843a3b49d5535ad1f7866295a0a5fb597
commit 1484574843a3b49d5535ad1f7866295a0a5fb597
Author: Fedor Uporov <fsu at FreeBSD.org>
AuthorDate: 2021-02-18 08:40:18 +0000
Commit: Fedor Uporov <fsu at FreeBSD.org>
CommitDate: 2021-05-07 07:08:20 +0000
Fix inode birthtime updating logic.
The birthtime field of struct vattr does not checked
for VNOVAL in case of ext2_setattr() and produce incorrect
inode birthtime values.
Found using pjdfstest:
pjdfstest/tests/utimensat/03.t
Reviewed by: pfg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29929
---
sys/fs/ext2fs/ext2_vnops.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c
index e00dbc3e0adc..1ab360a7ad87 100644
--- a/sys/fs/ext2fs/ext2_vnops.c
+++ b/sys/fs/ext2fs/ext2_vnops.c
@@ -377,7 +377,7 @@ ext2_getattr(struct vop_getattr_args *ap)
vap->va_mtime.tv_nsec = E2DI_HAS_XTIME(ip) ? ip->i_mtimensec : 0;
vap->va_ctime.tv_sec = ip->i_ctime;
vap->va_ctime.tv_nsec = E2DI_HAS_XTIME(ip) ? ip->i_ctimensec : 0;
- if E2DI_HAS_XTIME(ip) {
+ if (E2DI_HAS_XTIME(ip)) {
vap->va_birthtime.tv_sec = ip->i_birthtime;
vap->va_birthtime.tv_nsec = ip->i_birthnsec;
}
@@ -506,8 +506,10 @@ ext2_setattr(struct vop_setattr_args *ap)
ip->i_mtime = vap->va_mtime.tv_sec;
ip->i_mtimensec = vap->va_mtime.tv_nsec;
}
- ip->i_birthtime = vap->va_birthtime.tv_sec;
- ip->i_birthnsec = vap->va_birthtime.tv_nsec;
+ if (E2DI_HAS_XTIME(ip) && vap->va_birthtime.tv_sec != VNOVAL) {
+ ip->i_birthtime = vap->va_birthtime.tv_sec;
+ ip->i_birthnsec = vap->va_birthtime.tv_nsec;
+ }
error = ext2_update(vp, 0);
if (error)
return (error);
More information about the dev-commits-src-main
mailing list