Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/lib/libperfuse Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/e7e33a6735cf
branches: netbsd-6
changeset: 776875:e7e33a6735cf
user: martin <martin%NetBSD.org@localhost>
date: Fri Jan 16 19:42:54 2015 +0000
description:
Pull up following revision(s) (requested by manu in ticket #1235):
lib/libperfuse/ops.c: revision 1.82
Fix atime update
FUSE filesystems assume that SETATTR with atime is the result of utiimes()
being called. As a result, atime and mtime will be updated. This happens
with MooseFS and glusterFS. atime is supposed to be updated by the
filesystem itself when it gets read operations.
We fix the problem in SETATTR operations by
1) do not create a mtime update when we have an atime update (and vice
versa), just fill the fields to avoid the filesystem restting the
missing field to Epoch, but do not pretend we want to update it.
2) If the change is limited to atime, iscard it, as updates should be
done by READ operations
3) Kernel part of PUFFS has been fixed to make sure reads on empty file
are sent to the filesystem:
http://mail-index.netbsd.org/source-changes/2015/01/13/msg062364.html
Thanks to Tom Ivar Helbekkmo for reporting this issue.
diffstat:
lib/libperfuse/ops.c | 53 ++++++++++++++++++++++++++++-----------------------
1 files changed, 29 insertions(+), 24 deletions(-)
diffs (75 lines):
diff -r c5444aedf44f -r e7e33a6735cf lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c Fri Jan 16 14:26:50 2015 +0000
+++ b/lib/libperfuse/ops.c Fri Jan 16 19:42:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ops.c,v 1.50.2.19 2014/12/02 22:01:37 snj Exp $ */
+/* $NetBSD: ops.c,v 1.50.2.20 2015/01/16 19:42:54 martin Exp $ */
/*-
* Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -1775,30 +1775,27 @@
}
/*
- * Setting mtime without atime or vice versa leads to
- * dates being reset to Epoch on glusterfs. If one
- * is missing, use the old value.
+ * When not sending a time field, still fill with
+ * current value, as the filesystem may just reset
+ * the field to Epoch even if fsi->valid bit is
+ * not set (GlusterFS does that).
*/
- if ((vap->va_mtime.tv_sec != (time_t)PUFFS_VNOVAL) ||
- (vap->va_atime.tv_sec != (time_t)PUFFS_VNOVAL)) {
-
- if (vap->va_atime.tv_sec != (time_t)PUFFS_VNOVAL) {
- fsi->atime = vap->va_atime.tv_sec;
- fsi->atimensec = (uint32_t)vap->va_atime.tv_nsec;
- } else {
- fsi->atime = old_va->va_atime.tv_sec;
- fsi->atimensec = (uint32_t)old_va->va_atime.tv_nsec;
- }
-
- if (vap->va_mtime.tv_sec != (time_t)PUFFS_VNOVAL) {
- fsi->mtime = vap->va_mtime.tv_sec;
- fsi->mtimensec = (uint32_t)vap->va_mtime.tv_nsec;
- } else {
- fsi->mtime = old_va->va_mtime.tv_sec;
- fsi->mtimensec = (uint32_t)old_va->va_mtime.tv_nsec;
- }
-
- fsi->valid |= (FUSE_FATTR_MTIME|FUSE_FATTR_ATIME);
+ if (vap->va_atime.tv_sec != (time_t)PUFFS_VNOVAL) {
+ fsi->atime = vap->va_atime.tv_sec;
+ fsi->atimensec = (uint32_t)vap->va_atime.tv_nsec;
+ fsi->valid |= FUSE_FATTR_ATIME;
+ } else {
+ fsi->atime = old_va->va_atime.tv_sec;
+ fsi->atimensec = (uint32_t)old_va->va_atime.tv_nsec;
+ }
+
+ if (vap->va_mtime.tv_sec != (time_t)PUFFS_VNOVAL) {
+ fsi->mtime = vap->va_mtime.tv_sec;
+ fsi->mtimensec = (uint32_t)vap->va_mtime.tv_nsec;
+ fsi->valid |= FUSE_FATTR_MTIME;
+ } else {
+ fsi->mtime = old_va->va_mtime.tv_sec;
+ fsi->mtimensec = (uint32_t)old_va->va_mtime.tv_nsec;
}
if (vap->va_mode != (mode_t)PUFFS_VNOVAL) {
@@ -1841,6 +1838,14 @@
fsi->mtimensec = 0;
fsi->valid &= ~(FUSE_FATTR_ATIME|FUSE_FATTR_MTIME);
}
+
+ /*
+ * If only atime is changed, discard the operation: it
+ * happens after read, and in that case the filesystem
+ * already updaed atime. NB: utimes() also change mtime.
+ */
+ if (fsi->valid == FUSE_FATTR_ATIME)
+ fsi->valid &= ~FUSE_FATTR_ATIME;
/*
* If nothing remain, discard the operation.
Home |
Main Index |
Thread Index |
Old Index