summaryrefslogtreecommitdiff
path: root/libbcachefs/dirent.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-15 23:45:29 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-02-15 23:45:29 -0500
commite773e86495534ede8efc0f3059cf0939c374a925 (patch)
treee928013e6080cd1bb78901a9e29fe000650220ed /libbcachefs/dirent.c
parentf2ba586baf981af0e31f160325a51849089f6584 (diff)
Update bcachefs sources to 9a555a741e80 bcachefs: omit alignment attribute on big endian struct bkeyv1.6.2
Diffstat (limited to 'libbcachefs/dirent.c')
-rw-r--r--libbcachefs/dirent.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libbcachefs/dirent.c b/libbcachefs/dirent.c
index b5ee11b5..d37bd07a 100644
--- a/libbcachefs/dirent.c
+++ b/libbcachefs/dirent.c
@@ -512,7 +512,7 @@ u64 bch2_dirent_lookup(struct bch_fs *c, subvol_inum dir,
return ret;
}
-int bch2_empty_dir_snapshot(struct btree_trans *trans, u64 dir, u32 snapshot)
+int bch2_empty_dir_snapshot(struct btree_trans *trans, u64 dir, u32 subvol, u32 snapshot)
{
struct btree_iter iter;
struct bkey_s_c k;
@@ -522,6 +522,9 @@ int bch2_empty_dir_snapshot(struct btree_trans *trans, u64 dir, u32 snapshot)
SPOS(dir, 0, snapshot),
POS(dir, U64_MAX), 0, k, ret)
if (k.k->type == KEY_TYPE_dirent) {
+ struct bkey_s_c_dirent d = bkey_s_c_to_dirent(k);
+ if (d.v->d_type == DT_SUBVOL && le32_to_cpu(d.v->d_parent_subvol) != subvol)
+ continue;
ret = -BCH_ERR_ENOTEMPTY_dir_not_empty;
break;
}
@@ -535,7 +538,7 @@ int bch2_empty_dir_trans(struct btree_trans *trans, subvol_inum dir)
u32 snapshot;
return bch2_subvolume_get_snapshot(trans, dir.subvol, &snapshot) ?:
- bch2_empty_dir_snapshot(trans, dir.inum, snapshot);
+ bch2_empty_dir_snapshot(trans, dir.inum, dir.subvol, snapshot);
}
int bch2_readdir(struct bch_fs *c, subvol_inum inum, struct dir_context *ctx)