Skip to contentSkip to conversation

tmpfs readdir does not update dir access time

DISCUSSION Mark Borgerding 2 participants 2 messages Jan 11, 2004 – Jan 12, 2004 VFS

lore
Share & tools
lore
#0 lore raw

I just submitted a bug and proposed a patch to fs/libfs.c (function == dcache_readdir ).
http://bugme.osdl.org/show_bug.cgi?id=1837

I wanted to say something on the fs-devel list to find out if any filesystems depend on dcache_readdir NOT updating the access time ( calling update_atime ) during a readdir. This seems like its broken to me. But I'm just a caveman who fell through some ice and was later thawed by your scientists -- your world frightens and confuses me.

The danger is that this patch could break a fs that relies on the existing (wrong?) behavior provided by dcache_readdir ( a.k.a simple_dir_operations->readdir ), which never updates the atime of a dir inode.

Note that this change will not affect inodes for which IS_NOATIME or IS_NODIRATIME is true. Those will get ignored by the function update_atime. e.g If the fs was mounted 'noatime', or the S_NOATIME bit is set in i_flags.

I did a quick check in the 2.6.1 kernel tree to see what may be using the dcache_readdir. Here's a list of possible candidiates:

$> find ./ -type f -name '*.c' |xargs grep -n -e simple_fill_super -e simple_dir_operations -e dcache_readdir

./net/sunrpc/rpc_pipe.c:422: inode->i_fop = &simple_dir_operations;
./drivers/isdn/capi/capifs.c:131: inode->i_fop = &simple_dir_operations;
./drivers/usb/core/inode.c:174: inode->i_fop = &simple_dir_operations;
./drivers/usb/gadget/inode.c:1800: 0, &simple_dir_operations,
./drivers/oprofile/oprofilefs.c:266: inode->i_fop = &simple_dir_operations;
./drivers/oprofile/oprofilefs.c:286: root_inode->i_fop = &simple_dir_operations;
./arch/ia64/sn/io/hwgfs/ramfs.c:82: inode->i_fop = &simple_dir_operations;
./fs/nfsd/nfsctl.c:414: return simple_fill_super(sb, 0x6e667364, nfsd_files);
./fs/sysfs/dir.c:16: inode->i_fop = &simple_dir_operations;
./fs/sysfs/mount.c:39: inode->i_fop = &simple_dir_operations;
./fs/autofs4/root.c:34: .readdir = dcache_readdir,
./fs/autofs4/inode.c:314: inode->i_fop = &simple_dir_operations;
./fs/autofs/inode.c:212: inode->i_fop = &simple_dir_operations;
./fs/devpts/inode.c:96: inode->i_fop = &simple_dir_operations;
./fs/hugetlbfs/inode.c:396: inode->i_fop = &simple_dir_operations;
./fs/ramfs/inode.c:74: inode->i_fop = &simple_dir_operations;
./fs/binfmt_misc.c:617: int err = simple_fill_super(sb, 0x42494e4d, bm_files);
./security/selinux/selinuxfs.c:615: return simple_fill_super(sb, SELINUX_MAGIC, selinux_files);

(I've omitted the hits from fs/fslib.c & mm/shmem.c since that was the intended effect. )

Regards,
Mark Borgerding

#1 lore raw
Quoted 5 lines · Mark Borgerding

./drivers/usb/core/inode.c:174: inode->i_fop = &simple_dir_operations;
./drivers/usb/gadget/inode.c:1800: 0, &simple_dir_operations,

./fs/sysfs/dir.c:16: inode->i_fop = &simple_dir_operations;
./fs/sysfs/mount.c:39: inode->i_fop = &simple_dir_operations;

It's ok for these three filesystems.

thanks,

greg k-h