summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_file.c
diff options
context:
space:
mode:
authorDarrick J. Wong2017-02-03 00:13:58 +0100
committerDarrick J. Wong2017-02-03 00:13:58 +0100
commit7a652bbe366464267190c2792a32ce4fff5595ef (patch)
treeebc1b32e1a8479588e9516769ca4029a88558fbf /fs/xfs/xfs_file.c
parentxfs: fix toctou race when locking an inode to access the data map (diff)
downloadkernel-qcow2-linux-7a652bbe366464267190c2792a32ce4fff5595ef.tar.gz
kernel-qcow2-linux-7a652bbe366464267190c2792a32ce4fff5595ef.tar.xz
kernel-qcow2-linux-7a652bbe366464267190c2792a32ce4fff5595ef.zip
xfs: fail _dir_open when readahead fails
When we open a directory, we try to readahead block 0 of the directory on the assumption that we're going to need it soon. If the bmbt is corrupt, the directory will never be usable and the readahead fails immediately, so we might as well prevent the directory from being opened at all. This prevents a subsequent read or modify operation from hitting it and taking the fs offline. NOTE: We're only checking for early failures in the block mapping, not the readahead directory block itself. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_file.c')
-rw-r--r--fs/xfs/xfs_file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 0a29739f785e..032c8a74824a 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -913,9 +913,9 @@ xfs_dir_open(
*/
mode = xfs_ilock_data_map_shared(ip);
if (ip->i_d.di_nextents > 0)
- xfs_dir3_data_readahead(ip, 0, -1);
+ error = xfs_dir3_data_readahead(ip, 0, -1);
xfs_iunlock(ip, mode);
- return 0;
+ return error;
}
STATIC int