> + d = dentry;
> + dentry = vfs_mkdir(idmap, d_inode(path.dentry), dentry, mode);
> + if (IS_ERR(dentry))
> + err = PTR_ERR(dentry);
> + else if (d_is_negative(dentry))
> + err = -ENOENT;
> + if (!err && dentry != d)
> + ksmbd_vfs_inherit_owner(work, d_inode(path.dentry),
> d_inode(dentry));
>
> -out_err:
> done_path_create(&path, dentry);
> if (err)
> pr_err("mkdir(%s): creation failed (err:%d)\n", name, err);
> diff --git a/fs/xfs/scrub/orphanage.c b/fs/xfs/scrub/orphanage.c
> index c287c755f2c5..3537f3cca6d5 100644
> --- a/fs/xfs/scrub/orphanage.c
> +++ b/fs/xfs/scrub/orphanage.c
> @@ -167,10 +167,11 @@ xrep_orphanage_create(
>* directory to control access to a file we put in here.
>*/
> if (d_really_is_negative(orphanage_dentry)) {
> - error = vfs_mkdir(&nop_mnt_idmap, root_inode, orphanage_dentry,
> - 0750);
> - if (error)
> - goto out_dput_orphanage;
> + orphanage_dentry = vfs_mkdir(&nop_mnt_idmap, root_inode,
> + orphanage_dentry, 0750);
> + error = PTR_ERR(orphanage_dentry);
> + if (IS_ERR(orphanage_dentry))
> + goto out_unlock_root;
> }
>
> /* Not a directory? Bail out. */
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 8f4fbecd40fc..eaad8e31c0d4 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1971,8 +1971,8 @@ bool inode_owner_or_capable(struct mnt_idmap *idmap,
> */
> int vfs_create(struct mnt_idmap *, struct inode *,
> struct dentry *, umode_t, bool);
> -int vfs_mkdir(struct mnt_idmap *, struct inode *,
> - struct dentry *, umode_t);
> +struct dentry *vfs_mkdir(struct mnt_idmap *, struct inode *,
> + struct dentry *, umode_t);
> int vfs_mknod(struct mnt_idmap *, struct inode *, struct dentry *,
>umode_t, dev_t);
> int vfs_symlink(struct mnt_idmap *, struct inode *,
--
Chuck Lever
On 2/23/25 9:51 PM, NeilBrown wrote:
> On Sat, 22 Feb 2025, Chuck Lever wrote:
>> On 2/20/25 6:36 PM, NeilBrown wrote:
> ...
>>> + dchild = vfs_mkdir(&nop_mnt_idmap, dirp, dchild, iap->ia_mode);
>>> + if (IS_ERR(dchild)) {
>>>