mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 07:04:44 +00:00
bcachefs: Fix error message on bucket sector count overflow
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
f1f5f114cd
commit
38f0664a5f
1 changed files with 4 additions and 6 deletions
|
@ -1444,8 +1444,7 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
|
|||
struct bkey_s_c k;
|
||||
struct bkey_alloc_unpacked u;
|
||||
struct bkey_i_alloc *a;
|
||||
u16 *dst_sectors;
|
||||
bool overflow;
|
||||
u16 *dst_sectors, orig_sectors;
|
||||
int ret;
|
||||
|
||||
ret = trans_get_key(trans, BTREE_ID_ALLOC,
|
||||
|
@ -1502,13 +1501,12 @@ static int bch2_trans_mark_pointer(struct btree_trans *trans,
|
|||
dst_sectors = !p.ptr.cached
|
||||
? &u.dirty_sectors
|
||||
: &u.cached_sectors;
|
||||
orig_sectors = *dst_sectors;
|
||||
|
||||
overflow = checked_add(*dst_sectors, sectors);
|
||||
|
||||
if (overflow) {
|
||||
if (checked_add(*dst_sectors, sectors)) {
|
||||
bch2_fs_inconsistent(c,
|
||||
"bucket sector count overflow: %u + %lli > U16_MAX",
|
||||
*dst_sectors, sectors);
|
||||
orig_sectors, sectors);
|
||||
/* return an error indicating that we need full fsck */
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
|
|
Loading…
Reference in a new issue