]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: fail priority metadata ticket with real fs error
authorFilipe Manana <fdmanana@suse.com>
Wed, 26 Jul 2023 15:57:06 +0000 (16:57 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Aug 2023 12:52:18 +0000 (14:52 +0200)
At priority_reclaim_metadata_space(), if we were not able to satisfy the
the ticket after going through the various flushing states and we notice
the fs went into an error state, likely due to a transaction abort during
the flushing, set the ticket's error to the error that caused the
transaction abort instead of an unconditional -EROFS.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c

index 5b1b71e029ad23c62a6fd042196e215e30150440..be5ce209b918d12916e008a6b7131a2583167851 100644 (file)
@@ -1421,13 +1421,13 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info,
        /*
         * Attempt to steal from the global rsv if we can, except if the fs was
         * turned into error mode due to a transaction abort when flushing space
-        * above, in that case fail with -EROFS instead of returning success to
-        * the caller if we can steal from the global rsv - this is just to have
-        * caller fail immeditelly instead of later when trying to modify the
-        * fs, making it easier to debug -ENOSPC problems.
+        * above, in that case fail with the abort error instead of returning
+        * success to the caller if we can steal from the global rsv - this is
+        * just to have caller fail immeditelly instead of later when trying to
+        * modify the fs, making it easier to debug -ENOSPC problems.
         */
        if (BTRFS_FS_ERROR(fs_info)) {
-               ticket->error = -EROFS;
+               ticket->error = BTRFS_FS_ERROR(fs_info);
                remove_ticket(space_info, ticket);
        } else if (!steal_from_global_rsv(fs_info, space_info, ticket)) {
                ticket->error = -ENOSPC;