mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 11:33:28 +02:00
btrfs: abort transaction on error in write_all_supers()
We are in a transaction context and have an handle, so instead of using the less preferred btrfs_handle_fs_error(), abort the transaction and log an error to give some context information. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
98d9df2515
commit
3810ab40af
|
|
@ -4071,8 +4071,8 @@ int write_all_supers(struct btrfs_trans_handle *trans, int max_mirrors)
|
|||
if (ret) {
|
||||
mutex_unlock(
|
||||
&fs_info->fs_devices->device_list_mutex);
|
||||
btrfs_handle_fs_error(fs_info, ret,
|
||||
"errors while submitting device barriers.");
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
btrfs_err(fs_info, "error while submitting device barriers");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -4106,9 +4106,10 @@ int write_all_supers(struct btrfs_trans_handle *trans, int max_mirrors)
|
|||
ret = btrfs_validate_write_super(fs_info, sb);
|
||||
if (unlikely(ret < 0)) {
|
||||
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
|
||||
btrfs_handle_fs_error(fs_info, -EUCLEAN,
|
||||
"unexpected superblock corruption detected");
|
||||
return -EUCLEAN;
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
btrfs_err(fs_info,
|
||||
"unexpected superblock corruption before writing it");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = write_dev_supers(dev, sb, max_mirrors);
|
||||
|
|
@ -4121,9 +4122,8 @@ int write_all_supers(struct btrfs_trans_handle *trans, int max_mirrors)
|
|||
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
|
||||
|
||||
/* FUA is masked off if unsupported and can't be the reason */
|
||||
btrfs_handle_fs_error(fs_info, -EIO,
|
||||
"%d errors while writing supers",
|
||||
total_errors);
|
||||
btrfs_abort_transaction(trans, -EIO);
|
||||
btrfs_err(fs_info, "%d errors while writing supers", total_errors);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
@ -4141,9 +4141,8 @@ int write_all_supers(struct btrfs_trans_handle *trans, int max_mirrors)
|
|||
}
|
||||
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
|
||||
if (unlikely(total_errors > max_errors)) {
|
||||
btrfs_handle_fs_error(fs_info, -EIO,
|
||||
"%d errors while writing supers",
|
||||
total_errors);
|
||||
btrfs_abort_transaction(trans, -EIO);
|
||||
btrfs_err(fs_info, "%d errors while writing supers", total_errors);
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user