btrfs: log message if extent item not found when running delayed extent op
authorFilipe Manana <fdmanana@suse.com>
Fri, 8 Sep 2023 17:20:29 +0000 (18:20 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 20 Sep 2023 18:42:58 +0000 (20:42 +0200)
When running a delayed extent operation, if we don't find the extent item
in the extent tree we just return -EIO without any logged message. This
indicates some bug or possibly a memory or fs corruption, so the return
value should not be -EIO but -EUCLEAN instead, and since it's not expected
to ever happen, print an informative error message so that if it happens
we have some idea of what went wrong, where to look at.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c

index fd80129acc3c9e661c9baba4c19e8085b615f42f..fc313fce5bbdc7d9e5e2a7994b7e3ba0ab12105a 100644 (file)
@@ -1655,7 +1655,10 @@ again:
                                goto again;
                        }
                } else {
-                       err = -EIO;
+                       err = -EUCLEAN;
+                       btrfs_err(fs_info,
+                 "missing extent item for extent %llu num_bytes %llu level %d",
+                                 head->bytenr, head->num_bytes, extent_op->level);
                        goto out;
                }
        }