]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Change inode_operations.mkdir to return struct dentry *
authorNeilBrown <neilb@suse.de>
Thu, 27 Feb 2025 01:32:53 +0000 (12:32 +1100)
committerChristian Brauner <brauner@kernel.org>
Thu, 27 Feb 2025 19:00:17 +0000 (20:00 +0100)
Some filesystems, such as NFS, cifs, ceph, and fuse, do not have
complete control of sequencing on the actual filesystem (e.g.  on a
different server) and may find that the inode created for a mkdir
request already exists in the icache and dcache by the time the mkdir
request returns.  For example, if the filesystem is mounted twice the
directory could be visible on the other mount before it is on the
original mount, and a pair of name_to_handle_at(), open_by_handle_at()
calls could instantiate the directory inode with an IS_ROOT() dentry
before the first mkdir returns.

This means that the dentry passed to ->mkdir() may not be the one that
is associated with the inode after the ->mkdir() completes.  Some
callers need to interact with the inode after the ->mkdir completes and
they currently need to perform a lookup in the (rare) case that the
dentry is no longer hashed.

This lookup-after-mkdir requires that the directory remains locked to
avoid races.  Planned future patches to lock the dentry rather than the
directory will mean that this lookup cannot be performed atomically with
the mkdir.

To remove this barrier, this patch changes ->mkdir to return the
resulting dentry if it is different from the one passed in.
Possible returns are:
  NULL - the directory was created and no other dentry was used
  ERR_PTR() - an error occurred
  non-NULL - this other dentry was spliced in

This patch only changes file-systems to return "ERR_PTR(err)" instead of
"err" or equivalent transformations.  Subsequent patches will make
further changes to some file-systems to return a correct dentry.

Not all filesystems reliably result in a positive hashed dentry:

- NFS, cifs, hostfs will sometimes need to perform a lookup of
  the name to get inode information.  Races could result in this
  returning something different. Note that this lookup is
  non-atomic which is what we are trying to avoid.  Placing the
  lookup in filesystem code means it only happens when the filesystem
  has no other option.
- kernfs and tracefs leave the dentry negative and the ->revalidate
  operation ensures that lookup will be called to correctly populate
  the dentry.  This could be fixed but I don't think it is important
  to any of the users of vfs_mkdir() which look at the dentry.

The recommendation to use
    d_drop();d_splice_alias()
is ugly but fits with current practice.  A planned future patch will
change this.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: NeilBrown <neilb@suse.de>
Link: https://lore.kernel.org/r/20250227013949.536172-2-neilb@suse.de
Signed-off-by: Christian Brauner <brauner@kernel.org>
57 files changed:
Documentation/filesystems/locking.rst
Documentation/filesystems/porting.rst
Documentation/filesystems/vfs.rst
fs/9p/vfs_inode.c
fs/9p/vfs_inode_dotl.c
fs/affs/affs.h
fs/affs/namei.c
fs/afs/dir.c
fs/autofs/root.c
fs/bad_inode.c
fs/bcachefs/fs.c
fs/btrfs/inode.c
fs/ceph/dir.c
fs/coda/dir.c
fs/configfs/dir.c
fs/ecryptfs/inode.c
fs/exfat/namei.c
fs/ext2/namei.c
fs/ext4/namei.c
fs/f2fs/namei.c
fs/fat/namei_msdos.c
fs/fat/namei_vfat.c
fs/fuse/dir.c
fs/gfs2/inode.c
fs/hfs/dir.c
fs/hfsplus/dir.c
fs/hostfs/hostfs_kern.c
fs/hpfs/namei.c
fs/hugetlbfs/inode.c
fs/jffs2/dir.c
fs/jfs/namei.c
fs/kernfs/dir.c
fs/minix/namei.c
fs/namei.c
fs/nfs/dir.c
fs/nfs/internal.h
fs/nilfs2/namei.c
fs/ntfs3/namei.c
fs/ocfs2/dlmfs/dlmfs.c
fs/ocfs2/namei.c
fs/omfs/dir.c
fs/orangefs/namei.c
fs/overlayfs/dir.c
fs/ramfs/inode.c
fs/smb/client/cifsfs.h
fs/smb/client/inode.c
fs/sysv/namei.c
fs/tracefs/inode.c
fs/ubifs/dir.c
fs/udf/namei.c
fs/ufs/namei.c
fs/vboxsf/dir.c
fs/xfs/xfs_iops.c
include/linux/fs.h
kernel/bpf/inode.c
mm/shmem.c
security/apparmor/apparmorfs.c

index d20a32b77b60f64e711cf02c5ac107d7f2d62bcc..0ec0bb6eb0fb247851d9c9bffcd33eff2dbd8ef3 100644 (file)
@@ -66,7 +66,7 @@ prototypes::
        int (*link) (struct dentry *,struct inode *,struct dentry *);
        int (*unlink) (struct inode *,struct dentry *);
        int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
-       int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
+       struct dentry *(*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
        int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
index 3ed3f39ecf716b8e08e7812e6ae1a344318b8433..fe0581271d5bbc853a4b9b687ba0d130bf0675f2 100644 (file)
@@ -1178,3 +1178,22 @@ these conditions don't require explicit checks:
 
 LOOKUP_EXCL now means "target must not exist".  It can be combined with
 LOOK_CREATE or LOOKUP_RENAME_TARGET.
+
+---
+
+** mandatory**
+
+->mkdir() now returns a 'struct dentry *'.  If the created inode is
+found to already be in cache and have a dentry (often IS_ROOT()), it will
+need to be spliced into the given name in place of the given dentry.
+That dentry now needs to be returned.  If the original dentry is used,
+NULL should be returned.  Any error should be returned with
+ERR_PTR().
+
+In general, filesystems which use d_instantiate_new() to install the new
+inode can safely return NULL.  Filesystems which may not have an I_NEW inode
+should use d_drop();d_splice_alias() and return the result of the latter.
+
+If a positive dentry cannot be returned for some reason, in-kernel
+clients such as cachefiles, nfsd, smb/server may not perform ideally but
+will fail-safe.
index 31eea688609a736b54b902ebeb00ffeb82964431..ae79c30b6c0cc0c0aac442cd767770a83a82dae7 100644 (file)
@@ -495,7 +495,7 @@ As of kernel 2.6.22, the following members are defined:
                int (*link) (struct dentry *,struct inode *,struct dentry *);
                int (*unlink) (struct inode *,struct dentry *);
                int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
-               int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
+               struct dentry *(*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t);
                int (*rmdir) (struct inode *,struct dentry *);
                int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
                int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
@@ -562,7 +562,26 @@ otherwise noted.
 ``mkdir``
        called by the mkdir(2) system call.  Only required if you want
        to support creating subdirectories.  You will probably need to
-       call d_instantiate() just as you would in the create() method
+       call d_instantiate_new() just as you would in the create() method.
+
+       If d_instantiate_new() is not used and if the fh_to_dentry()
+       export operation is provided, or if the storage might be
+       accessible by another path (e.g. with a network filesystem)
+       then more care may be needed.  Importantly d_instantate()
+       should not be used with an inode that is no longer I_NEW if there
+       any chance that the inode could already be attached to a dentry.
+       This is because of a hard rule in the VFS that a directory must
+       only ever have one dentry.
+
+       For example, if an NFS filesystem is mounted twice the new directory
+       could be visible on the other mount before it is on the original
+       mount, and a pair of name_to_handle_at(), open_by_handle_at()
+       calls could instantiate the directory inode with an IS_ROOT()
+       dentry before the first mkdir returns.
+
+       If there is any chance this could happen, then the new inode
+       should be d_drop()ed and attached with d_splice_alias().  The
+       returned dentry (if any) should be returned by ->mkdir().
 
 ``rmdir``
        called by the rmdir(2) system call.  Only required if you want
index 3e68521f4e2f9842019cdea2755d8a657a8ebb21..399d455d50d626f300ad9b3e4a13aadbaf37e550 100644 (file)
@@ -669,8 +669,8 @@ v9fs_vfs_create(struct mnt_idmap *idmap, struct inode *dir,
  *
  */
 
-static int v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                         struct dentry *dentry, umode_t mode)
+static struct dentry *v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                    struct dentry *dentry, umode_t mode)
 {
        int err;
        u32 perm;
@@ -692,8 +692,7 @@ static int v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        if (fid)
                p9_fid_put(fid);
-
-       return err;
+       return ERR_PTR(err);
 }
 
 /**
index 143ac03b7425c0e589bc097dac8b070792ef8679..cc2007be2173082fe9587589ebb476b21780b8ec 100644 (file)
@@ -350,9 +350,9 @@ out:
  *
  */
 
