[1/2] btrfs: don't WARN_ON() if we abort a transaction with -EROFS
diff mbox series

Message ID 20200721152428.9934-1-josef@toxicpanda.com
State New
Headers show
Series
  • [1/2] btrfs: don't WARN_ON() if we abort a transaction with -EROFS
Related show

Commit Message

Josef Bacik July 21, 2020, 3:24 p.m. UTC
If we got some sort of corruption via a read and call
btrfs_handle_fs_error() we'll set BTRFS_FS_STATE_ERROR on the fs and
complain.  If a subsequent trans handle trips over this it'll get -EROFS
and then abort.  However at that point we're not aborting for the
original reason, we're aborting because we've been flipped read only.
We do not need to WARN_ON() here.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/ctree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba July 21, 2020, 3:50 p.m. UTC | #1
On Tue, Jul 21, 2020 at 11:24:27AM -0400, Josef Bacik wrote:
> If we got some sort of corruption via a read and call
> btrfs_handle_fs_error() we'll set BTRFS_FS_STATE_ERROR on the fs and
> complain.  If a subsequent trans handle trips over this it'll get -EROFS
> and then abort.  However at that point we're not aborting for the
> original reason, we're aborting because we've been flipped read only.
> We do not need to WARN_ON() here.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

1 and 2 added to misc-next, thanks.

Patch
diff mbox series

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b70c2024296f..f8ae4849f235 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3279,7 +3279,7 @@  do {								\
 	/* Report first abort since mount */			\
 	if (!test_and_set_bit(BTRFS_FS_STATE_TRANS_ABORTED,	\
 			&((trans)->fs_info->fs_state))) {	\
-		if ((errno) != -EIO) {				\
+		if ((errno) != -EIO && (errno) != -EROFS) {	\
 			WARN(1, KERN_DEBUG				\
 			"BTRFS: Transaction aborted (error %d)\n",	\
 			(errno));					\