Skip to content

Commit c741d79

Browse files
Christoph HellwigChandan Babu R
authored andcommitted
xfs: skip all of xfs_file_release when shut down
There is no point in trying to free post-EOF blocks when the file system is shutdown, as it will just error out ASAP. Instead return instantly when xfs_file_release is called on a shut down file system. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent 98e44e2 commit c741d79

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/xfs/xfs_file.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,8 +1187,11 @@ xfs_file_release(
11871187
struct xfs_inode *ip = XFS_I(inode);
11881188
struct xfs_mount *mp = ip->i_mount;
11891189

1190-
/* If this is a read-only mount, don't generate I/O */
1191-
if (xfs_is_readonly(mp))
1190+
/*
1191+
* If this is a read-only mount or the file system has been shut down,
1192+
* don't generate I/O.
1193+
*/
1194+
if (xfs_is_readonly(mp) || xfs_is_shutdown(mp))
11921195
return 0;
11931196

11941197
/*
@@ -1200,8 +1203,7 @@ xfs_file_release(
12001203
* is significantly reducing the time window where we'd otherwise be
12011204
* exposed to that problem.
12021205
*/
1203-
if (!xfs_is_shutdown(mp) &&
1204-
xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED)) {
1206+
if (xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED)) {
12051207
xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE);
12061208
if (ip->i_delayed_blks > 0)
12071209
filemap_flush(inode->i_mapping);

0 commit comments

Comments
 (0)