diff options
Diffstat (limited to 'fs/nfs/proc.c')
| -rw-r--r-- | fs/nfs/proc.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 3ddaaa1e9374..d31b4d6e5a5e 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -212,7 +212,7 @@ static int nfs_proc_write(struct nfs_write_data *wdata) return status < 0? status : wdata->res.count; } -static struct inode * +static int nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, int flags) { @@ -233,37 +233,34 @@ nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, fattr.valid = 0; dprintk("NFS call create %s\n", dentry->d_name.name); status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); + if (status == 0) + status = nfs_instantiate(dentry, &fhandle, &fattr); dprintk("NFS reply create: %d\n", status); - if (status == 0) { - struct inode *inode; - inode = nfs_fhget(dir->i_sb, &fhandle, &fattr); - if (inode) - return inode; - status = -ENOMEM; - } - return ERR_PTR(status); + return status; } /* * In NFSv2, mknod is grafted onto the create call. */ static int -nfs_proc_mknod(struct inode *dir, struct qstr *name, struct iattr *sattr, - dev_t rdev, struct nfs_fh *fhandle, struct nfs_fattr *fattr) +nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, + dev_t rdev) { + struct nfs_fh fhandle; + struct nfs_fattr fattr; struct nfs_createargs arg = { .fh = NFS_FH(dir), - .name = name->name, - .len = name->len, + .name = dentry->d_name.name, + .len = dentry->d_name.len, .sattr = sattr }; struct nfs_diropok res = { - .fh = fhandle, - .fattr = fattr + .fh = &fhandle, + .fattr = &fattr }; - int status, mode; + int status, mode; - dprintk("NFS call mknod %s\n", name->name); + dprintk("NFS call mknod %s\n", dentry->d_name.name); mode = sattr->ia_mode; if (S_ISFIFO(mode)) { @@ -274,14 +271,16 @@ nfs_proc_mknod(struct inode *dir, struct qstr *name, struct iattr *sattr, sattr->ia_size = new_encode_dev(rdev);/* get out your barf bag */ } - fattr->valid = 0; + fattr.valid = 0; status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); if (status == -EINVAL && S_ISFIFO(mode)) { sattr->ia_mode = mode; - fattr->valid = 0; + fattr.valid = 0; status = rpc_call(NFS_CLIENT(dir), NFSPROC_CREATE, &arg, &res, 0); } + if (status == 0) + status = nfs_instantiate(dentry, &fhandle, &fattr); dprintk("NFS reply mknod: %d\n", status); return status; } @@ -398,24 +397,27 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path, } static int -nfs_proc_mkdir(struct inode *dir, struct qstr *name, struct iattr *sattr, - struct nfs_fh *fhandle, struct nfs_fattr *fattr) +nfs_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr) { + struct nfs_fh fhandle; + struct nfs_fattr fattr; struct nfs_createargs arg = { .fh = NFS_FH(dir), - .name = name->name, - .len = name->len, + .name = dentry->d_name.name, + .len = dentry->d_name.len, .sattr = sattr }; struct nfs_diropok res = { - .fh = fhandle, - .fattr = fattr + .fh = &fhandle, + .fattr = &fattr }; int status; - dprintk("NFS call mkdir %s\n", name->name); - fattr->valid = 0; + dprintk("NFS call mkdir %s\n", dentry->d_name.name); + fattr.valid = 0; status = rpc_call(NFS_CLIENT(dir), NFSPROC_MKDIR, &arg, &res, 0); + if (status == 0) + status = nfs_instantiate(dentry, &fhandle, &fattr); dprintk("NFS reply mkdir: %d\n", status); return status; } |