-static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
-                              struct inode *dir, struct dentry *dentry,
-                              umode_t omode)
+static struct dentry *v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
+                                         struct inode *dir, struct dentry *dentry,
+                                         umode_t omode)
 {
        int err;
        struct v9fs_session_info *v9ses;
@@ -417,7 +417,7 @@ error:
        p9_fid_put(fid);
        v9fs_put_acl(dacl, pacl);
        p9_fid_put(dfid);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int
index e8c2c4535cb37cf646ec9b72ee569c615c6c0dc0..ac4e9a02910b72d63c8ec5291347b54518e67f4b 100644 (file)
@@ -168,7 +168,7 @@ extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsi
 extern int     affs_unlink(struct inode *dir, struct dentry *dentry);
 extern int     affs_create(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, umode_t mode, bool);
-extern int     affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+extern struct dentry *affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
                        struct dentry *dentry, umode_t mode);
 extern int     affs_rmdir(struct inode *dir, struct dentry *dentry);
 extern int     affs_link(struct dentry *olddentry, struct inode *dir,
index 8c154490a2d6da040718d50b6b6b7142f0f2a0cf..f883be50db122d3b09f0ae4d24618bd49b55186b 100644 (file)
@@ -273,7 +273,7 @@ affs_create(struct mnt_idmap *idmap, struct inode *dir,
        return 0;
 }
 
-int
+struct dentry *
 affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
           struct dentry *dentry, umode_t mode)
 {
@@ -285,7 +285,7 @@ affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        inode = affs_new_inode(dir);
        if (!inode)
-               return -ENOSPC;
+               return ERR_PTR(-ENOSPC);
 
        inode->i_mode = S_IFDIR | mode;
        affs_mode_to_prot(inode);
@@ -298,9 +298,9 @@ affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
                clear_nlink(inode);
                mark_inode_dirty(inode);
                iput(inode);
-               return error;
+               return ERR_PTR(error);
        }
-       return 0;
+       return NULL;
 }
 
 int
index 02cbf38e1a7762b95a97a31e4dcd1d8335c2df75..5bddcc20786e7e68b3c1b3cd38871317ffcc78cd 100644 (file)
@@ -33,8 +33,8 @@ static bool afs_lookup_filldir(struct dir_context *ctx, const char *name, int nl
                              loff_t fpos, u64 ino, unsigned dtype);
 static int afs_create(struct mnt_idmap *idmap, struct inode *dir,
                      struct dentry *dentry, umode_t mode, bool excl);
-static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                    struct dentry *dentry, umode_t mode);
+static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                               struct dentry *dentry, umode_t mode);
 static int afs_rmdir(struct inode *dir, struct dentry *dentry);
 static int afs_unlink(struct inode *dir, struct dentry *dentry);
 static int afs_link(struct dentry *from, struct inode *dir,
@@ -1315,8 +1315,8 @@ static const struct afs_operation_ops afs_mkdir_operation = {
 /*
  * create a directory on an AFS filesystem
  */
-static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                    struct dentry *dentry, umode_t mode)
+static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                               struct dentry *dentry, umode_t mode)
 {
        struct afs_operation *op;
        struct afs_vnode *dvnode = AFS_FS_I(dir);
@@ -1328,7 +1328,7 @@ static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        op = afs_alloc_operation(NULL, dvnode->volume);
        if (IS_ERR(op)) {
                d_drop(dentry);
-               return PTR_ERR(op);
+               return ERR_CAST(op);
        }
 
        fscache_use_cookie(afs_vnode_cache(dvnode), true);
@@ -1344,7 +1344,7 @@ static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        op->ops         = &afs_mkdir_operation;
        ret = afs_do_sync_operation(op);
        afs_dir_unuse_cookie(dvnode, ret);
-       return ret;
+       return ERR_PTR(ret);
 }
 
 /*
index 530d18827e35afdcafd8b68dbb8536ce382d6c32..174c7205fee444b605bf37fce97e247a47a2ba89 100644 (file)
@@ -15,8 +15,8 @@ static int autofs_dir_symlink(struct mnt_idmap *, struct inode *,
                              struct dentry *, const char *);
 static int autofs_dir_unlink(struct inode *, struct dentry *);
 static int autofs_dir_rmdir(struct inode *, struct dentry *);
-static int autofs_dir_mkdir(struct mnt_idmap *, struct inode *,
-                           struct dentry *, umode_t);
+static struct dentry *autofs_dir_mkdir(struct mnt_idmap *, struct inode *,
+                                      struct dentry *, umode_t);
 static long autofs_root_ioctl(struct file *, unsigned int, unsigned long);
 #ifdef CONFIG_COMPAT
 static long autofs_root_compat_ioctl(struct file *,
@@ -720,9 +720,9 @@ static int autofs_dir_rmdir(struct inode *dir, struct dentry *dentry)
        return 0;
 }
 
-static int autofs_dir_mkdir(struct mnt_idmap *idmap,
-                           struct inode *dir, struct dentry *dentry,
-                           umode_t mode)
+static struct dentry *autofs_dir_mkdir(struct mnt_idmap *idmap,
+                                      struct inode *dir, struct dentry *dentry,
+                                      umode_t mode)
 {
        struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
        struct autofs_info *ino = autofs_dentry_ino(dentry);
@@ -739,7 +739,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap,
 
        inode = autofs_get_inode(dir->i_sb, S_IFDIR | mode);
        if (!inode)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
        d_add(dentry, inode);
 
        if (sbi->version < 5)
@@ -751,7 +751,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap,
        inc_nlink(dir);
        inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 
-       return 0;
+       return NULL;
 }
 
 /* Get/set timeout ioctl() operation */
index 316d88da2ce107df3a46de2962ad91a282ca1c76..0ef9bcb744dd620bf47caa024d97a1316ff7bc89 100644 (file)
@@ -58,10 +58,10 @@ static int bad_inode_symlink(struct mnt_idmap *idmap,
        return -EIO;
 }
 
-static int bad_inode_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                          struct dentry *dentry, umode_t mode)
+static struct dentry *bad_inode_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                     struct dentry *dentry, umode_t mode)
 {
-       return -EIO;
+       return ERR_PTR(-EIO);
 }
 
 static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry)
index 90ade8f648d96b6f1bbb362581f8faa415121a93..1c94a680fcce96678bf4eff9d6f4c7adf402f497 100644 (file)
@@ -858,10 +858,10 @@ err:
        return bch2_err_class(ret);
 }
 
