From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 14 11:20:02 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20CA310656A4 for ; Wed, 14 Oct 2009 11:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DE93C8FC16 for ; Wed, 14 Oct 2009 11:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n9EBK1Kv011490 for ; Wed, 14 Oct 2009 11:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n9EBK1Qn011489; Wed, 14 Oct 2009 11:20:01 GMT (envelope-from gnats) Resent-Date: Wed, 14 Oct 2009 11:20:01 GMT Resent-Message-Id: <200910141120.n9EBK1Qn011489@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Gleb Kurtsou Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71BD4106566B for ; Wed, 14 Oct 2009 11:12:00 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id F21C58FC17 for ; Wed, 14 Oct 2009 11:11:59 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n9EBBx4L045696 for ; Wed, 14 Oct 2009 11:11:59 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n9EBBxAH045695; Wed, 14 Oct 2009 11:11:59 GMT (envelope-from nobody) Message-Id: <200910141111.n9EBBxAH045695@www.freebsd.org> Date: Wed, 14 Oct 2009 11:11:59 GMT From: Gleb Kurtsou To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/139597: [patch] [tmpfs] tmpfs initializes va_gen but doesn't update it on vnode change X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2009 11:20:02 -0000 >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@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: