Commit 2bc55652 authored by Alexander Block's avatar Alexander Block Committed by Chris Mason

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: default avatarAlexander Block <ablock84@googlemail.com>
parent 063849ea
...@@ -4518,6 +4518,11 @@ int btrfs_dirty_inode(struct inode *inode) ...@@ -4518,6 +4518,11 @@ int btrfs_dirty_inode(struct inode *inode)
static int btrfs_update_time(struct inode *inode, struct timespec *now, static int btrfs_update_time(struct inode *inode, struct timespec *now,
int flags) int flags)
{ {
struct btrfs_root *root = BTRFS_I(inode)->root;
if (btrfs_root_readonly(root))
return -EROFS;
if (flags & S_VERSION) if (flags & S_VERSION)
inode_inc_iversion(inode); inode_inc_iversion(inode);
if (flags & S_CTIME) if (flags & S_CTIME)
......
...@@ -1551,6 +1551,8 @@ void touch_atime(struct path *path) ...@@ -1551,6 +1551,8 @@ void touch_atime(struct path *path)
* Btrfs), but since we touch atime while walking down the path we * Btrfs), but since we touch atime while walking down the path we
* really don't care if we failed to update the atime of the file, * really don't care if we failed to update the atime of the file,
* so just ignore the return value. * so just ignore the return value.
* We may also fail on filesystems that have the ability to make parts
* of the fs read only, e.g. subvolumes in Btrfs.
*/ */
update_time(inode, &now, S_ATIME); update_time(inode, &now, S_ATIME);
mnt_drop_write(mnt); mnt_drop_write(mnt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment