Skip to content

Commit 5d37e9e

Browse files
jankaraAl Viro
authored andcommitted
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/897421 Tested-by: Kamal Mostafa <kamal@canonical.com> Tested-by: Peter M. Petrakis <peter.petrakis@canonical.com> Tested-by: Dann Frazier <dann.frazier@canonical.com> Tested-by: Massimo Morana <massimo.morana@canonical.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent eb04c28 commit 5d37e9e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎fs/inode.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,9 +1542,11 @@ void touch_atime(struct path *path)
15421542
if (timespec_equal(&inode->i_atime, &now))
15431543
return;
15441544

1545-
if (mnt_want_write(mnt))
1545+
if (!sb_start_write_trylock(inode->i_sb))
15461546
return;
15471547

1548+
if (__mnt_want_write(mnt))
1549+
goto skip_update;
15481550
/*
15491551
* File systems can error out when updating inodes if they need to
15501552
* allocate new space to modify an inode (such is the case for
@@ -1553,7 +1555,9 @@ void touch_atime(struct path *path)
15531555
* so just ignore the return value.
15541556
*/
15551557
update_time(inode, &now, S_ATIME);
1556-
mnt_drop_write(mnt);
1558+
__mnt_drop_write(mnt);
1559+
skip_update:
1560+
sb_end_write(inode->i_sb);
15571561
}
15581562
EXPORT_SYMBOL(touch_atime);
15591563

0 commit comments

Comments
 (0)