kern/139597: [patch] [tmpfs] tmpfs initializes va_gen but doesn't
update it on vnode change
Gleb Kurtsou
gk at FreeBSD.org
Wed Oct 14 11:20:02 UTC 2009
>Number: 139597
>Category: kern
>Synopsis: [patch] [tmpfs] tmpfs initializes va_gen but doesn't update it on vnode change
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Oct 14 11:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator: Gleb Kurtsou
>Release:
>Organization:
>Environment:
FreeBSD tops 9.0-CURRENT FreeBSD 9.0-CURRENT #10 r198029+5e4f6c4: Tue Oct 13 20:24:19 EEST 2009 root at tops:/usr/obj/usr/freebsd-src/local/sys/TOPS amd64
>Description:
tmpfs initializes tn_gen (generation number) on node creation, but fails to update it on vnode change.
other filesystems set va_gen=0 or update it on changes (ufs, zfs)
>How-To-Repeat:
mount pefs or nfs (not tested) on top of tmpfs
>Fix:
Patch attached with submission follows:
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 8dc8338..3df61f8 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -1252,6 +1252,10 @@ tmpfs_itimes(struct vnode *vp, const struct timespec *acc,
if (node->tn_status & TMPFS_NODE_CHANGED) {
node->tn_ctime = now;
}
+ if (node->tn_status & (TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED)) {
+ if (++node->tn_gen == 0)
+ node->tn_gen = arc4random() / 2 + 1;
+ }
node->tn_status &=
~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list