UTSL!
Apparently, on the first mount of a fs, the atime flag will be set
properly in vfsmnt->mnt_flags and sb->s_flags. If you *remount* a fs (in
my case, from ro to rw at boot time), then the noatime gets set in ONLY
vfsmnt->mnt_flags, and not sb->s_flags. When you do a 'mount' again, you
will see that the noatime flag is set in mnt_flags, but the
DO_UPDATE_ATIME() macro checks the sb->s_flags (thus, the atimes are still
being set).
When do_remount_sb is called, it will not keep the flags that were sent to
it by mount. If you change the noexec, or nodev, or similar options, they
also won't take effect.
Here's my patch to keep the flags that were sent by mount. Please review
this, since this is my first kernel patch (I'm so proud! :-). Actually,
the patch to fs/super.c fixes this. The patch to mm/filemap.c I took from
the 2.0.x ext2_no_atime.diff. I supposed it should be there also.
Please note, 2.0.29 also needs this patch for fs/super.c.
diff -u -r linux/fs/super.c linux.orig/fs/super.c
--- linux/fs/super.c Sun Feb 23 13:55:04 1997
+++ linux.orig/fs/super.c Sun Feb 23 13:35:36 1997
@@ -760,6 +760,7 @@
if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY))
if (!fs_may_remount_ro(sb->s_dev))
return -EBUSY;
+ sb->s_flags = (flags & ~MS_RDONLY) | (sb->s_flags & MS_RDONLY);
if (sb->s_op && sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data);
if (retval)
diff -u -r linux/mm/filemap.c linux.orig/mm/filemap.c
--- linux/mm/filemap.c Sun Feb 23 13:55:15 1997
+++ linux.orig/mm/filemap.c Sun Feb 23 13:46:19 1997
@@ -753,7 +753,7 @@
filp->f_reada = 1;
if (page_cache)
free_page(page_cache);
- if (!IS_RDONLY(inode)) {
+ if (DO_UPDATE_ATIME(inode)) {
inode->i_atime = CURRENT_TIME;
inode->i_dirt = 1;
}
@@ -1188,7 +1188,7 @@
return -EACCES;
if (!inode->i_op || !inode->i_op->readpage)
return -ENOEXEC;
- if (!IS_RDONLY(inode)) {
+ if (DO_UPDATE_ATIME(inode)) {
inode->i_atime = CURRENT_TIME;
inode->i_dirt = 1;
}