diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-05-20 06:09:47 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:04 +0200 |
commit | 16ac8c9523a2744545bb773b41433a5007deeacb (patch) | |
tree | 565d2d74e09a8919e15ee3e097f9940c0fb5012a /fs/bcachefs/fs-common.c | |
parent | bcachefs: Make bch2_remap_range respect O_SYNC (diff) | |
download | linux-16ac8c9523a2744545bb773b41433a5007deeacb.tar.xz 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/fs-common.c')
-rw-r--r-- | fs/bcachefs/fs-common.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c index 34d69c3f6680..08c6af886df7 100644 --- a/fs/bcachefs/fs-common.c +++ b/fs/bcachefs/fs-common.c @@ -289,6 +289,13 @@ int bch2_rename_trans(struct btree_trans *trans, dst_inode_u->bi_dir = src_dir_u->bi_inum; dst_inode_u->bi_dir_offset = src_offset; } + + if (mode == BCH_RENAME_OVERWRITE && + dst_inode_u->bi_dir == dst_dir_u->bi_inum && + dst_inode_u->bi_dir_offset == src_offset) { + dst_inode_u->bi_dir = 0; + dst_inode_u->bi_dir_offset = 0; + } } if (mode == BCH_RENAME_OVERWRITE) { |