xfs: remove unnecessary shutdown check from xfs_iflush()
authorBrian Foster <bfoster@redhat.com>
Wed, 6 May 2020 20:25:20 +0000 (13:25 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 7 May 2020 15:27:46 +0000 (08:27 -0700)
The shutdown check in xfs_iflush() duplicates checks down in the
buffer code. If the fs is shut down, xfs_trans_read_buf_map() always
returns an error and falls into the same error path. Remove the
unnecessary check along with the warning in xfs_imap_to_bp()
that generates excessive noise in the log if the fs is shut down.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/xfs_inode.c

index 39c5a6e24915ccc0ba875b595ef679c2c086c290..b102e611bf540ae31078fa108372416a7524ddd5 100644 (file)
@@ -172,12 +172,7 @@ xfs_imap_to_bp(
                                   (int)imap->im_len, buf_flags, &bp,
                                   &xfs_inode_buf_ops);
        if (error) {
-               if (error == -EAGAIN) {
-                       ASSERT(buf_flags & XBF_TRYLOCK);
-                       return error;
-               }
-               xfs_warn(mp, "%s: xfs_trans_read_buf() returned error %d.",
-                       __func__, error);
+               ASSERT(error != -EAGAIN || (buf_flags & XBF_TRYLOCK));
                return error;
        }
 
index 788a68ef8d104a3f7d3acc1946c9e0d5aa10ed71..d1f7da2fc2eca4c1b0894718ab05ffa080ad3d1e 100644 (file)
@@ -3657,19 +3657,6 @@ xfs_iflush(
                return 0;
        }
 
-       /*
-        * This may have been unpinned because the filesystem is shutting
-        * down forcibly. If that's the case we must not write this inode
-        * to disk, because the log record didn't make it to disk.
-        *
-        * We also have to remove the log item from the AIL in this case,
-        * as we wait for an empty AIL as part of the unmount process.
-        */
-       if (XFS_FORCED_SHUTDOWN(mp)) {
-               error = -EIO;
-               goto abort;
-       }
-
        /*
         * Get the buffer containing the on-disk inode. We are doing a try-lock
         * operation here, so we may get an EAGAIN error. In that case, return