All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "xfs: fail _dir_open when readahead fails" has been added to the 4.10-stable tree
@ 2017-04-01 17:32 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-04-01 17:32 UTC (permalink / raw)
  To: darrick.wong, gregkh, hch, sandeen; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    xfs: fail _dir_open when readahead fails

to the 4.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xfs-fail-_dir_open-when-readahead-fails.patch
and it can be found in the queue-4.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 7a652bbe366464267190c2792a32ce4fff5595ef Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 2 Feb 2017 15:13:58 -0800
Subject: xfs: fail _dir_open when readahead fails

From: Darrick J. Wong <darrick.wong@oracle.com>

commit 7a652bbe366464267190c2792a32ce4fff5595ef upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/libxfs/xfs_da_btree.c |    6 ++----
 fs/xfs/libxfs/xfs_da_btree.h |    2 +-
 fs/xfs/xfs_file.c            |    4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -2633,7 +2633,7 @@ out_free:
 /*
  * Readahead the dir/attr block.
  */
-xfs_daddr_t
+int
 xfs_da_reada_buf(
 	struct xfs_inode	*dp,
 	xfs_dablk_t		bno,
@@ -2664,7 +2664,5 @@ out_free:
 	if (mapp != &map)
 		kmem_free(mapp);
 
-	if (error)
-		return -1;
-	return mappedbno;
+	return error;
 }
--- a/fs/xfs/libxfs/xfs_da_btree.h
+++ b/fs/xfs/libxfs/xfs_da_btree.h
@@ -201,7 +201,7 @@ int	xfs_da_read_buf(struct xfs_trans *tr
 			       xfs_dablk_t bno, xfs_daddr_t mappedbno,
 			       struct xfs_buf **bpp, int whichfork,
 			       const struct xfs_buf_ops *ops);
-xfs_daddr_t	xfs_da_reada_buf(struct xfs_inode *dp, xfs_dablk_t bno,
+int	xfs_da_reada_buf(struct xfs_inode *dp, xfs_dablk_t bno,
 				xfs_daddr_t mapped_bno, int whichfork,
 				const struct xfs_buf_ops *ops);
 int	xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
--- 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


Patches currently in stable-queue which might be from darrick.wong@oracle.com are

queue-4.10/xfs-correct-null-checks-and-error-processing-in-xfs_initialize_perag.patch
queue-4.10/xfs-mark-speculative-prealloc-cow-fork-extents-unwritten.patch
queue-4.10/xfs-fix-toctou-race-when-locking-an-inode-to-access-the-data-map.patch
queue-4.10/xfs-use-iomap-new-flag-for-newly-allocated-delalloc-blocks.patch
queue-4.10/xfs-handle-indlen-shortage-on-delalloc-extent-merge.patch
queue-4.10/xfs-reject-all-unaligned-direct-writes-to-reflinked-files.patch
queue-4.10/xfs-allow-unwritten-extents-in-the-cow-fork.patch
queue-4.10/xfs-tune-down-agno-asserts-in-the-bmap-code.patch
queue-4.10/xfs-verify-free-block-header-fields.patch
queue-4.10/xfs-check-for-obviously-bad-level-values-in-the-bmbt-root.patch
queue-4.10/xfs-don-t-fail-xfs_extent_busy-allocation.patch
queue-4.10/xfs-sync-eofblocks-scans-under-iolock-are-livelock-prone.patch
queue-4.10/xfs-pull-up-iolock-from-xfs_free_eofblocks.patch
queue-4.10/xfs-fail-_dir_open-when-readahead-fails.patch
queue-4.10/xfs-reset-b_first_retry_time-when-clear-the-retry-status-of-xfs_buf_t.patch
queue-4.10/xfs-update-ctime-and-mtime-on-clone-destinatation-inodes.patch
queue-4.10/xfs-split-indlen-reservations-fairly-when-under-reserved.patch
queue-4.10/xfs-filter-out-obviously-bad-btree-pointers.patch
queue-4.10/xfs-use-xfs_icluster_size_fsb-to-calculate-inode-chunk-alignment.patch
queue-4.10/xfs-only-reclaim-unwritten-cow-extents-periodically.patch
queue-4.10/xfs-try-any-ag-when-allocating-the-first-btree-block-when-reflinking.patch
queue-4.10/xfs-fix-and-streamline-error-handling-in-xfs_end_io.patch
queue-4.10/xfs-fix-eofblocks-race-with-file-extending-async-dio-writes.patch
queue-4.10/xfs-fix-uninitialized-variable-in-_reflink_convert_cow.patch
queue-4.10/xfs-don-t-reserve-blocks-for-right-shift-transactions.patch
queue-4.10/xfs-use-xfs_icluster_size_fsb-to-calculate-inode-alignment-mask.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-01 17:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 17:32 Patch "xfs: fail _dir_open when readahead fails" has been added to the 4.10-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.