Alexander Block
2012-May-24 17:12 UTC
[BUG] atime on ro snapshots is updated when it should not
Hello, if a snapshot was created with -r and thus is read only, accessing files in it will update the atime. I would expect that atime is not updated on ro snapshots. I tried to find out where the ro check is missing. The problem seems to be that the vfs is only checking the mount, super block and i_flags. As it has no clue about subvolumes, it never checks them. My temporary solution for me to continue working is atm the patch at the end of this mail. Is anyone with more vfs experience able to fix this in a better way? Thanks, Alex. diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3524978..6f126e0 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -115,6 +115,10 @@ void btrfs_update_iflags(struct inode *inode) inode->i_flags |= S_NOATIME; if (ip->flags & BTRFS_INODE_DIRSYNC) inode->i_flags |= S_DIRSYNC; + + if (btrfs_root_readonly(ip->root)) { + inode->i_flags |= S_NOATIME; + } } -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Alexander Block
2012-May-25 11:31 UTC
Re: [BUG] atime on ro snapshots is updated when it should not
David just pointed me to the update_time patches from Josef. When these get into the kernel, the RO snapshot + atime problem could be easily fixed. Any idea when those get into the kernel? On Thu, May 24, 2012 at 7:12 PM, Alexander Block <ablock84@googlemail.com> wrote:> Hello, > > if a snapshot was created with -r and thus is read only, accessing > files in it will update the atime. I would expect that atime is not > updated on ro snapshots. > > I tried to find out where the ro check is missing. The problem seems > to be that the vfs is only checking the mount, super block and > i_flags. > As it has no clue about subvolumes, it never checks them. My temporary > solution for me to continue working is atm the patch at the end of > this mail. > Is anyone with more vfs experience able to fix this in a better way? > > Thanks, > Alex. > > diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c > index 3524978..6f126e0 100644 > --- a/fs/btrfs/ioctl.c > +++ b/fs/btrfs/ioctl.c > @@ -115,6 +115,10 @@ void btrfs_update_iflags(struct inode *inode) > inode->i_flags |= S_NOATIME; > if (ip->flags & BTRFS_INODE_DIRSYNC) > inode->i_flags |= S_DIRSYNC; > + > + if (btrfs_root_readonly(ip->root)) { > + inode->i_flags |= S_NOATIME; > + } > }-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html