diff options
author | Guoyu Ou <benogy@gmail.com> | 2024-02-13 16:20:04 +0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-10 15:34:07 -0400 |
commit | 0be5b38bce6c4d3563f7575f6bac94806b2fbc17 (patch) | |
tree | 688a5726d99cbb56ea7dd7c115563c9281a039ea /fs/bcachefs/dirent.h | |
parent | 067f244c9e4d2c00b493291df5f17510fd0bd9c1 (diff) | |
download | linux-0be5b38bce6c4d3563f7575f6bac94806b2fbc17.tar.gz linux-0be5b38bce6c4d3563f7575f6bac94806b2fbc17.tar.bz2 linux-0be5b38bce6c4d3563f7575f6bac94806b2fbc17.zip |
bcachefs: skip invisible entries in empty subvolume checking
When we are checking whether a subvolume is empty in the specified snapshot,
entries that do not belong to this subvolume should be skipped.
This fixes the following case:
$ bcachefs subvolume create ./sub
$ cd sub
$ bcachefs subvolume create ./sub2
$ bcachefs subvolume snapshot . ./snap
$ ls -a snap
. ..
$ rmdir snap
rmdir: failed to remove 'snap': Directory not empty
As Kent suggested, we pass 0 in may_delete_deleted_inode() to ignore subvols
in the subvol we are checking, because inode.bi_subvol is only set on
subvolume roots, and we can't go through every inode in the subvolume and
change bi_subvol when taking a snapshot. It makes the check less strict, but
that's ok, the rest of fsck will still catch it.
Signed-off-by: Guoyu Ou <benogy@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/dirent.h')
-rw-r--r-- | fs/bcachefs/dirent.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/dirent.h b/fs/bcachefs/dirent.h index 21ffeb78f02e..aeb8207ca9f2 100644 --- a/fs/bcachefs/dirent.h +++ b/fs/bcachefs/dirent.h @@ -69,7 +69,7 @@ u64 bch2_dirent_lookup(struct bch_fs *, subvol_inum, const struct bch_hash_info *, const struct qstr *, subvol_inum *); -int bch2_empty_dir_snapshot(struct btree_trans *, u64, u32); +int bch2_empty_dir_snapshot(struct btree_trans *, u64, u32, u32); int bch2_empty_dir_trans(struct btree_trans *, subvol_inum); int bch2_readdir(struct bch_fs *, subvol_inum, struct dir_context *); |