summaryrefslogtreecommitdiff
path: root/libbcachefs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/namei.c')
-rw-r--r--libbcachefs/namei.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/libbcachefs/namei.c b/libbcachefs/namei.c
index 3e2b41ba..8fa10888 100644
--- a/libbcachefs/namei.c
+++ b/libbcachefs/namei.c
@@ -99,7 +99,9 @@ int bch2_create_trans(struct btree_trans *trans,
* If we're not root, we have to own the subvolume being
* snapshotted:
*/
- if (uid && new_inode->bi_uid != uid) {
+ if (uid &&
+ !capable(CAP_FOWNER) &&
+ new_inode->bi_uid != uid) {
ret = -EPERM;
goto err;
}
@@ -727,7 +729,7 @@ static int bch2_check_dirent_inode_dirent(struct btree_trans *trans,
bool in_fsck)
{
struct bch_fs *c = trans->c;
- struct printbuf buf = PRINTBUF;
+ CLASS(printbuf, buf)();
struct btree_iter bp_iter = {};
int ret = 0;
@@ -835,7 +837,6 @@ out:
err:
fsck_err:
bch2_trans_iter_exit(trans, &bp_iter);
- printbuf_exit(&buf);
bch_err_fn(c, ret);
return ret;
}
@@ -847,7 +848,7 @@ int __bch2_check_dirent_target(struct btree_trans *trans,
bool in_fsck)
{
struct bch_fs *c = trans->c;
- struct printbuf buf = PRINTBUF;
+ CLASS(printbuf, buf)();
int ret = 0;
ret = bch2_check_dirent_inode_dirent(trans, d, target, in_fsck);
@@ -882,7 +883,6 @@ int __bch2_check_dirent_target(struct btree_trans *trans,
}
err:
fsck_err:
- printbuf_exit(&buf);
bch_err_fn(c, ret);
return ret;
}
@@ -940,7 +940,7 @@ int bch2_check_inode_has_case_insensitive(struct btree_trans *trans,
snapshot_id_list *snapshot_overwrites,
bool *do_update)
{
- struct printbuf buf = PRINTBUF;
+ CLASS(printbuf, buf)();
bool repairing_parents = false;
int ret = 0;
@@ -967,7 +967,7 @@ int bch2_check_inode_has_case_insensitive(struct btree_trans *trans,
ret = bch2_inum_snapshot_to_path(trans, inode->bi_inum, inode->bi_snapshot,
snapshot_overwrites, &buf);
if (ret)
- goto err;
+ return ret;
if (fsck_err(trans, inode_has_case_insensitive_not_set, "%s", buf.buf)) {
inode->bi_flags |= BCH_INODE_has_case_insensitive;
@@ -986,14 +986,14 @@ int bch2_check_inode_has_case_insensitive(struct btree_trans *trans,
if (dir.bi_parent_subvol) {
ret = bch2_subvolume_get_snapshot(trans, dir.bi_parent_subvol, &snapshot);
if (ret)
- goto err;
+ return ret;
snapshot_overwrites = NULL;
}
ret = bch2_inode_find_by_inum_snapshot(trans, dir.bi_dir, snapshot, &dir, 0);
if (ret)
- goto err;
+ return ret;
if (!(dir.bi_flags & BCH_INODE_has_case_insensitive)) {
prt_printf(&buf, "parent of casefolded dir with has_case_insensitive not set\n");
@@ -1001,13 +1001,13 @@ int bch2_check_inode_has_case_insensitive(struct btree_trans *trans,
ret = bch2_inum_snapshot_to_path(trans, dir.bi_inum, dir.bi_snapshot,
snapshot_overwrites, &buf);
if (ret)
- goto err;
+ return ret;
if (fsck_err(trans, inode_parent_has_case_insensitive_not_set, "%s", buf.buf)) {
dir.bi_flags |= BCH_INODE_has_case_insensitive;
ret = __bch2_fsck_write_inode(trans, &dir);
if (ret)
- goto err;
+ return ret;
}
}
@@ -1019,9 +1019,7 @@ int bch2_check_inode_has_case_insensitive(struct btree_trans *trans,
break;
}
out:
-err:
fsck_err:
- printbuf_exit(&buf);
if (ret)
return ret;