[Bug 1837] New: tmpfs readdir does not update dir access time

From: Martin J. Bligh
Date: Sun Jan 11 2004 - 15:22:32 EST


http://bugme.osdl.org/show_bug.cgi?id=1837

Summary: tmpfs readdir does not update dir access time
Kernel Version: 2.6.0
Status: NEW
Severity: normal
Owner: fs_other@xxxxxxxxxxxxxxxxxxxx
Submitter: mark@xxxxxxxxxxxxxx


Distribution: various
Hardware Environment: i386 (Athlons & various intel 32bit)
Software Environment: kernel 2.4.18 to 2.6.0 (at least)
Problem Description: access times of tmpfs dirs do not get updated on readdir
Impact: This can cause empty dirs to get tmpwatch'd too early, b/c atime never
changes even though the dir is in use.
Steps to reproduce:
cd /dev/shm
mkdir mydir
ls -u --full-time mydir
ls mydir; sleep 1
ls -u --full-time mydir
Access time should be changed by 2nd ls.


FIX: add update_atime call to dcache_readdir function in fs/libfs.c

--- fs/libfs.c.orig Wed Dec 17 21:58:04 2003
+++ fs/libfs.c Sun Jan 11 13:22:37 2004
@@ -155,6 +155,7 @@
}
spin_unlock(&dcache_lock);
}
+ update_atime(dentry->d_inode);
return 0;
}


Note that other fs use dcache_readdir as well. Hopefully none rely on this
(broken?) behavior. I found direct or indirect use of dcache_readdir ,
simple_dir_operations, or simple_fill_super in various places. I was not
familiar enough with most fs to evaluate the impact.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/