summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_file.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-08-13 09:39:37 +0200
committerChandan Babu R <chandanbabu@kernel.org>2024-09-03 06:37:38 +0200
commitc741d79c1a975cc3904ed8a491d6338ac852d43d (patch)
treeafa07609ce1186c846a0043dddfe7e521a9ebcb2 /fs/xfs/xfs_file.c
parentxfs: don't bother returning errors from xfs_file_release (diff)
downloadlinux-c741d79c1a975cc3904ed8a491d6338ac852d43d.tar.xz
linux-c741d79c1a975cc3904ed8a491d6338ac852d43d.zip
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 <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_file.c')
-rw-r--r--fs/xfs/xfs_file.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 17dfbaca1c58..dae8dd122355 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1187,8 +1187,11 @@ xfs_file_release(
struct xfs_inode *ip = XFS_I(inode);
struct xfs_mount *mp = ip->i_mount;
- /* If this is a read-only mount, don't generate I/O */
- if (xfs_is_readonly(mp))
+ /*
+ * If this is a read-only mount or the file system has been shut down,
+ * don't generate I/O.
+ */
+ if (xfs_is_readonly(mp) || xfs_is_shutdown(mp))
return 0;
/*
@@ -1200,8 +1203,7 @@ xfs_file_release(
* is significantly reducing the time window where we'd otherwise be
* exposed to that problem.
*/
- if (!xfs_is_shutdown(mp) &&
- xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED)) {
+ if (xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED)) {
xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE);
if (ip->i_delayed_blks > 0)
filemap_flush(inode->i_mapping);