Skip to content

Commit

Permalink
fs: Skip atime update on frozen filesystem
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Peter M. Petrakis <[email protected]>
Tested-by: Dann Frazier <[email protected]>
Tested-by: Massimo Morana <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
jankara authored and Al Viro committed Jul 31, 2012
1 parent eb04c28 commit 5d37e9e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1542,9 +1542,11 @@ void touch_atime(struct path *path)
if (timespec_equal(&inode->i_atime, &now))
return;

if (mnt_want_write(mnt))
if (!sb_start_write_trylock(inode->i_sb))
return;

if (__mnt_want_write(mnt))
goto skip_update;
/*
* File systems can error out when updating inodes if they need to
* allocate new space to modify an inode (such is the case for
Expand All @@ -1553,7 +1555,9 @@ void touch_atime(struct path *path)
* so just ignore the return value.
*/
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);

Expand Down

0 comments on commit 5d37e9e

Please sign in to comment.