-static int bch2_mkdir(struct mnt_idmap *idmap,
-                     struct inode *vdir, struct dentry *dentry, umode_t mode)
+static struct dentry *bch2_mkdir(struct mnt_idmap *idmap,
+                                struct inode *vdir, struct dentry *dentry, umode_t mode)
 {
-       return bch2_mknod(idmap, vdir, dentry, mode|S_IFDIR, 0);
+       return ERR_PTR(bch2_mknod(idmap, vdir, dentry, mode|S_IFDIR, 0));
 }
 
 static int bch2_rename2(struct mnt_idmap *idmap,
index a9322601ab5c9ff19577dc33e51463fc2558c00c..851d3e8a06a789986ecd5ca2a7118297a26c265e 100644 (file)
@@ -6739,18 +6739,18 @@ fail:
        return err;
 }
 
-static int btrfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *btrfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct inode *inode;
 
        inode = new_inode(dir->i_sb);
        if (!inode)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
        inode_init_owner(idmap, inode, dir, S_IFDIR | mode);
        inode->i_op = &btrfs_dir_inode_operations;
        inode->i_fop = &btrfs_dir_file_operations;
-       return btrfs_create_common(dir, dentry, inode);
+       return ERR_PTR(btrfs_create_common(dir, dentry, inode));
 }
 
 static noinline int uncompress_inline(struct btrfs_path *path,
index 62e99e65250d72c8c5eec6ec751c6488552fbe08..39e0f240de065484216f0b4b6200635446ee7cbe 100644 (file)
@@ -1092,8 +1092,8 @@ out:
        return err;
 }
 
-static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
        struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
        struct ceph_client *cl = mdsc->fsc->client;
@@ -1104,7 +1104,7 @@ static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        err = ceph_wait_on_conflict_unlink(dentry);
        if (err)
-               return err;
+               return ERR_PTR(err);
 
        if (ceph_snap(dir) == CEPH_SNAPDIR) {
                /* mkdir .snap/foo is a MKSNAP */
@@ -1173,7 +1173,7 @@ out:
        else
                d_drop(dentry);
        ceph_release_acl_sec_ctx(&as_ctx);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int ceph_link(struct dentry *old_dentry, struct inode *dir,
index a3e2dfeedfbf6a2185dadf13b9b556f84a026915..ab69d8f0cec2219f260fc71108c0c5d63b568d6a 100644 (file)
@@ -166,8 +166,8 @@ err_out:
        return error;
 }
 
-static int coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *de, umode_t mode)
+static struct dentry *coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *de, umode_t mode)
 {
        struct inode *inode;
        struct coda_vattr attrs;
@@ -177,14 +177,14 @@ static int coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        struct CodaFid newfid;
 
        if (is_root_inode(dir) && coda_iscontrol(name, len))
-               return -EPERM;
+               return ERR_PTR(-EPERM);
 
        attrs.va_mode = mode;
-       error = venus_mkdir(dir->i_sb, coda_i2f(dir), 
+       error = venus_mkdir(dir->i_sb, coda_i2f(dir),
                               name, len, &newfid, &attrs);
        if (error)
                goto err_out;
-         
+
        inode = coda_iget(dir->i_sb, &newfid, &attrs);
        if (IS_ERR(inode)) {
                error = PTR_ERR(inode);
@@ -195,10 +195,10 @@ static int coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        coda_dir_inc_nlink(dir);
        coda_dir_update_mtime(dir);
        d_instantiate(de, inode);
-       return 0;
+       return NULL;
 err_out:
        d_drop(de);
-       return error;
+       return ERR_PTR(error);
 }
 
 /* try to make de an entry in dir_inodde linked to source_de */ 
index 7d10278db30d667d0ef7e1140e54961c5a440c41..5568cb74b32243ef30eac9c5957c17da3ca5afe9 100644 (file)
@@ -1280,8 +1280,8 @@ out_root_unlock:
 }
 EXPORT_SYMBOL(configfs_depend_item_unlocked);
 
-static int configfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                         struct dentry *dentry, umode_t mode)
+static struct dentry *configfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                    struct dentry *dentry, umode_t mode)
 {
        int ret = 0;
        int module_got = 0;
@@ -1461,7 +1461,7 @@ out_put:
        put_fragment(frag);
 
 out:
-       return ret;
+       return ERR_PTR(ret);
 }
 
 static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
index a9819ddb1ab85c70b6e80ec0efbdbaf3ca29c351..6315dd194228e45828ea769680f7637da7f26bff 100644 (file)
@@ -503,8 +503,8 @@ out_lock:
        return rc;
 }
 
-static int ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                         struct dentry *dentry, umode_t mode)
+static struct dentry *ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                    struct dentry *dentry, umode_t mode)
 {
        int rc;
        struct dentry *lower_dentry;
@@ -526,7 +526,7 @@ out:
        inode_unlock(lower_dir);
        if (d_really_is_negative(dentry))
                d_drop(dentry);
-       return rc;
+       return ERR_PTR(rc);
 }
 
 static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
index 691dd77b6ab5ff52da868dbe1e3840230aaec865..1660c9bbcfa918bb95665a3ba0c1cc0775b18b06 100644 (file)
@@ -835,8 +835,8 @@ unlock:
        return err;
 }
 
-static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct super_block *sb = dir->i_sb;
        struct inode *inode;
@@ -846,7 +846,7 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        loff_t size = i_size_read(dir);
 
        if (unlikely(exfat_forced_shutdown(sb)))
-               return -EIO;
+               return ERR_PTR(-EIO);
 
        mutex_lock(&EXFAT_SB(sb)->s_lock);
        exfat_set_volume_dirty(sb);
@@ -877,7 +877,7 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
 unlock:
        mutex_unlock(&EXFAT_SB(sb)->s_lock);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int exfat_check_dir_empty(struct super_block *sb,
index 8346ab9534c17ab62730bfebd03b23f0af9dd141..bde617a66cecd4a2bf12a713a2297bb4fee45916 100644 (file)
@@ -225,15 +225,16 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
        return err;
 }
 
