mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Change inode_operations.mkdir to return struct dentry *
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>
This commit is contained in:
@@ -66,7 +66,7 @@ prototypes::
|
|||||||
int (*link) (struct dentry *,struct inode *,struct dentry *);
|
int (*link) (struct dentry *,struct inode *,struct dentry *);
|
||||||
int (*unlink) (struct inode *,struct dentry *);
|
int (*unlink) (struct inode *,struct dentry *);
|
||||||
int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
|
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 (*rmdir) (struct inode *,struct dentry *);
|
||||||
int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
|
int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
|
||||||
int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
|
int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
|
|||||||
@@ -1178,3 +1178,22 @@ these conditions don't require explicit checks:
|
|||||||
|
|
||||||
LOOKUP_EXCL now means "target must not exist". It can be combined with
|
LOOKUP_EXCL now means "target must not exist". It can be combined with
|
||||||
LOOK_CREATE or LOOKUP_RENAME_TARGET.
|
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.
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ As of kernel 2.6.22, the following members are defined:
|
|||||||
int (*link) (struct dentry *,struct inode *,struct dentry *);
|
int (*link) (struct dentry *,struct inode *,struct dentry *);
|
||||||
int (*unlink) (struct inode *,struct dentry *);
|
int (*unlink) (struct inode *,struct dentry *);
|
||||||
int (*symlink) (struct mnt_idmap *, struct inode *,struct dentry *,const char *);
|
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 (*rmdir) (struct inode *,struct dentry *);
|
||||||
int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
|
int (*mknod) (struct mnt_idmap *, struct inode *,struct dentry *,umode_t,dev_t);
|
||||||
int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
|
int (*rename) (struct mnt_idmap *, struct inode *, struct dentry *,
|
||||||
@@ -562,7 +562,26 @@ otherwise noted.
|
|||||||
``mkdir``
|
``mkdir``
|
||||||
called by the mkdir(2) system call. Only required if you want
|
called by the mkdir(2) system call. Only required if you want
|
||||||
to support creating subdirectories. You will probably need to
|
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``
|
``rmdir``
|
||||||
called by the rmdir(2) system call. Only required if you want
|
called by the rmdir(2) system call. Only required if you want
|
||||||
|
|||||||
+3
-4
@@ -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,
|
static struct dentry *v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
u32 perm;
|
u32 perm;
|
||||||
@@ -692,8 +692,7 @@ static int v9fs_vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
|||||||
|
|
||||||
if (fid)
|
if (fid)
|
||||||
p9_fid_put(fid);
|
p9_fid_put(fid);
|
||||||
|
return ERR_PTR(err);
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -350,9 +350,9 @@ out:
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
|
static struct dentry *v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,
|
||||||
struct inode *dir, struct dentry *dentry,
|
struct inode *dir, struct dentry *dentry,
|
||||||
umode_t omode)
|
umode_t omode)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct v9fs_session_info *v9ses;
|
struct v9fs_session_info *v9ses;
|
||||||
@@ -417,7 +417,7 @@ error:
|
|||||||
p9_fid_put(fid);
|
p9_fid_put(fid);
|
||||||
v9fs_put_acl(dacl, pacl);
|
v9fs_put_acl(dacl, pacl);
|
||||||
p9_fid_put(dfid);
|
p9_fid_put(dfid);
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
+1
-1
@@ -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_unlink(struct inode *dir, struct dentry *dentry);
|
||||||
extern int affs_create(struct mnt_idmap *idmap, struct inode *dir,
|
extern int affs_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode, bool);
|
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);
|
struct dentry *dentry, umode_t mode);
|
||||||
extern int affs_rmdir(struct inode *dir, struct dentry *dentry);
|
extern int affs_rmdir(struct inode *dir, struct dentry *dentry);
|
||||||
extern int affs_link(struct dentry *olddentry, struct inode *dir,
|
extern int affs_link(struct dentry *olddentry, struct inode *dir,
|
||||||
|
|||||||
+4
-4
@@ -273,7 +273,7 @@ affs_create(struct mnt_idmap *idmap, struct inode *dir,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
struct dentry *
|
||||||
affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
@@ -285,7 +285,7 @@ affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
|||||||
|
|
||||||
inode = affs_new_inode(dir);
|
inode = affs_new_inode(dir);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return -ENOSPC;
|
return ERR_PTR(-ENOSPC);
|
||||||
|
|
||||||
inode->i_mode = S_IFDIR | mode;
|
inode->i_mode = S_IFDIR | mode;
|
||||||
affs_mode_to_prot(inode);
|
affs_mode_to_prot(inode);
|
||||||
@@ -298,9 +298,9 @@ affs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
|||||||
clear_nlink(inode);
|
clear_nlink(inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
iput(inode);
|
iput(inode);
|
||||||
return error;
|
return ERR_PTR(error);
|
||||||
}
|
}
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
+6
-6
@@ -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);
|
loff_t fpos, u64 ino, unsigned dtype);
|
||||||
static int afs_create(struct mnt_idmap *idmap, struct inode *dir,
|
static int afs_create(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode, bool excl);
|
struct dentry *dentry, umode_t mode, bool excl);
|
||||||
static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode);
|
struct dentry *dentry, umode_t mode);
|
||||||
static int afs_rmdir(struct inode *dir, struct dentry *dentry);
|
static int afs_rmdir(struct inode *dir, struct dentry *dentry);
|
||||||
static int afs_unlink(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,
|
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
|
* create a directory on an AFS filesystem
|
||||||
*/
|
*/
|
||||||
static int afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *afs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
struct afs_operation *op;
|
struct afs_operation *op;
|
||||||
struct afs_vnode *dvnode = AFS_FS_I(dir);
|
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);
|
op = afs_alloc_operation(NULL, dvnode->volume);
|
||||||
if (IS_ERR(op)) {
|
if (IS_ERR(op)) {
|
||||||
d_drop(dentry);
|
d_drop(dentry);
|
||||||
return PTR_ERR(op);
|
return ERR_CAST(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
fscache_use_cookie(afs_vnode_cache(dvnode), true);
|
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;
|
op->ops = &afs_mkdir_operation;
|
||||||
ret = afs_do_sync_operation(op);
|
ret = afs_do_sync_operation(op);
|
||||||
afs_dir_unuse_cookie(dvnode, ret);
|
afs_dir_unuse_cookie(dvnode, ret);
|
||||||
return ret;
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+7
-7
@@ -15,8 +15,8 @@ static int autofs_dir_symlink(struct mnt_idmap *, struct inode *,
|
|||||||
struct dentry *, const char *);
|
struct dentry *, const char *);
|
||||||
static int autofs_dir_unlink(struct inode *, struct dentry *);
|
static int autofs_dir_unlink(struct inode *, struct dentry *);
|
||||||
static int autofs_dir_rmdir(struct inode *, struct dentry *);
|
static int autofs_dir_rmdir(struct inode *, struct dentry *);
|
||||||
static int autofs_dir_mkdir(struct mnt_idmap *, struct inode *,
|
static struct dentry *autofs_dir_mkdir(struct mnt_idmap *, struct inode *,
|
||||||
struct dentry *, umode_t);
|
struct dentry *, umode_t);
|
||||||
static long autofs_root_ioctl(struct file *, unsigned int, unsigned long);
|
static long autofs_root_ioctl(struct file *, unsigned int, unsigned long);
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
static long autofs_root_compat_ioctl(struct file *,
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int autofs_dir_mkdir(struct mnt_idmap *idmap,
|
static struct dentry *autofs_dir_mkdir(struct mnt_idmap *idmap,
|
||||||
struct inode *dir, struct dentry *dentry,
|
struct inode *dir, struct dentry *dentry,
|
||||||
umode_t mode)
|
umode_t mode)
|
||||||
{
|
{
|
||||||
struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
|
struct autofs_sb_info *sbi = autofs_sbi(dir->i_sb);
|
||||||
struct autofs_info *ino = autofs_dentry_ino(dentry);
|
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);
|
inode = autofs_get_inode(dir->i_sb, S_IFDIR | mode);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return -ENOMEM;
|
return ERR_PTR(-ENOMEM);
|
||||||
d_add(dentry, inode);
|
d_add(dentry, inode);
|
||||||
|
|
||||||
if (sbi->version < 5)
|
if (sbi->version < 5)
|
||||||
@@ -751,7 +751,7 @@ static int autofs_dir_mkdir(struct mnt_idmap *idmap,
|
|||||||
inc_nlink(dir);
|
inc_nlink(dir);
|
||||||
inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
|
inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
|
||||||
|
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get/set timeout ioctl() operation */
|
/* Get/set timeout ioctl() operation */
|
||||||
|
|||||||
+3
-3
@@ -58,10 +58,10 @@ static int bad_inode_symlink(struct mnt_idmap *idmap,
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bad_inode_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *bad_inode_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
return -EIO;
|
return ERR_PTR(-EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry)
|
static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry)
|
||||||
|
|||||||
+3
-3
@@ -858,10 +858,10 @@ err:
|
|||||||
return bch2_err_class(ret);
|
return bch2_err_class(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bch2_mkdir(struct mnt_idmap *idmap,
|
static struct dentry *bch2_mkdir(struct mnt_idmap *idmap,
|
||||||
struct inode *vdir, struct dentry *dentry, umode_t mode)
|
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,
|
static int bch2_rename2(struct mnt_idmap *idmap,
|
||||||
|
|||||||
+4
-4
@@ -6739,18 +6739,18 @@ fail:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int btrfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *btrfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
|
||||||
inode = new_inode(dir->i_sb);
|
inode = new_inode(dir->i_sb);
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return -ENOMEM;
|
return ERR_PTR(-ENOMEM);
|
||||||
inode_init_owner(idmap, inode, dir, S_IFDIR | mode);
|
inode_init_owner(idmap, inode, dir, S_IFDIR | mode);
|
||||||
inode->i_op = &btrfs_dir_inode_operations;
|
inode->i_op = &btrfs_dir_inode_operations;
|
||||||
inode->i_fop = &btrfs_dir_file_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,
|
static noinline int uncompress_inline(struct btrfs_path *path,
|
||||||
|
|||||||
+4
-4
@@ -1092,8 +1092,8 @@ out:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
|
struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
|
||||||
struct ceph_client *cl = mdsc->fsc->client;
|
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);
|
err = ceph_wait_on_conflict_unlink(dentry);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
|
|
||||||
if (ceph_snap(dir) == CEPH_SNAPDIR) {
|
if (ceph_snap(dir) == CEPH_SNAPDIR) {
|
||||||
/* mkdir .snap/foo is a MKSNAP */
|
/* mkdir .snap/foo is a MKSNAP */
|
||||||
@@ -1173,7 +1173,7 @@ out:
|
|||||||
else
|
else
|
||||||
d_drop(dentry);
|
d_drop(dentry);
|
||||||
ceph_release_acl_sec_ctx(&as_ctx);
|
ceph_release_acl_sec_ctx(&as_ctx);
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ceph_link(struct dentry *old_dentry, struct inode *dir,
|
static int ceph_link(struct dentry *old_dentry, struct inode *dir,
|
||||||
|
|||||||
+7
-7
@@ -166,8 +166,8 @@ err_out:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *de, umode_t mode)
|
struct dentry *de, umode_t mode)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct coda_vattr attrs;
|
struct coda_vattr attrs;
|
||||||
@@ -177,14 +177,14 @@ static int coda_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
|||||||
struct CodaFid newfid;
|
struct CodaFid newfid;
|
||||||
|
|
||||||
if (is_root_inode(dir) && coda_iscontrol(name, len))
|
if (is_root_inode(dir) && coda_iscontrol(name, len))
|
||||||
return -EPERM;
|
return ERR_PTR(-EPERM);
|
||||||
|
|
||||||
attrs.va_mode = mode;
|
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);
|
name, len, &newfid, &attrs);
|
||||||
if (error)
|
if (error)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
inode = coda_iget(dir->i_sb, &newfid, &attrs);
|
inode = coda_iget(dir->i_sb, &newfid, &attrs);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
error = PTR_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_inc_nlink(dir);
|
||||||
coda_dir_update_mtime(dir);
|
coda_dir_update_mtime(dir);
|
||||||
d_instantiate(de, inode);
|
d_instantiate(de, inode);
|
||||||
return 0;
|
return NULL;
|
||||||
err_out:
|
err_out:
|
||||||
d_drop(de);
|
d_drop(de);
|
||||||
return error;
|
return ERR_PTR(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to make de an entry in dir_inodde linked to source_de */
|
/* try to make de an entry in dir_inodde linked to source_de */
|
||||||
|
|||||||
+3
-3
@@ -1280,8 +1280,8 @@ out_root_unlock:
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(configfs_depend_item_unlocked);
|
EXPORT_SYMBOL(configfs_depend_item_unlocked);
|
||||||
|
|
||||||
static int configfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *configfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int module_got = 0;
|
int module_got = 0;
|
||||||
@@ -1461,7 +1461,7 @@ out_put:
|
|||||||
put_fragment(frag);
|
put_fragment(frag);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
|
static int configfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
|
|||||||
+3
-3
@@ -503,8 +503,8 @@ out_lock:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct dentry *lower_dentry;
|
struct dentry *lower_dentry;
|
||||||
@@ -526,7 +526,7 @@ out:
|
|||||||
inode_unlock(lower_dir);
|
inode_unlock(lower_dir);
|
||||||
if (d_really_is_negative(dentry))
|
if (d_really_is_negative(dentry))
|
||||||
d_drop(dentry);
|
d_drop(dentry);
|
||||||
return rc;
|
return ERR_PTR(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
|
static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
|
|||||||
+4
-4
@@ -835,8 +835,8 @@ unlock:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
struct super_block *sb = dir->i_sb;
|
struct super_block *sb = dir->i_sb;
|
||||||
struct inode *inode;
|
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);
|
loff_t size = i_size_read(dir);
|
||||||
|
|
||||||
if (unlikely(exfat_forced_shutdown(sb)))
|
if (unlikely(exfat_forced_shutdown(sb)))
|
||||||
return -EIO;
|
return ERR_PTR(-EIO);
|
||||||
|
|
||||||
mutex_lock(&EXFAT_SB(sb)->s_lock);
|
mutex_lock(&EXFAT_SB(sb)->s_lock);
|
||||||
exfat_set_volume_dirty(sb);
|
exfat_set_volume_dirty(sb);
|
||||||
@@ -877,7 +877,7 @@ static int exfat_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
|||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
mutex_unlock(&EXFAT_SB(sb)->s_lock);
|
mutex_unlock(&EXFAT_SB(sb)->s_lock);
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int exfat_check_dir_empty(struct super_block *sb,
|
static int exfat_check_dir_empty(struct super_block *sb,
|
||||||
|
|||||||
+5
-4
@@ -225,15 +225,16 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ext2_mkdir(struct mnt_idmap * idmap,
|
static struct dentry *ext2_mkdir(struct mnt_idmap * idmap,
|
||||||
struct inode * dir, struct dentry * dentry, umode_t mode)
|
struct inode * dir, struct dentry * dentry,
|
||||||
|
umode_t mode)
|
||||||
{
|
{
|
||||||
struct inode * inode;
|
struct inode * inode;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = dquot_initialize(dir);
|
err = dquot_initialize(dir);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
|
|
||||||
inode_inc_link_count(dir);
|
inode_inc_link_count(dir);
|
||||||
|
|
||||||
@@ -258,7 +259,7 @@ static int ext2_mkdir(struct mnt_idmap * idmap,
|
|||||||
|
|
||||||
d_instantiate_new(dentry, inode);
|
d_instantiate_new(dentry, inode);
|
||||||
out:
|
out:
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
|
|
||||||
out_fail:
|
out_fail:
|
||||||
inode_dec_link_count(inode);
|
inode_dec_link_count(inode);
|
||||||
|
|||||||
+5
-5
@@ -3004,19 +3004,19 @@ out:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *ext4_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
handle_t *handle;
|
handle_t *handle;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int err, err2 = 0, credits, retries = 0;
|
int err, err2 = 0, credits, retries = 0;
|
||||||
|
|
||||||
if (EXT4_DIR_LINK_MAX(dir))
|
if (EXT4_DIR_LINK_MAX(dir))
|
||||||
return -EMLINK;
|
return ERR_PTR(-EMLINK);
|
||||||
|
|
||||||
err = dquot_initialize(dir);
|
err = dquot_initialize(dir);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
|
|
||||||
credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
|
credits = (EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
|
||||||
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
|
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3);
|
||||||
@@ -3066,7 +3066,7 @@ out_stop:
|
|||||||
out_retry:
|
out_retry:
|
||||||
if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
|
if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries))
|
||||||
goto retry;
|
goto retry;
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+7
-7
@@ -684,23 +684,23 @@ out_free_encrypted_link:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
static struct dentry *f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
|
||||||
struct dentry *dentry, umode_t mode)
|
struct dentry *dentry, umode_t mode)
|
||||||
{
|
{
|
||||||
struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
|
struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (unlikely(f2fs_cp_error(sbi)))
|
if (unlikely(f2fs_cp_error(sbi)))
|
||||||
return -EIO;
|
return ERR_PTR(-EIO);
|
||||||
|
|
||||||
err = f2fs_dquot_initialize(dir);
|
err = f2fs_dquot_initialize(dir);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
|
|
||||||
inode = f2fs_new_inode(idmap, dir, S_IFDIR | mode, NULL);
|
inode = f2fs_new_inode(idmap, dir, S_IFDIR | mode, NULL);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return PTR_ERR(inode);
|
return ERR_CAST(inode);
|
||||||
|
|
||||||
inode->i_op = &f2fs_dir_inode_operations;
|
inode->i_op = &f2fs_dir_inode_operations;
|
||||||
inode->i_fop = &f2fs_dir_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_sync_fs(sbi->sb, 1);
|
||||||
|
|
||||||
f2fs_balance_fs(sbi, true);
|
f2fs_balance_fs(sbi, true);
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
out_fail:
|
out_fail:
|
||||||
clear_inode_flag(inode, FI_INC_LINK);
|
clear_inode_flag(inode, FI_INC_LINK);
|
||||||
f2fs_handle_failed_inode(inode);
|
f2fs_handle_failed_inode(inode);
|
||||||
return err;
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
|
static int f2fs_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user