mqueue: switch to vfs_mkobj(), quit abusing ->d_fsdata

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2017-12-01 17:26:05 -05:00
parent a4a0683fd5
commit eecec19d9e
1 changed files with 11 additions and 8 deletions

View File

@ -416,11 +416,11 @@ static void mqueue_evict_inode(struct inode *inode)
put_ipc_ns(ipc_ns); put_ipc_ns(ipc_ns);
} }
static int mqueue_create(struct inode *dir, struct dentry *dentry, static int mqueue_create_attr(struct dentry *dentry, umode_t mode, void *arg)
umode_t mode, bool excl)
{ {
struct inode *dir = dentry->d_parent->d_inode;
struct inode *inode; struct inode *inode;
struct mq_attr *attr = dentry->d_fsdata; struct mq_attr *attr = arg;
int error; int error;
struct ipc_namespace *ipc_ns; struct ipc_namespace *ipc_ns;
@ -461,6 +461,12 @@ out_unlock:
return error; return error;
} }
static int mqueue_create(struct inode *dir, struct dentry *dentry,
umode_t mode, bool excl)
{
return mqueue_create_attr(dentry, mode, NULL);
}
static int mqueue_unlink(struct inode *dir, struct dentry *dentry) static int mqueue_unlink(struct inode *dir, struct dentry *dentry)
{ {
struct inode *inode = d_inode(dentry); struct inode *inode = d_inode(dentry);
@ -732,8 +738,6 @@ static struct file *do_create(struct ipc_namespace *ipc_ns, struct inode *dir,
ret = mq_attr_ok(ipc_ns, attr); ret = mq_attr_ok(ipc_ns, attr);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
/* store for use during create */
path->dentry->d_fsdata = attr;
} else { } else {
struct mq_attr def_attr; struct mq_attr def_attr;
@ -746,9 +750,8 @@ static struct file *do_create(struct ipc_namespace *ipc_ns, struct inode *dir,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
mode &= ~current_umask(); ret = vfs_mkobj(path->dentry, mode & ~current_umask(),
ret = vfs_create(dir, path->dentry, mode, true); mqueue_create_attr, attr);
path->dentry->d_fsdata = NULL;
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
return dentry_open(path, oflag, cred); return dentry_open(path, oflag, cred);