-static int ext2_mkdir(struct mnt_idmap * idmap,
-       struct inode * dir, struct dentry * dentry, umode_t mode)
+static struct dentry *ext2_mkdir(struct mnt_idmap * idmap,
+                                struct inode * dir, struct dentry * dentry,
+                                umode_t mode)
 {
        struct inode * inode;
        int err;
 
        err = dquot_initialize(dir);
        if (err)
-               return err;
+               return ERR_PTR(err);
 
        inode_inc_link_count(dir);
 
@@ -258,7 +259,7 @@ static int ext2_mkdir(struct mnt_idmap * idmap,
 
        d_instantiate_new(dentry, inode);
 out:
-       return err;
+       return ERR_PTR(err);
 
 out_fail:
        inode_dec_link_count(inode);
index 536d56d150726501e49b3b69753817f22499cdef..716cc6096870117e383cd14470c6effa4ef3bcd8 100644 (file)
@@ -3004,19 +3004,19 @@ out:
        return err;
 }
 
-static int ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
        handle_t *handle;
        struct inode *inode;
        int err, err2 = 0, credits, retries = 0;
 
        if (EXT4_DIR_LINK_MAX(dir))
-               return -EMLINK;
+               return ERR_PTR(-EMLINK);
 
        err = dquot_initialize(dir);
        if (err)
-               return err;
+               return ERR_PTR(err);
 
        credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
                   EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
@@ -3066,7 +3066,7 @@ out_stop:
 out_retry:
        if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
                goto retry;
-       return err;
+       return ERR_PTR(err);
 }
 
 /*
index a278c7da81778295d46e9b41674e8155b1ff66a2..24dca4dc85a9d1b628d35d1a4e71ee280990a4dd 100644 (file)
@@ -684,23 +684,23 @@ out_free_encrypted_link:
        return err;
 }
 
-static int f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
        struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
        struct inode *inode;
        int err;
 
        if (unlikely(f2fs_cp_error(sbi)))
-               return -EIO;
+               return ERR_PTR(-EIO);
 
        err = f2fs_dquot_initialize(dir);
        if (err)
-               return err;
+               return ERR_PTR(err);
 
        inode = f2fs_new_inode(idmap, dir, S_IFDIR | mode, NULL);
        if (IS_ERR(inode))
-               return PTR_ERR(inode);
+               return ERR_CAST(inode);
 
        inode->i_op = &f2fs_dir_inode_operations;
        inode->i_fop = &f2fs_dir_operations;
@@ -722,12 +722,12 @@ static int f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
                f2fs_sync_fs(sbi->sb, 1);
 
        f2fs_balance_fs(sbi, true);
-       return 0;
+       return NULL;
 
 out_fail:
        clear_inode_flag(inode, FI_INC_LINK);
        f2fs_handle_failed_inode(inode);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
index f06f6ba643cc8c04dc4edc82500884f8bf144472..23e9b9371ec38ec54045d67ceb1d9056768126bb 100644 (file)
@@ -339,8 +339,8 @@ out:
 }
 
 /***** Make a directory */
-static int msdos_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *msdos_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct super_block *sb = dir->i_sb;
        struct fat_slot_info sinfo;
@@ -389,13 +389,13 @@ static int msdos_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        mutex_unlock(&MSDOS_SB(sb)->s_lock);
        fat_flush_inodes(sb, dir, inode);
-       return 0;
+       return NULL;
 
 out_free:
        fat_free_clusters(dir, cluster);
 out:
        mutex_unlock(&MSDOS_SB(sb)->s_lock);
-       return err;
+       return ERR_PTR(err);
 }
 
 /***** Unlink a file */
index 926c26e90ef8418075f033c740b49a34e0c62fe1..dd910edd2404db0be909ed702fd1292e1cc8deaf 100644 (file)
@@ -841,8 +841,8 @@ out:
        return err;
 }
 
-static int vfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *vfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct super_block *sb = dir->i_sb;
        struct inode *inode;
@@ -877,13 +877,13 @@ static int vfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        d_instantiate(dentry, inode);
 
        mutex_unlock(&MSDOS_SB(sb)->s_lock);
-       return 0;
+       return NULL;
 
 out_free:
        fat_free_clusters(dir, cluster);
 out:
        mutex_unlock(&MSDOS_SB(sb)->s_lock);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int vfat_get_dotdot_de(struct inode *inode, struct buffer_head **bh,
index 198862b086ff7bad4007ec2f3200377d12a78385..5bb65f38bfb810f45ab14469068b951ecde20b78 100644 (file)
@@ -898,8 +898,8 @@ static int fuse_tmpfile(struct mnt_idmap *idmap, struct inode *dir,
        return err;
 }
 
-static int fuse_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *entry, umode_t mode)
+static struct dentry *fuse_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *entry, umode_t mode)
 {
        struct fuse_mkdir_in inarg;
        struct fuse_mount *fm = get_fuse_mount(dir);
@@ -917,7 +917,7 @@ static int fuse_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        args.in_args[0].value = &inarg;
        args.in_args[1].size = entry->d_name.len + 1;
        args.in_args[1].value = entry->d_name.name;
-       return create_new_entry(idmap, fm, &args, dir, entry, S_IFDIR);
+       return ERR_PTR(create_new_entry(idmap, fm, &args, dir, entry, S_IFDIR));
 }
 
 static int fuse_symlink(struct mnt_idmap *idmap, struct inode *dir,
index 6fbbaaad1cd05623c09233cac6b24c9b135396ad..198a8cbaf5e5ad489a8dfc0494cbc6ff56b855cb 100644 (file)
@@ -1248,14 +1248,15 @@ static int gfs2_symlink(struct mnt_idmap *idmap, struct inode *dir,
  * @dentry: The dentry of the new directory
  * @mode: The mode of the new directory
  *
- * Returns: errno
+ * Returns: the dentry, or ERR_PTR(errno)
  */
 
-static int gfs2_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *gfs2_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
        unsigned dsize = gfs2_max_stuffed_size(GFS2_I(dir));
-       return gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0);
+
+       return ERR_PTR(gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0));
 }
 
 /**
index b75c26045df4927e6f99f80ae4677c08c71524cb..86a6b317b474a95f283f6a0908582efadde80892 100644 (file)
@@ -219,26 +219,26 @@ static int hfs_create(struct mnt_idmap *idmap, struct inode *dir,
  * in a directory, given the inode for the parent directory and the
  * name (and its length) of the new directory.
  */
-static int hfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                    struct dentry *dentry, umode_t mode)
+static struct dentry *hfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                               struct dentry *dentry, umode_t mode)
 {
        struct inode *inode;
        int res;
 
        inode = hfs_new_inode(dir, &dentry->d_name, S_IFDIR | mode);
        if (!inode)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
        res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode);
        if (res) {
                clear_nlink(inode);
                hfs_delete_inode(inode);
                iput(inode);
-               return res;
+               return ERR_PTR(res);
        }
        d_instantiate(dentry, inode);
        mark_inode_dirty(inode);
