From owner-svn-src-head@FreeBSD.ORG Tue Feb 22 14:47:11 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 503001065674; Tue, 22 Feb 2011 14:47:11 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 247FA8FC24; Tue, 22 Feb 2011 14:47:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1MElB6V012018; Tue, 22 Feb 2011 14:47:11 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1MElBKa012016; Tue, 22 Feb 2011 14:47:11 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201102221447.p1MElBKa012016@svn.freebsd.org> From: Alan Cox Date: Tue, 22 Feb 2011 14:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218949 - head/sys/fs/tmpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Feb 2011 14:47:11 -0000 Author: alc Date: Tue Feb 22 14:47:10 2011 New Revision: 218949 URL: http://svn.freebsd.org/changeset/base/218949 Log: Eliminate two dubious attempts at optimizing the implementation of a file's last accessed, modified, and changed times: TMPFS_NODE_ACCESSED and TMPFS_NODE_CHANGED should be set unconditionally in tmpfs_remove() without regard to the number of hard links to the file. Otherwise, after the last directory entry for a file has been removed, a process that still has the file open could read stale values for the last accessed and changed times with fstat(2). Similarly, tmpfs_close() should update the time-related fields even if all directory entries for a file have been removed. In this case, the effect is that the time-related fields will have values that are later than expected. They will correspond to the time at which fstat(2) is called. In collaboration with: kib MFC after: 1 week Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Feb 22 14:02:00 2011 (r218948) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Feb 22 14:47:10 2011 (r218949) @@ -270,19 +270,12 @@ tmpfs_close(struct vop_close_args *v) { struct vnode *vp = v->a_vp; - struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(vp)); - node = VP_TO_TMPFS_NODE(vp); - - if (node->tn_links > 0) { - /* Update node times. No need to do it if the node has - * been deleted, because it will vanish after we return. */ - tmpfs_update(vp); - } + /* Update node times. */ + tmpfs_update(vp); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -852,8 +845,7 @@ tmpfs_remove(struct vop_remove_args *v) * reclaimed. */ tmpfs_free_dirent(tmp, de, TRUE); - if (node->tn_links > 0) - node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED; + node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED; error = 0; out: