summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2011-02-22 14:47:10 +0000
committeralc <alc@FreeBSD.org>2011-02-22 14:47:10 +0000
commitf5f2bab6006ec37740acc54d20ac00b7b0e35c96 (patch)
tree6798ca0ec38438d9ec7b6bcb0dfe8efbdba2a7a3 /sys/fs/tmpfs
parent1465b80841493b0f463d4fa47545ec6e39514bd0 (diff)
downloadFreeBSD-src-f5f2bab6006ec37740acc54d20ac00b7b0e35c96.zip
FreeBSD-src-f5f2bab6006ec37740acc54d20ac00b7b0e35c96.tar.gz
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
Diffstat (limited to 'sys/fs/tmpfs')
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index 3f180ba..0568e93 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -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:
OpenPOWER on IntegriCloud