-       return 0;
+       return NULL;
 }
 
 /*
index f5c4b3e31a1c2a11c7ea46ce069250249ab7338f..876bbb80fb4dce1a9dc290788d53e3d1c65e7701 100644 (file)
@@ -523,10 +523,10 @@ static int hfsplus_create(struct mnt_idmap *idmap, struct inode *dir,
        return hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode, 0);
 }
 
-static int hfsplus_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                        struct dentry *dentry, umode_t mode)
+static struct dentry *hfsplus_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                   struct dentry *dentry, umode_t mode)
 {
-       return hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
+       return ERR_PTR(hfsplus_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0));
 }
 
 static int hfsplus_rename(struct mnt_idmap *idmap,
index e0741e468956dda545224ebe9cc0de8a73ecadbb..ccbb48fe830dd5da35ca39baaadd3b1a0606a39b 100644 (file)
@@ -679,17 +679,17 @@ static int hostfs_symlink(struct mnt_idmap *idmap, struct inode *ino,
        return err;
 }
 
-static int hostfs_mkdir(struct mnt_idmap *idmap, struct inode *ino,
-                       struct dentry *dentry, umode_t mode)
+static struct dentry *hostfs_mkdir(struct mnt_idmap *idmap, struct inode *ino,
+                                  struct dentry *dentry, umode_t mode)
 {
        char *file;
        int err;
 
        if ((file = dentry_name(dentry)) == NULL)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
        err = do_mkdir(file, mode);
        __putname(file);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int hostfs_rmdir(struct inode *ino, struct dentry *dentry)
index d0edf9ed33b6058f9c39605a6a0a28fb6f844600..e3cdc421dfba7e365dd0f1c99e6732a9c3a5c3f9 100644 (file)
@@ -19,8 +19,8 @@ static void hpfs_update_directory_times(struct inode *dir)
        hpfs_write_inode_nolock(dir);
 }
 
-static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
        const unsigned char *name = dentry->d_name.name;
        unsigned len = dentry->d_name.len;
@@ -35,7 +35,7 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        int r;
        struct hpfs_dirent dee;
        int err;
-       if ((err = hpfs_chk_name(name, &len))) return err==-ENOENT ? -EINVAL : err;
+       if ((err = hpfs_chk_name(name, &len))) return ERR_PTR(err==-ENOENT ? -EINVAL : err);
        hpfs_lock(dir->i_sb);
        err = -ENOSPC;
        fnode = hpfs_alloc_fnode(dir->i_sb, hpfs_i(dir)->i_dno, &fno, &bh);
@@ -112,7 +112,7 @@ static int hpfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        hpfs_update_directory_times(dir);
        d_instantiate(dentry, result);
        hpfs_unlock(dir->i_sb);
-       return 0;
+       return NULL;
 bail3:
        iput(result);
 bail2:
@@ -123,7 +123,7 @@ bail1:
        hpfs_free_sectors(dir->i_sb, fno, 1);
 bail:
        hpfs_unlock(dir->i_sb);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int hpfs_create(struct mnt_idmap *idmap, struct inode *dir,
index 0fc179a598300c6a24edaa7633bbf9b9a2d7bee2..d98caedbb7232f5525be54b47e974ebc7c07d479 100644 (file)
@@ -991,14 +991,14 @@ static int hugetlbfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
        return 0;
 }
 
-static int hugetlbfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                          struct dentry *dentry, umode_t mode)
+static struct dentry *hugetlbfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                     struct dentry *dentry, umode_t mode)
 {
        int retval = hugetlbfs_mknod(idmap, dir, dentry,
                                     mode | S_IFDIR, 0);
        if (!retval)
                inc_nlink(dir);
-       return retval;
+       return ERR_PTR(retval);
 }
 
 static int hugetlbfs_create(struct mnt_idmap *idmap,
index 2b2938970da344f78e5235a5828b3b1f2f7e7cad..dd91f725ded69ccb3a240aafd72a4b552f21bcd9 100644 (file)
@@ -32,8 +32,8 @@ static int jffs2_link (struct dentry *,struct inode *,struct dentry *);
 static int jffs2_unlink (struct inode *,struct dentry *);
 static int jffs2_symlink (struct mnt_idmap *, struct inode *,
                          struct dentry *, const char *);
-static int jffs2_mkdir (struct mnt_idmap *, struct inode *,struct dentry *,
-                       umode_t);
+static struct dentry *jffs2_mkdir (struct mnt_idmap *, struct inode *,struct dentry *,
+                                  umode_t);
 static int jffs2_rmdir (struct inode *,struct dentry *);
 static int jffs2_mknod (struct mnt_idmap *, struct inode *,struct dentry *,
                        umode_t,dev_t);
@@ -446,8 +446,8 @@ static int jffs2_symlink (struct mnt_idmap *idmap, struct inode *dir_i,
 }
 
 
-static int jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
-                       struct dentry *dentry, umode_t mode)
+static struct dentry *jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
+                                  struct dentry *dentry, umode_t mode)
 {
        struct jffs2_inode_info *f, *dir_f;
        struct jffs2_sb_info *c;
@@ -464,7 +464,7 @@ static int jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
 
        ri = jffs2_alloc_raw_inode();
        if (!ri)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
        c = JFFS2_SB_INFO(dir_i->i_sb);
 
@@ -477,7 +477,7 @@ static int jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
 
        if (ret) {
                jffs2_free_raw_inode(ri);
-               return ret;
+               return ERR_PTR(ret);
        }
 
        inode = jffs2_new_inode(dir_i, mode, ri);
@@ -485,7 +485,7 @@ static int jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
        if (IS_ERR(inode)) {
                jffs2_free_raw_inode(ri);
                jffs2_complete_reservation(c);
-               return PTR_ERR(inode);
+               return ERR_CAST(inode);
        }
 
        inode->i_op = &jffs2_dir_inode_operations;
@@ -584,11 +584,11 @@ static int jffs2_mkdir (struct mnt_idmap *idmap, struct inode *dir_i,
        jffs2_complete_reservation(c);
 
        d_instantiate_new(dentry, inode);
-       return 0;
+       return NULL;
 
  fail:
        iget_failed(inode);
-       return ret;
+       return ERR_PTR(ret);
 }
 
 static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry)
index fc8ede43afde8ef5ad080e7e607660f9df85a9cc..65a218eba8faf9508f5727515b812f6de2661618 100644 (file)
@@ -187,13 +187,13 @@ static int jfs_create(struct mnt_idmap *idmap, struct inode *dip,
  *             dentry  - dentry of child directory
  *             mode    - create mode (rwxrwxrwx).
  *
- * RETURN:     Errors from subroutines
+ * RETURN:     ERR_PTR() of errors from subroutines.
  *
  * note:
  * EACCES: user needs search+write permission on the parent directory
  */
-static int jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip,
-                    struct dentry *dentry, umode_t mode)
+static struct dentry *jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip,
+                               struct dentry *dentry, umode_t mode)
 {
        int rc = 0;
        tid_t tid;              /* transaction id */
@@ -308,7 +308,7 @@ static int jfs_mkdir(struct mnt_idmap *idmap, struct inode *dip,
       out1:
 
        jfs_info("jfs_mkdir: rc:%d", rc);
-       return rc;
+       return ERR_PTR(rc);
 }
 
 /*
index 5f0f8b95f44c0caef3397010b21637e0fbfa1a38..d296aad708001cb87a8b9e0804804593a69e62ee 100644 (file)
@@ -1230,24 +1230,24 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir,
        return d_splice_alias(inode, dentry);
 }
 
-static int kernfs_iop_mkdir(struct mnt_idmap *idmap,
-                           struct inode *dir, struct dentry *dentry,
-                           umode_t mode)
+static struct dentry *kernfs_iop_mkdir(struct mnt_idmap *idmap,
+                                      struct inode *dir, struct dentry *dentry,
+                                      umode_t mode)
 {
        struct kernfs_node *parent = dir->i_private;
        struct kernfs_syscall_ops *scops = kernfs_root(parent)->syscall_ops;
        int ret;
 
        if (!scops || !scops->mkdir)
-               return -EPERM;
+               return ERR_PTR(-EPERM);
 
        if (!kernfs_get_active(parent))
-               return -ENODEV;
+               return ERR_PTR(-ENODEV);
 
        ret = scops->mkdir(parent, dentry->d_name.name, mode);
 
        kernfs_put_active(parent);
-       return ret;
+       return ERR_PTR(ret);
 }
 
 static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry)
index 5d9c1406fe272cff0ee6fbe616eaa93210f2f0ba..8938536d8d3cf65c7e57f88f1819689365951fea 100644 (file)
@@ -104,15 +104,15 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
        return add_nondir(dentry, inode);
 }
 
-static int minix_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *minix_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct inode * inode;
        int err;
 
        inode = minix_new_inode(dir, S_IFDIR | mode);
        if (IS_ERR(inode))
-               return PTR_ERR(inode);
+               return ERR_CAST(inode);
 
        inode_inc_link_count(dir);
        minix_set_inode(inode, 0);
@@ -128,7 +128,7 @@ static int minix_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        d_instantiate(dentry, inode);
 out:
-       return err;
+       return ERR_PTR(err);
 
 out_fail:
        inode_dec_link_count(inode);
index b7cdca90280305d2cd209e0ac86cf2d0b38301c6..48880fc38d1b000cb1fa8b85d865fc766a8390e4 100644 (file)
@@ -4293,6 +4293,7 @@ int vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 {
        int error;
        unsigned max_links = dir->i_sb->s_max_links;
+       struct dentry *de;
 
        error = may_create(idmap, dir, dentry);
        if (error)
@@ -4309,10 +4310,18 @@ int vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        if (max_links && dir->i_nlink >= max_links)
                return -EMLINK;
 
-       error = dir->i_op->mkdir(idmap, dir, dentry, mode);
-       if (!error)
+       de = dir->i_op->mkdir(idmap, dir, dentry, mode);
+       if (IS_ERR(de))
+               return PTR_ERR(de);
+       if (de) {
+               fsnotify_mkdir(dir, de);
+               /* Cannot return de yet */
+               dput(de);
+       } else {
                fsnotify_mkdir(dir, dentry);
-       return error;
+       }
+
+       return 0;
 }
 EXPORT_SYMBOL(vfs_mkdir);
 
index 56cf16a7233483bd424415917acb9bb724c93b07..101b1098e87b6ef6cd26939451898ac2b7dccca8 100644 (file)
@@ -2422,8 +2422,8 @@ EXPORT_SYMBOL_GPL(nfs_mknod);
 /*
  * See comments for nfs_proc_create regarding failed operations.
  */
-int nfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-             struct dentry *dentry, umode_t mode)
+struct dentry *nfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                        struct dentry *dentry, umode_t mode)
 {
        struct iattr attr;
        int error;
@@ -2439,10 +2439,10 @@ int nfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        trace_nfs_mkdir_exit(dir, dentry, error);
        if (error != 0)
                goto out_err;
-       return 0;
+       return NULL;
 out_err:
        d_drop(dentry);
-       return error;
+       return ERR_PTR(error);
 }
 EXPORT_SYMBOL_GPL(nfs_mkdir);
 
index fae2c7ae4acc286e1c5ad2b2225b1e9a6930b56b..1ac1d3eec5179527da42fe1892e6f727ce49dd64 100644 (file)
@@ -400,8 +400,8 @@ struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int);
 void nfs_d_prune_case_insensitive_aliases(struct inode *inode);
 int nfs_create(struct mnt_idmap *, struct inode *, struct dentry *,
               umode_t, bool);
-int nfs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
-             umode_t);
+struct dentry *nfs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
+                        umode_t);
 int nfs_rmdir(struct inode *, struct dentry *);
 int nfs_unlink(struct inode *, struct dentry *);
 int nfs_symlink(struct mnt_idmap *, struct inode *, struct dentry *,
index 953fbd5f08519cee2898e5d8037b714fa97ea628..40f4b1a28705b6e0eb8f0978cf3ac18b43aa1331 100644 (file)
@@ -218,8 +218,8 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
        return err;
 }
 
-static int nilfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *nilfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct inode *inode;
        struct nilfs_transaction_info ti;
@@ -227,7 +227,7 @@ static int nilfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        err = nilfs_transaction_begin(dir->i_sb, &ti, 1);
        if (err)
-               return err;
+               return ERR_PTR(err);
 
        inc_nlink(dir);
 
@@ -258,7 +258,7 @@ out:
        else
                nilfs_transaction_abort(dir->i_sb);
 
-       return err;
+       return ERR_PTR(err);
 
 out_fail:
        drop_nlink(inode);
index abf7e81584a9b27e1d7c193ffdfab04417e9e75b..652735a0b0c498ef9c75a2895f456fc2ea0743d7 100644 (file)
@@ -201,11 +201,11 @@ static int ntfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
 /*
  * ntfs_mkdir- inode_operations::mkdir
  */
-static int ntfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *ntfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
-       return ntfs_create_inode(idmap, dir, dentry, NULL, S_IFDIR | mode, 0,
-                                NULL, 0, NULL);
+       return ERR_PTR(ntfs_create_inode(idmap, dir, dentry, NULL, S_IFDIR | mode, 0,
+                                        NULL, 0, NULL));
 }
 
 /*
index 2a7f36643895bced4a2a0014f3f31c89ab8f9050..5130ec44e5e158913f09f8d6bf1a01edd4e9df8c 100644 (file)
@@ -402,10 +402,10 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
  * File creation. Allocate an inode, and we're done..
  */
 /* SMP-safe */
-static int dlmfs_mkdir(struct mnt_idmap * idmap,
-                      struct inode * dir,
-                      struct dentry * dentry,
-                      umode_t mode)
+static struct dentry *dlmfs_mkdir(struct mnt_idmap * idmap,
+                                 struct inode * dir,
+                                 struct dentry * dentry,
+                                 umode_t mode)
 {
        int status;
        struct inode *inode = NULL;
@@ -448,7 +448,7 @@ static int dlmfs_mkdir(struct mnt_idmap * idmap,
 bail:
        if (status < 0)
                iput(inode);
-       return status;
+       return ERR_PTR(status);
 }
 
 static int dlmfs_create(struct mnt_idmap *idmap,
index 0ec63a1a94b873c52f222235d9ee83a22281a564..99278c8f0e242a0ab1f37a69af4c34d3b09928cc 100644 (file)
@@ -644,10 +644,10 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
                                    suballoc_loc, suballoc_bit);
 }
 
-static int ocfs2_mkdir(struct mnt_idmap *idmap,
-                      struct inode *dir,
-                      struct dentry *dentry,
-                      umode_t mode)
+static struct dentry *ocfs2_mkdir(struct mnt_idmap *idmap,
+                                 struct inode *dir,
+                                 struct dentry *dentry,
+                                 umode_t mode)
 {
        int ret;
 
@@ -657,7 +657,7 @@ static int ocfs2_mkdir(struct mnt_idmap *idmap,
        if (ret)
                mlog_errno(ret);
 
-       return ret;
+       return ERR_PTR(ret);
 }
 
 static int ocfs2_create(struct mnt_idmap *idmap,
index 6bda275826d6bc1c561028a6baeba76bec2971e9..2ed541fccf331d796805dd1594fbf05c1f7f3b9a 100644 (file)
@@ -279,10 +279,10 @@ out_free_inode:
        return err;
 }
 
-static int omfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *omfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
-       return omfs_add_node(dir, dentry, mode | S_IFDIR);
+       return ERR_PTR(omfs_add_node(dir, dentry, mode | S_IFDIR));
 }
 
 static int omfs_create(struct mnt_idmap *idmap, struct inode *dir,
index 200558ec72f086c36ab53567b0fc7ea93f2e9675..82395fe2b9562a7ec2d60930f07e56f0837383ba 100644 (file)
@@ -300,8 +300,8 @@ out:
        return ret;
 }
 
-static int orangefs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                         struct dentry *dentry, umode_t mode)
+static struct dentry *orangefs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                    struct dentry *dentry, umode_t mode)
 {
        struct orangefs_inode_s *parent = ORANGEFS_I(dir);
        struct orangefs_kernel_op_s *new_op;
@@ -312,7 +312,7 @@ static int orangefs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        new_op = op_alloc(ORANGEFS_VFS_OP_MKDIR);
        if (!new_op)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
        new_op->upcall.req.mkdir.parent_refn = parent->refn;
 
@@ -366,7 +366,7 @@ static int orangefs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        __orangefs_setattr(dir, &iattr);
 out:
        op_release(new_op);
-       return ret;
+       return ERR_PTR(ret);
 }
 
 static int orangefs_rename(struct mnt_idmap *idmap,
index c9993ff66fc26ec45ab5a5b4679d1d2056a01df2..21c3aaf7b2744a7818c92864e9dc87135ca8ee63 100644 (file)
@@ -282,7 +282,8 @@ static int ovl_instantiate(struct dentry *dentry, struct inode *inode,
                 * XXX: if we ever use ovl_obtain_alias() to decode directory
                 * file handles, need to use ovl_get_inode_locked() and
                 * d_instantiate_new() here to prevent from creating two
-                * hashed directory inode aliases.
+                * hashed directory inode aliases.  We then need to return
+                * the obtained alias to ovl_mkdir().
                 */
                inode = ovl_get_inode(dentry->d_sb, &oip);
                if (IS_ERR(inode))
@@ -687,10 +688,10 @@ static int ovl_create(struct mnt_idmap *idmap, struct inode *dir,
        return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL);
 }
 
-static int ovl_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                    struct dentry *dentry, umode_t mode)
+static struct dentry *ovl_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                               struct dentry *dentry, umode_t mode)
 {
-       return ovl_create_object(dentry, (mode & 07777) | S_IFDIR, 0, NULL);
+       return ERR_PTR(ovl_create_object(dentry, (mode & 07777) | S_IFDIR, 0, NULL));
 }
 
 static int ovl_mknod(struct mnt_idmap *idmap, struct inode *dir,
index 8006faaaf0ec7d99fb7e49b2e677a07325c68a43..775fa905fda00964290a2b9a6199eebdaaf889b7 100644 (file)
@@ -119,13 +119,13 @@ out:
        return error;
 }
 
-static int ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *ramfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
        int retval = ramfs_mknod(&nop_mnt_idmap, dir, dentry, mode | S_IFDIR, 0);
        if (!retval)
                inc_nlink(dir);
-       return retval;
+       return ERR_PTR(retval);
 }
 
 static int ramfs_create(struct mnt_idmap *idmap, struct inode *dir,
index 831fee962c4d6b581c9d0faaeb093fbef046e303..8dea0cf3a8dec905fde86439c5f68e87c9d1da71 100644 (file)
@@ -59,8 +59,8 @@ extern int cifs_unlink(struct inode *dir, struct dentry *dentry);
 extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *);
 extern int cifs_mknod(struct mnt_idmap *, struct inode *, struct dentry *,
                      umode_t, dev_t);
-extern int cifs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
-                     umode_t);
+extern struct dentry *cifs_mkdir(struct mnt_idmap *, struct inode *, struct dentry *,
+                                umode_t);
 extern int cifs_rmdir(struct inode *, struct dentry *);
 extern int cifs_rename2(struct mnt_idmap *, struct inode *,
                        struct dentry *, struct inode *, struct dentry *,
index 616149c7f0a5411a2433b6e62a418a652b0aadc8..3bb21aa584742d9ecf41dccc3c5b5a29602b2655 100644 (file)
@@ -2207,8 +2207,8 @@ posix_mkdir_get_info:
 }
 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
 
-int cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
-              struct dentry *direntry, umode_t mode)
+struct dentry *cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
+                         struct dentry *direntry, umode_t mode)
 {
        int rc = 0;
        unsigned int xid;
@@ -2224,10 +2224,10 @@ int cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
 
        cifs_sb = CIFS_SB(inode->i_sb);
        if (unlikely(cifs_forced_shutdown(cifs_sb)))
-               return -EIO;
+               return ERR_PTR(-EIO);
        tlink = cifs_sb_tlink(cifs_sb);
        if (IS_ERR(tlink))
-               return PTR_ERR(tlink);
+               return ERR_CAST(tlink);
        tcon = tlink_tcon(tlink);
 
        xid = get_xid();
@@ -2283,7 +2283,7 @@ mkdir_out:
        free_dentry_path(page);
        free_xid(xid);
        cifs_put_tlink(tlink);
-       return rc;
+       return ERR_PTR(rc);
 }
 
 int cifs_rmdir(struct inode *inode, struct dentry *direntry)
index fb8bd84378722d9b8493f9a86a0f2b8ff3f7eb8d..ec02378bb361bab052a5d96ea928c3e614f86f29 100644 (file)
@@ -110,8 +110,8 @@ static int sysv_link(struct dentry * old_dentry, struct inode * dir,
        return add_nondir(dentry, inode);
 }
 
-static int sysv_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                     struct dentry *dentry, umode_t mode)
+static struct dentry *sysv_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                struct dentry *dentry, umode_t mode)
 {
        struct inode * inode;
        int err;
@@ -137,7 +137,7 @@ static int sysv_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
         d_instantiate(dentry, inode);
 out:
-       return err;
+       return ERR_PTR(err);
 
 out_fail:
        inode_dec_link_count(inode);
index 53214499e384b14dfbf75b7de07def6f3b242dbc..cb1af30b49f5803eb9a2ef04884b052232766e1f 100644 (file)
@@ -109,9 +109,9 @@ static char *get_dname(struct dentry *dentry)
        return name;
 }
 
