mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
bcachefs: Fix for bch2_bkey_pack_pos() not initializing len/version fields
This bug led to push_whiteout() generating whiteouts that failed bch2_bkey_invalid() due to nonzero length fields - oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
82355e2882
commit
c21d537779
1 changed files with 8 additions and 1 deletions
|
@ -446,8 +446,15 @@ enum bkey_pack_pos_ret bch2_bkey_pack_pos_lossy(struct bkey_packed *out,
|
|||
struct bpos orig = in;
|
||||
#endif
|
||||
bool exact = true;
|
||||
unsigned i;
|
||||
|
||||
*w = 0;
|
||||
/*
|
||||
* bch2_bkey_pack_key() will write to all of f->key_u64s, minus the 3
|
||||
* byte header, but pack_pos() won't if the len/version fields are big
|
||||
* enough - we need to make sure to zero them out:
|
||||
*/
|
||||
for (i = 0; i < f->key_u64s; i++)
|
||||
w[i] = 0;
|
||||
|
||||
if (unlikely(in.snapshot <
|
||||
le64_to_cpu(f->field_offset[BKEY_FIELD_SNAPSHOT]))) {
|
||||
|
|
Loading…
Add table
Reference in a new issue