Commit 5d37e9e6 authored by Jan Kara's avatar Jan Kara Committed by Al Viro

fs: Skip atime update on frozen filesystem

It is unexpected to block reading of frozen filesystem because of atime update.
Also handling blocking on frozen filesystem because of atime update would make
locking more complex than it already is. So just skip atime update when
filesystem is frozen like we skip it when filesystem is remounted read-only.

BugLink: https://bugs.launchpad.net/bugs/897421Tested-by: default avatarKamal Mostafa <kamal@canonical.com>
Tested-by: default avatarPeter M. Petrakis <peter.petrakis@canonical.com>
Tested-by: default avatarDann Frazier <dann.frazier@canonical.com>
Tested-by: default avatarMassimo Morana <massimo.morana@canonical.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent eb04c282
...@@ -1542,9 +1542,11 @@ void touch_atime(struct path *path) ...@@ -1542,9 +1542,11 @@ void touch_atime(struct path *path)
if (timespec_equal(&inode->i_atime, &now)) if (timespec_equal(&inode->i_atime, &now))
return; return;
if (mnt_want_write(mnt)) if (!sb_start_write_trylock(inode->i_sb))
return; return;
if (__mnt_want_write(mnt))
goto skip_update;
/* /*
* File systems can error out when updating inodes if they need to * File systems can error out when updating inodes if they need to
* allocate new space to modify an inode (such is the case for * allocate new space to modify an inode (such is the case for
...@@ -1553,7 +1555,9 @@ void touch_atime(struct path *path) ...@@ -1553,7 +1555,9 @@ void touch_atime(struct path *path)
* so just ignore the return value. * so just ignore the return value.
*/ */
update_time(inode, &now, S_ATIME); update_time(inode, &now, S_ATIME);
mnt_drop_write(mnt); __mnt_drop_write(mnt);
skip_update:
sb_end_write(inode->i_sb);
} }
EXPORT_SYMBOL(touch_atime); EXPORT_SYMBOL(touch_atime);
......
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