aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Block <ablock84@googlemail.com>2012-06-15 03:49:33 -0400
committerChris Mason <chris.mason@fusionio.com>2012-07-23 15:41:38 -0400
commit2bc5565286121d2a77ccd728eb3484dff2035b58 (patch)
treecb2ec5d12e7427a1cec9c41c7576118bb112b1dd
parent063849eafda03edf6872a3728b4a98dcc86290c7 (diff)
Btrfs: don't update atime on RO subvolumes
Before the update_time inode operation was indroduced, it was not possible to prevent updates of atime on RO subvolumes. VFS was only able to check for RO on the mount, but did not know anything about btrfs subvolumes. btrfs_update_time does now check if the root is RO and skip updating of times. Signed-off-by: Alexander Block <ablock84@googlemail.com>
-rw-r--r--fs/btrfs/inode.c5
-rw-r--r--fs/inode.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a7d1921ac76b..fcc65802f367 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4518,6 +4518,11 @@ int btrfs_dirty_inode(struct inode *inode)
4518static int btrfs_update_time(struct inode *inode, struct timespec *now, 4518static int btrfs_update_time(struct inode *inode, struct timespec *now,
4519 int flags) 4519 int flags)
4520{ 4520{
4521 struct btrfs_root *root = BTRFS_I(inode)->root;
4522
4523 if (btrfs_root_readonly(root))
4524 return -EROFS;
4525
4521 if (flags & S_VERSION) 4526 if (flags & S_VERSION)
4522 inode_inc_iversion(inode); 4527 inode_inc_iversion(inode);
4523 if (flags & S_CTIME) 4528 if (flags & S_CTIME)
diff --git a/fs/inode.c b/fs/inode.c
index c99163b1b310..033529ecd242 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1551,6 +1551,8 @@ void touch_atime(struct path *path)
1551 * Btrfs), but since we touch atime while walking down the path we 1551 * Btrfs), but since we touch atime while walking down the path we
1552 * really don't care if we failed to update the atime of the file, 1552 * really don't care if we failed to update the atime of the file,
1553 * so just ignore the return value. 1553 * so just ignore the return value.
1554 * We may also fail on filesystems that have the ability to make parts
1555 * of the fs read only, e.g. subvolumes in Btrfs.
1554 */ 1556 */
1555 update_time(inode, &now, S_ATIME); 1557 update_time(inode, &now, S_ATIME);
1556 mnt_drop_write(mnt); 1558 mnt_drop_write(mnt);