diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-05-20 00:09:47 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:04 -0400 |
commit | 16ac8c9523a2744545bb773b41433a5007deeacb (patch) | |
tree | 565d2d74e09a8919e15ee3e097f9940c0fb5012a /fs/bcachefs/dirent.c | |
parent | e7084c9c8151b226c83258ccdccf172b74688324 (diff) | |
download | linux-16ac8c9523a2744545bb773b41433a5007deeacb.tar.gz linux-16ac8c9523a2744545bb773b41433a5007deeacb.tar.bz2 linux-16ac8c9523a2744545bb773b41433a5007deeacb.zip |
bcachefs: Fix inode backpointers in RENAME_OVERWRITE
When we delete the dirent an inode points to, we need to zero out the
backpointer fields - this was missed in the RENAME_OVERWRITE case.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/dirent.c')
-rw-r--r-- | fs/bcachefs/dirent.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index ec4666143f23..3bf6379cefe6 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -210,6 +210,8 @@ int bch2_dirent_rename(struct btree_trans *trans, if (mode != BCH_RENAME) *dst_inum = le64_to_cpu(bkey_s_c_to_dirent(old_dst).v->d_inum); + if (mode != BCH_RENAME_EXCHANGE) + *src_offset = dst_iter->pos.offset; /* Lookup src: */ src_iter = bch2_hash_lookup(trans, bch2_dirent_hash_desc, @@ -290,7 +292,8 @@ int bch2_dirent_rename(struct btree_trans *trans, bch2_trans_update(trans, src_iter, &new_src->k_i, 0); bch2_trans_update(trans, dst_iter, &new_dst->k_i, 0); out_set_offset: - *src_offset = new_src->k.p.offset; + if (mode == BCH_RENAME_EXCHANGE) + *src_offset = new_src->k.p.offset; *dst_offset = new_dst->k.p.offset; out: bch2_trans_iter_put(trans, src_iter); |