-static int tracefs_syscall_mkdir(struct mnt_idmap *idmap,
-                                struct inode *inode, struct dentry *dentry,
-                                umode_t mode)
+static struct dentry *tracefs_syscall_mkdir(struct mnt_idmap *idmap,
+                                           struct inode *inode, struct dentry *dentry,
+                                           umode_t mode)
 {
        struct tracefs_inode *ti;
        char *name;
@@ -119,7 +119,7 @@ static int tracefs_syscall_mkdir(struct mnt_idmap *idmap,
 
        name = get_dname(dentry);
        if (!name)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
        /*
         * This is a new directory that does not take the default of
@@ -141,7 +141,7 @@ static int tracefs_syscall_mkdir(struct mnt_idmap *idmap,
 
        kfree(name);
 
-       return ret;
+       return ERR_PTR(ret);
 }
 
 static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentry)
index fda82f3e16e8c04c0c8fd7bf6f315f2d5e6ddcd3..3c3d3ad4fa6cb719e9ec08fa2164c55371c017c1 100644 (file)
@@ -1002,8 +1002,8 @@ out_fname:
        return err;
 }
 
-static int ubifs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *ubifs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct inode *inode;
        struct ubifs_inode *dir_ui = ubifs_inode(dir);
@@ -1023,7 +1023,7 @@ static int ubifs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        err = ubifs_budget_space(c, &req);
        if (err)
-               return err;
+               return ERR_PTR(err);
 
        err = ubifs_prepare_create(dir, dentry, &nm);
        if (err)
@@ -1060,7 +1060,7 @@ static int ubifs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        ubifs_release_budget(c, &req);
        d_instantiate(dentry, inode);
        fscrypt_free_filename(&nm);
-       return 0;
+       return NULL;
 
 out_cancel:
        dir->i_size -= sz_change;
@@ -1074,7 +1074,7 @@ out_fname:
        fscrypt_free_filename(&nm);
 out_budg:
        ubifs_release_budget(c, &req);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int ubifs_mknod(struct mnt_idmap *idmap, struct inode *dir,
index 2cb49b6b07168a8195ce10391546c2e8bc110983..5f2e9a892bffa9579143cedf71d80efa7ad6e9fb 100644 (file)
@@ -419,8 +419,8 @@ static int udf_mknod(struct mnt_idmap *idmap, struct inode *dir,
        return udf_add_nondir(dentry, inode);
 }
 
-static int udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                    struct dentry *dentry, umode_t mode)
+static struct dentry *udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                               struct dentry *dentry, umode_t mode)
 {
        struct inode *inode;
        struct udf_fileident_iter iter;
@@ -430,7 +430,7 @@ static int udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 
        inode = udf_new_inode(dir, S_IFDIR | mode);
        if (IS_ERR(inode))
-               return PTR_ERR(inode);
+               return ERR_CAST(inode);
 
        iinfo = UDF_I(inode);
        inode->i_op = &udf_dir_inode_operations;
@@ -439,7 +439,7 @@ static int udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        if (err) {
                clear_nlink(inode);
                discard_new_inode(inode);
-               return err;
+               return ERR_PTR(err);
        }
        set_nlink(inode, 2);
        iter.fi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
@@ -456,7 +456,7 @@ static int udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        if (err) {
                clear_nlink(inode);
                discard_new_inode(inode);
-               return err;
+               return ERR_PTR(err);
        }
        iter.fi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
        iter.fi.icb.extLocation = cpu_to_lelb(iinfo->i_location);
@@ -471,7 +471,7 @@ static int udf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        mark_inode_dirty(dir);
        d_instantiate_new(dentry, inode);
 
-       return 0;
+       return NULL;
 }
 
 static int empty_dir(struct inode *dir)
index 38a024c8cccddc450ac95c633abeb9cc7f29a6a4..5b3c85c9324298f4ff6aa3d4feeb962ce5ede539 100644 (file)
@@ -166,8 +166,8 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
        return error;
 }
 
-static int ufs_mkdir(struct mnt_idmap * idmap, struct inode * dir,
-       struct dentry * dentry, umode_t mode)
+static struct dentry *ufs_mkdir(struct mnt_idmap * idmap, struct inode * dir,
+                               struct dentry * dentry, umode_t mode)
 {
        struct inode * inode;
        int err;
@@ -194,7 +194,7 @@ static int ufs_mkdir(struct mnt_idmap * idmap, struct inode * dir,
                goto out_fail;
 
        d_instantiate_new(dentry, inode);
-       return 0;
+       return NULL;
 
 out_fail:
        inode_dec_link_count(inode);
@@ -202,7 +202,7 @@ out_fail:
        discard_new_inode(inode);
 out_dir:
        inode_dec_link_count(dir);
-       return err;
+       return ERR_PTR(err);
 }
 
 static int ufs_unlink(struct inode *dir, struct dentry *dentry)
index a859ac9b74ba0acea641b73131c51e623bca36ca..770e29ec35575c938bfdbcf0feeb13c993099e30 100644 (file)
@@ -303,11 +303,11 @@ static int vboxsf_dir_mkfile(struct mnt_idmap *idmap,
        return vboxsf_dir_create(parent, dentry, mode, false, excl, NULL);
 }
 
-static int vboxsf_dir_mkdir(struct mnt_idmap *idmap,
-                           struct inode *parent, struct dentry *dentry,
-                           umode_t mode)
+static struct dentry *vboxsf_dir_mkdir(struct mnt_idmap *idmap,
+                                      struct inode *parent, struct dentry *dentry,
+                                      umode_t mode)
 {
-       return vboxsf_dir_create(parent, dentry, mode, true, true, NULL);
+       return ERR_PTR(vboxsf_dir_create(parent, dentry, mode, true, true, NULL));
 }
 
 static int vboxsf_dir_atomic_open(struct inode *parent, struct dentry *dentry,
index 40289fe6f5b2b408186fb4d3e7e8fa44692911cf..a4480098d2bf5b6681a71cb4a6c68fa8a2a6bb9b 100644 (file)
@@ -298,14 +298,14 @@ xfs_vn_create(
        return xfs_generic_create(idmap, dir, dentry, mode, 0, NULL);
 }
 
-STATIC int
+STATIC struct dentry *
 xfs_vn_mkdir(
        struct mnt_idmap        *idmap,
        struct inode            *dir,
        struct dentry           *dentry,
        umode_t                 mode)
 {
-       return xfs_generic_create(idmap, dir, dentry, mode | S_IFDIR, 0, NULL);
+       return ERR_PTR(xfs_generic_create(idmap, dir, dentry, mode | S_IFDIR, 0, NULL));
 }
 
 STATIC struct dentry *
index 2c3b2f8a621f76a08706df94c2b90540f7369568..45269608ee2387c5a80565d11bb7a113274eef5f 100644 (file)
@@ -2211,8 +2211,8 @@ struct inode_operations {
        int (*unlink) (struct inode *,struct dentry *);
        int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,
                        const char *);
-       int (*mkdir) (struct mnt_idmap *, struct inode *,struct dentry *,
-                     umode_t);
+       struct dentry *(*mkdir) (struct mnt_idmap *, struct inode *,
+                                struct dentry *, umode_t);
        int (*rmdir) (struct inode *,struct dentry *);
        int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,
                      umode_t,dev_t);
index 9aaf5124648bdabedd3b775c6d4bca9d27f5f4d4..dc3aa91a6ba03105bf97a43637650eda5b1a35ce 100644 (file)
@@ -150,14 +150,14 @@ static void bpf_dentry_finalize(struct dentry *dentry, struct inode *inode,
        inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
 }
 
-static int bpf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                    struct dentry *dentry, umode_t mode)
+static struct dentry *bpf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                               struct dentry *dentry, umode_t mode)
 {
        struct inode *inode;
 
        inode = bpf_get_inode(dir->i_sb, dir, mode | S_IFDIR);
        if (IS_ERR(inode))
-               return PTR_ERR(inode);
+               return ERR_CAST(inode);
 
        inode->i_op = &bpf_dir_iops;
        inode->i_fop = &simple_dir_operations;
@@ -166,7 +166,7 @@ static int bpf_mkdir(struct mnt_idmap *idmap, struct inode *dir,
        inc_nlink(dir);
 
        bpf_dentry_finalize(dentry, inode, dir);
-       return 0;
+       return NULL;
 }
 
 struct map_iter {
index 4ea6109a80431e5eeae15278064d5c86412f9fc9..00ae0146e768785f607865225f635b61ffe137b2 100644 (file)
@@ -3889,16 +3889,16 @@ out_iput:
        return error;
 }
 
-static int shmem_mkdir(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *shmem_mkdir(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        int error;
 
        error = shmem_mknod(idmap, dir, dentry, mode | S_IFDIR, 0);
        if (error)
-               return error;
+               return ERR_PTR(error);
        inc_nlink(dir);
-       return 0;
+       return NULL;
 }
 
 static int shmem_create(struct mnt_idmap *idmap, struct inode *dir,
index c07d150685d7c784e26b1ba42e6fbe946bb5bedb..6039afae4bfc9bd6b135cc8be561bd9b4a842ad8 100644 (file)
@@ -1795,8 +1795,8 @@ fail2:
        return error;
 }
 
-static int ns_mkdir_op(struct mnt_idmap *idmap, struct inode *dir,
-                      struct dentry *dentry, umode_t mode)
+static struct dentry *ns_mkdir_op(struct mnt_idmap *idmap, struct inode *dir,
+                                 struct dentry *dentry, umode_t mode)
 {
        struct aa_ns *ns, *parent;
        /* TODO: improve permission check */
@@ -1808,7 +1808,7 @@ static int ns_mkdir_op(struct mnt_idmap *idmap, struct inode *dir,
                                     AA_MAY_LOAD_POLICY);
        end_current_label_crit_section(label);
        if (error)
-               return error;
+               return ERR_PTR(error);
 
        parent = aa_get_ns(dir->i_private);
        AA_BUG(d_inode(ns_subns_dir(parent)) != dir);
@@ -1843,7 +1843,7 @@ out:
        mutex_unlock(&parent->lock);
        aa_put_ns(parent);
 
-       return error;
+       return ERR_PTR(error);
 }
 
 static int ns_rmdir_op(struct inode *dir, struct dentry *dentry)