bcachefs: Fix WARN() in bch2_bkey_pick_read_device()
syzbot discovered that this one is possible: we have pointers, but none of them are to valid devices. Reported-by: syzbot+336a6e6a2dbb7d4dba9a@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -310,6 +310,7 @@
|
||||
x(BCH_ERR_data_write, data_write_misaligned) \
|
||||
x(BCH_ERR_decompress, data_read) \
|
||||
x(BCH_ERR_data_read, no_device_to_read_from) \
|
||||
x(BCH_ERR_data_read, no_devices_valid) \
|
||||
x(BCH_ERR_data_read, data_read_io_err) \
|
||||
x(BCH_ERR_data_read, data_read_csum_err) \
|
||||
x(BCH_ERR_data_read, data_read_retry) \
|
||||
|
||||
@@ -227,8 +227,11 @@ int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k,
|
||||
if (have_io_errors)
|
||||
return -BCH_ERR_data_read_io_err;
|
||||
|
||||
WARN_ONCE(1, "unhandled error case in %s\n", __func__);
|
||||
return -EINVAL;
|
||||
/*
|
||||
* If we get here, we have pointers (bkey_ptrs_validate() ensures that),
|
||||
* but they don't point to valid devices:
|
||||
*/
|
||||
return -BCH_ERR_no_devices_valid;
|
||||
}
|
||||
|
||||
/* KEY_TYPE_btree_ptr: */
|
||||
|
||||
Reference in New Issue
Block a user