[PATCH 13/15] Add ngnfs_dir_rename() and very basic debugfs command
Valerie Aurora
val at versity.com
Fri Mar 14 11:45:58 PDT 2025
On Wed, Mar 12, 2025 at 3:34 PM Valerie Aurora <val at versity.com> wrote:
>
> This has a known bug where after around 600 renames it returns a
> spurious ENOENT.
Hurray, I found this pesky bug when I made the same mistake writing xattrs:
> +int ngnfs_dir_rename(struct ngnfs_fs_info *nfi, struct ngnfs_inode_ino_gen *src_dir_ig,
> + char *src_name, size_t src_name_len, struct ngnfs_inode_ino_gen *dst_dir_ig,
> + char *dst_name, size_t dst_name_len)
> +{
> + struct {
> + struct ngnfs_transaction txn;
> + struct ngnfs_inode_txn_ref src_dir, dst_dir, dst;
> + struct dirent_args src_da, dst_da;
> + } *op;
> + int ret;
> +
> + op = kmalloc(sizeof(*op), GFP_NOFS);
> + if (!op) {
> + ret = -ENOMEM;
> + goto out;
> + }
> +
> + ngnfs_txn_init(&op->txn);
> + init_dirent_args(&op->src_da, src_name, src_name_len, 0);
> + init_dirent_args(&op->dst_da, dst_name, dst_name_len, 0);
> +
> + do {
> + ret = ngnfs_inode_get(nfi, &op->txn, NBF_READ, src_dir_ig, &op->src_dir) ?:
> + check_ifmt(op->src_dir.ninode, S_IFDIR, -ENOTDIR) ?:
> + lookup_dirent(nfi, &op->txn, &op->src_dir, &op->src_da, false) ?:
> + ngnfs_inode_get(nfi, &op->txn, NBF_READ, dst_dir_ig, &op->dst_dir) ?:
These two NBF_READs should be NBF_WRITE, of course.
Valerie
More information about the ngnfs-devel
mailing list