]> git.hungrycats.org Git - linux/commitdiff
btrfs: don't WARN if we abort a transaction with EROFS
authorJosef Bacik <josef@toxicpanda.com>
Tue, 21 Jul 2020 15:24:27 +0000 (11:24 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Tue, 1 Sep 2020 04:44:17 +0000 (00:44 -0400)
commit f95ebdbed46a4d8b9fdb7bff109fdbb6fc9a6dc8 upstream.

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.

CC: stable@vger.kernel.org # 5.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ee6373070108cab313ddcb4ab6a6415cf11c69b0)

fs/btrfs/ctree.h

index b4274df76bb36946cd86436039f211c92b49fcb2..2f1d67f3efe963814af7fb29f497f57121d4de40 100644 (file)
@@ -3169,7 +3169,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));                                       \