1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds * linux/fs/nfs/nfs3proc.c
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds * Client-side NFSv3 procedures stubs.
61da177e4SLinus Torvalds *
71da177e4SLinus Torvalds * Copyright (C) 1997, Olaf Kirch
81da177e4SLinus Torvalds */
91da177e4SLinus Torvalds
101da177e4SLinus Torvalds #include <linux/mm.h>
111da177e4SLinus Torvalds #include <linux/errno.h>
121da177e4SLinus Torvalds #include <linux/string.h>
131da177e4SLinus Torvalds #include <linux/sunrpc/clnt.h>
145a0e3ad6STejun Heo #include <linux/slab.h>
151da177e4SLinus Torvalds #include <linux/nfs.h>
161da177e4SLinus Torvalds #include <linux/nfs3.h>
171da177e4SLinus Torvalds #include <linux/nfs_fs.h>
181da177e4SLinus Torvalds #include <linux/nfs_page.h>
191da177e4SLinus Torvalds #include <linux/lockd/bind.h>
20b7fa0554SAndreas Gruenbacher #include <linux/nfs_mount.h>
21d310310cSJeff Layton #include <linux/freezer.h>
220a6be655STejun Heo #include <linux/xattr.h>
231da177e4SLinus Torvalds
24006ea73eSChuck Lever #include "iostat.h"
25f7b422b1SDavid Howells #include "internal.h"
2600a36a10SAnna Schumaker #include "nfs3_fs.h"
27006ea73eSChuck Lever
281da177e4SLinus Torvalds #define NFSDBG_FACILITY NFSDBG_PROC
291da177e4SLinus Torvalds
30eb96d5c9SAndy Adamson /* A wrapper to handle the EJUKEBOX error messages */
311da177e4SLinus Torvalds static int
nfs3_rpc_wrapper(struct rpc_clnt * clnt,struct rpc_message * msg,int flags)321da177e4SLinus Torvalds nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
331da177e4SLinus Torvalds {
341da177e4SLinus Torvalds int res;
351da177e4SLinus Torvalds do {
361da177e4SLinus Torvalds res = rpc_call_sync(clnt, msg, flags);
37eb96d5c9SAndy Adamson if (res != -EJUKEBOX)
381da177e4SLinus Torvalds break;
39f5d39b02SPeter Zijlstra __set_current_state(TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
40f5d39b02SPeter Zijlstra schedule_timeout(NFS_JUKEBOX_RETRY_TIME);
411da177e4SLinus Torvalds res = -ERESTARTSYS;
42150030b7SMatthew Wilcox } while (!fatal_signal_pending(current));
431da177e4SLinus Torvalds return res;
441da177e4SLinus Torvalds }
451da177e4SLinus Torvalds
46dead28daSChuck Lever #define rpc_call_sync(clnt, msg, flags) nfs3_rpc_wrapper(clnt, msg, flags)
471da177e4SLinus Torvalds
481da177e4SLinus Torvalds static int
nfs3_async_handle_jukebox(struct rpc_task * task,struct inode * inode)49006ea73eSChuck Lever nfs3_async_handle_jukebox(struct rpc_task *task, struct inode *inode)
501da177e4SLinus Torvalds {
51eb96d5c9SAndy Adamson if (task->tk_status != -EJUKEBOX)
521da177e4SLinus Torvalds return 0;
53006ea73eSChuck Lever nfs_inc_stats(inode, NFSIOS_DELAY);
541da177e4SLinus Torvalds task->tk_status = 0;
551da177e4SLinus Torvalds rpc_restart_call(task);
561da177e4SLinus Torvalds rpc_delay(task, NFS_JUKEBOX_RETRY_TIME);
571da177e4SLinus Torvalds return 1;
581da177e4SLinus Torvalds }
591da177e4SLinus Torvalds
6003c21733SJ. Bruce Fields static int
do_proc_get_root(struct rpc_clnt * client,struct nfs_fh * fhandle,struct nfs_fsinfo * info)6103c21733SJ. Bruce Fields do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle,
6203c21733SJ. Bruce Fields struct nfs_fsinfo *info)
6303c21733SJ. Bruce Fields {
64dead28daSChuck Lever struct rpc_message msg = {
65dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_FSINFO],
66dead28daSChuck Lever .rpc_argp = fhandle,
67dead28daSChuck Lever .rpc_resp = info,
68dead28daSChuck Lever };
6903c21733SJ. Bruce Fields int status;
7003c21733SJ. Bruce Fields
713110ff80SHarvey Harrison dprintk("%s: call fsinfo\n", __func__);
7203c21733SJ. Bruce Fields nfs_fattr_init(info->fattr);
73dead28daSChuck Lever status = rpc_call_sync(client, &msg, 0);
743110ff80SHarvey Harrison dprintk("%s: reply fsinfo: %d\n", __func__, status);
7508660043STrond Myklebust if (status == 0 && !(info->fattr->valid & NFS_ATTR_FATTR)) {
76dead28daSChuck Lever msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR];
77dead28daSChuck Lever msg.rpc_resp = info->fattr;
78dead28daSChuck Lever status = rpc_call_sync(client, &msg, 0);
793110ff80SHarvey Harrison dprintk("%s: reply getattr: %d\n", __func__, status);
8003c21733SJ. Bruce Fields }
8103c21733SJ. Bruce Fields return status;
8203c21733SJ. Bruce Fields }
8303c21733SJ. Bruce Fields
841da177e4SLinus Torvalds /*
8554ceac45SDavid Howells * Bare-bones access to getattr: this is for nfs_get_root/nfs_get_sb
861da177e4SLinus Torvalds */
871da177e4SLinus Torvalds static int
nfs3_proc_get_root(struct nfs_server * server,struct nfs_fh * fhandle,struct nfs_fsinfo * info)881da177e4SLinus Torvalds nfs3_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
891da177e4SLinus Torvalds struct nfs_fsinfo *info)
901da177e4SLinus Torvalds {
911da177e4SLinus Torvalds int status;
921da177e4SLinus Torvalds
9303c21733SJ. Bruce Fields status = do_proc_get_root(server->client, fhandle, info);
945006a76cSDavid Howells if (status && server->nfs_client->cl_rpcclient != server->client)
955006a76cSDavid Howells status = do_proc_get_root(server->nfs_client->cl_rpcclient, fhandle, info);
961da177e4SLinus Torvalds return status;
971da177e4SLinus Torvalds }
981da177e4SLinus Torvalds
991da177e4SLinus Torvalds /*
1001da177e4SLinus Torvalds * One function for each procedure in the NFS protocol.
1011da177e4SLinus Torvalds */
1021da177e4SLinus Torvalds static int
nfs3_proc_getattr(struct nfs_server * server,struct nfs_fh * fhandle,struct nfs_fattr * fattr,struct inode * inode)1031da177e4SLinus Torvalds nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
1042ef61e0eSAnna Schumaker struct nfs_fattr *fattr, struct inode *inode)
1051da177e4SLinus Torvalds {
106dead28daSChuck Lever struct rpc_message msg = {
107dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR],
108dead28daSChuck Lever .rpc_argp = fhandle,
109dead28daSChuck Lever .rpc_resp = fattr,
110dead28daSChuck Lever };
1111da177e4SLinus Torvalds int status;
112c74dfe97STrond Myklebust unsigned short task_flags = 0;
113c74dfe97STrond Myklebust
114c74dfe97STrond Myklebust /* Is this is an attribute revalidation, subject to softreval? */
115c74dfe97STrond Myklebust if (inode && (server->flags & NFS_MOUNT_SOFTREVAL))
116c74dfe97STrond Myklebust task_flags |= RPC_TASK_TIMEOUT;
1171da177e4SLinus Torvalds
1181da177e4SLinus Torvalds dprintk("NFS call getattr\n");
1190e574af1STrond Myklebust nfs_fattr_init(fattr);
120c74dfe97STrond Myklebust status = rpc_call_sync(server->client, &msg, task_flags);
1211da177e4SLinus Torvalds dprintk("NFS reply getattr: %d\n", status);
1221da177e4SLinus Torvalds return status;
1231da177e4SLinus Torvalds }
1241da177e4SLinus Torvalds
1251da177e4SLinus Torvalds static int
nfs3_proc_setattr(struct dentry * dentry,struct nfs_fattr * fattr,struct iattr * sattr)1261da177e4SLinus Torvalds nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
1271da177e4SLinus Torvalds struct iattr *sattr)
1281da177e4SLinus Torvalds {
1292b0143b5SDavid Howells struct inode *inode = d_inode(dentry);
1301da177e4SLinus Torvalds struct nfs3_sattrargs arg = {
1311da177e4SLinus Torvalds .fh = NFS_FH(inode),
1321da177e4SLinus Torvalds .sattr = sattr,
1331da177e4SLinus Torvalds };
134dead28daSChuck Lever struct rpc_message msg = {
135dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_SETATTR],
136dead28daSChuck Lever .rpc_argp = &arg,
137dead28daSChuck Lever .rpc_resp = fattr,
138dead28daSChuck Lever };
1391da177e4SLinus Torvalds int status;
1401da177e4SLinus Torvalds
1411da177e4SLinus Torvalds dprintk("NFS call setattr\n");
142659bfcd6STrond Myklebust if (sattr->ia_valid & ATTR_FILE)
143659bfcd6STrond Myklebust msg.rpc_cred = nfs_file_cred(sattr->ia_file);
1440e574af1STrond Myklebust nfs_fattr_init(fattr);
145dead28daSChuck Lever status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
146dbc898aeSchendt if (status == 0) {
147fe1e8dbeSSu Yanjun nfs_setattr_update_inode(inode, sattr, fattr);
148dbc898aeSchendt if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ACL)
149dbc898aeSchendt nfs_zap_acl_cache(inode);
150dbc898aeSchendt }
1511da177e4SLinus Torvalds dprintk("NFS reply setattr: %d\n", status);
1521da177e4SLinus Torvalds return status;
1531da177e4SLinus Torvalds }
1541da177e4SLinus Torvalds
1551da177e4SLinus Torvalds static int
__nfs3_proc_lookup(struct inode * dir,const char * name,size_t len,struct nfs_fh * fhandle,struct nfs_fattr * fattr,unsigned short task_flags)1565f447cb8STrond Myklebust __nfs3_proc_lookup(struct inode *dir, const char *name, size_t len,
1571775fd3eSDavid Quigley struct nfs_fh *fhandle, struct nfs_fattr *fattr,
1585f447cb8STrond Myklebust unsigned short task_flags)
1591da177e4SLinus Torvalds {
1601da177e4SLinus Torvalds struct nfs3_diropargs arg = {
1611da177e4SLinus Torvalds .fh = NFS_FH(dir),
1625f447cb8STrond Myklebust .name = name,
1635f447cb8STrond Myklebust .len = len
1641da177e4SLinus Torvalds };
1651da177e4SLinus Torvalds struct nfs3_diropres res = {
1661da177e4SLinus Torvalds .fh = fhandle,
1671da177e4SLinus Torvalds .fattr = fattr
1681da177e4SLinus Torvalds };
169dead28daSChuck Lever struct rpc_message msg = {
170dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_LOOKUP],
171dead28daSChuck Lever .rpc_argp = &arg,
172dead28daSChuck Lever .rpc_resp = &res,
173dead28daSChuck Lever };
1741da177e4SLinus Torvalds int status;
175f7b37b8bSTrond Myklebust
176e1fb4d05STrond Myklebust res.dir_attr = nfs_alloc_fattr();
177e1fb4d05STrond Myklebust if (res.dir_attr == NULL)
178e1fb4d05STrond Myklebust return -ENOMEM;
179e1fb4d05STrond Myklebust
1800e574af1STrond Myklebust nfs_fattr_init(fattr);
181f7b37b8bSTrond Myklebust status = rpc_call_sync(NFS_CLIENT(dir), &msg, task_flags);
182e1fb4d05STrond Myklebust nfs_refresh_inode(dir, res.dir_attr);
183dead28daSChuck Lever if (status >= 0 && !(fattr->valid & NFS_ATTR_FATTR)) {
184dead28daSChuck Lever msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR];
185dead28daSChuck Lever msg.rpc_argp = fhandle;
186dead28daSChuck Lever msg.rpc_resp = fattr;
187f7b37b8bSTrond Myklebust status = rpc_call_sync(NFS_CLIENT(dir), &msg, task_flags);
188dead28daSChuck Lever }
189e1fb4d05STrond Myklebust nfs_free_fattr(res.dir_attr);
1901da177e4SLinus Torvalds dprintk("NFS reply lookup: %d\n", status);
1911da177e4SLinus Torvalds return status;
1921da177e4SLinus Torvalds }
1931da177e4SLinus Torvalds
1945f447cb8STrond Myklebust static int
nfs3_proc_lookup(struct inode * dir,struct dentry * dentry,struct nfs_fh * fhandle,struct nfs_fattr * fattr)1955f447cb8STrond Myklebust nfs3_proc_lookup(struct inode *dir, struct dentry *dentry,
1969558a007SAnna Schumaker struct nfs_fh *fhandle, struct nfs_fattr *fattr)
1975f447cb8STrond Myklebust {
1985f447cb8STrond Myklebust unsigned short task_flags = 0;
1995f447cb8STrond Myklebust
2005f447cb8STrond Myklebust /* Is this is an attribute revalidation, subject to softreval? */
2015f447cb8STrond Myklebust if (nfs_lookup_is_soft_revalidate(dentry))
2025f447cb8STrond Myklebust task_flags |= RPC_TASK_TIMEOUT;
2035f447cb8STrond Myklebust
2045f447cb8STrond Myklebust dprintk("NFS call lookup %pd2\n", dentry);
2055f447cb8STrond Myklebust return __nfs3_proc_lookup(dir, dentry->d_name.name,
2065f447cb8STrond Myklebust dentry->d_name.len, fhandle, fattr,
2075f447cb8STrond Myklebust task_flags);
2085f447cb8STrond Myklebust }
2095f447cb8STrond Myklebust
nfs3_proc_lookupp(struct inode * inode,struct nfs_fh * fhandle,struct nfs_fattr * fattr)2103c5e9a59STrond Myklebust static int nfs3_proc_lookupp(struct inode *inode, struct nfs_fh *fhandle,
211ba4bc8dcSAnna Schumaker struct nfs_fattr *fattr)
2123c5e9a59STrond Myklebust {
2133c5e9a59STrond Myklebust const char dotdot[] = "..";
2143c5e9a59STrond Myklebust const size_t len = strlen(dotdot);
2153c5e9a59STrond Myklebust unsigned short task_flags = 0;
2163c5e9a59STrond Myklebust
2173c5e9a59STrond Myklebust if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL)
2183c5e9a59STrond Myklebust task_flags |= RPC_TASK_TIMEOUT;
2193c5e9a59STrond Myklebust
2203c5e9a59STrond Myklebust return __nfs3_proc_lookup(inode, dotdot, len, fhandle, fattr,
2213c5e9a59STrond Myklebust task_flags);
2223c5e9a59STrond Myklebust }
2233c5e9a59STrond Myklebust
nfs3_proc_access(struct inode * inode,struct nfs_access_entry * entry,const struct cred * cred)22473fbb3faSNeilBrown static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry,
22573fbb3faSNeilBrown const struct cred *cred)
2261da177e4SLinus Torvalds {
2271da177e4SLinus Torvalds struct nfs3_accessargs arg = {
2281da177e4SLinus Torvalds .fh = NFS_FH(inode),
2291750d929SAnna Schumaker .access = entry->mask,
2301da177e4SLinus Torvalds };
231c407d41aSTrond Myklebust struct nfs3_accessres res;
2321da177e4SLinus Torvalds struct rpc_message msg = {
2331da177e4SLinus Torvalds .rpc_proc = &nfs3_procedures[NFS3PROC_ACCESS],
2341da177e4SLinus Torvalds .rpc_argp = &arg,
2351da177e4SLinus Torvalds .rpc_resp = &res,
23673fbb3faSNeilBrown .rpc_cred = cred,
2371da177e4SLinus Torvalds };
238c407d41aSTrond Myklebust int status = -ENOMEM;
2391da177e4SLinus Torvalds
2401da177e4SLinus Torvalds dprintk("NFS call access\n");
241c407d41aSTrond Myklebust res.fattr = nfs_alloc_fattr();
242c407d41aSTrond Myklebust if (res.fattr == NULL)
243c407d41aSTrond Myklebust goto out;
244c407d41aSTrond Myklebust
2451da177e4SLinus Torvalds status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
246c407d41aSTrond Myklebust nfs_refresh_inode(inode, res.fattr);
247eda3e208STrond Myklebust if (status == 0)
248eda3e208STrond Myklebust nfs_access_set_mask(entry, res.access);
249c407d41aSTrond Myklebust nfs_free_fattr(res.fattr);
250c407d41aSTrond Myklebust out:
2511da177e4SLinus Torvalds dprintk("NFS reply access: %d\n", status);
2521da177e4SLinus Torvalds return status;
2531da177e4SLinus Torvalds }
2541da177e4SLinus Torvalds
nfs3_proc_readlink(struct inode * inode,struct page * page,unsigned int pgbase,unsigned int pglen)2551da177e4SLinus Torvalds static int nfs3_proc_readlink(struct inode *inode, struct page *page,
2561da177e4SLinus Torvalds unsigned int pgbase, unsigned int pglen)
2571da177e4SLinus Torvalds {
2583b14d654STrond Myklebust struct nfs_fattr *fattr;
2591da177e4SLinus Torvalds struct nfs3_readlinkargs args = {
2601da177e4SLinus Torvalds .fh = NFS_FH(inode),
2611da177e4SLinus Torvalds .pgbase = pgbase,
2621da177e4SLinus Torvalds .pglen = pglen,
2631da177e4SLinus Torvalds .pages = &page
2641da177e4SLinus Torvalds };
265dead28daSChuck Lever struct rpc_message msg = {
266dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_READLINK],
267dead28daSChuck Lever .rpc_argp = &args,
268dead28daSChuck Lever };
2693b14d654STrond Myklebust int status = -ENOMEM;
2701da177e4SLinus Torvalds
2711da177e4SLinus Torvalds dprintk("NFS call readlink\n");
2723b14d654STrond Myklebust fattr = nfs_alloc_fattr();
2733b14d654STrond Myklebust if (fattr == NULL)
2743b14d654STrond Myklebust goto out;
2753b14d654STrond Myklebust msg.rpc_resp = fattr;
2763b14d654STrond Myklebust
277dead28daSChuck Lever status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
2783b14d654STrond Myklebust nfs_refresh_inode(inode, fattr);
2793b14d654STrond Myklebust nfs_free_fattr(fattr);
2803b14d654STrond Myklebust out:
2811da177e4SLinus Torvalds dprintk("NFS reply readlink: %d\n", status);
2821da177e4SLinus Torvalds return status;
2831da177e4SLinus Torvalds }
2841da177e4SLinus Torvalds
2850b4aae7aSTrond Myklebust struct nfs3_createdata {
2860b4aae7aSTrond Myklebust struct rpc_message msg;
2870b4aae7aSTrond Myklebust union {
2880b4aae7aSTrond Myklebust struct nfs3_createargs create;
2890b4aae7aSTrond Myklebust struct nfs3_mkdirargs mkdir;
2900b4aae7aSTrond Myklebust struct nfs3_symlinkargs symlink;
2910b4aae7aSTrond Myklebust struct nfs3_mknodargs mknod;
2920b4aae7aSTrond Myklebust } arg;
2930b4aae7aSTrond Myklebust struct nfs3_diropres res;
2940b4aae7aSTrond Myklebust struct nfs_fh fh;
2950b4aae7aSTrond Myklebust struct nfs_fattr fattr;
2960b4aae7aSTrond Myklebust struct nfs_fattr dir_attr;
2970b4aae7aSTrond Myklebust };
2980b4aae7aSTrond Myklebust
nfs3_alloc_createdata(void)2990b4aae7aSTrond Myklebust static struct nfs3_createdata *nfs3_alloc_createdata(void)
3000b4aae7aSTrond Myklebust {
3010b4aae7aSTrond Myklebust struct nfs3_createdata *data;
3020b4aae7aSTrond Myklebust
3030b4aae7aSTrond Myklebust data = kzalloc(sizeof(*data), GFP_KERNEL);
3040b4aae7aSTrond Myklebust if (data != NULL) {
3050b4aae7aSTrond Myklebust data->msg.rpc_argp = &data->arg;
3060b4aae7aSTrond Myklebust data->msg.rpc_resp = &data->res;
3070b4aae7aSTrond Myklebust data->res.fh = &data->fh;
3080b4aae7aSTrond Myklebust data->res.fattr = &data->fattr;
3090b4aae7aSTrond Myklebust data->res.dir_attr = &data->dir_attr;
3100b4aae7aSTrond Myklebust nfs_fattr_init(data->res.fattr);
3110b4aae7aSTrond Myklebust nfs_fattr_init(data->res.dir_attr);
3120b4aae7aSTrond Myklebust }
3130b4aae7aSTrond Myklebust return data;
3140b4aae7aSTrond Myklebust }
3150b4aae7aSTrond Myklebust
31617fd6e45SBenjamin Coddington static struct dentry *
nfs3_do_create(struct inode * dir,struct dentry * dentry,struct nfs3_createdata * data)31717fd6e45SBenjamin Coddington nfs3_do_create(struct inode *dir, struct dentry *dentry, struct nfs3_createdata *data)
3180b4aae7aSTrond Myklebust {
3190b4aae7aSTrond Myklebust int status;
3200b4aae7aSTrond Myklebust
3210b4aae7aSTrond Myklebust status = rpc_call_sync(NFS_CLIENT(dir), &data->msg, 0);
3220b4aae7aSTrond Myklebust nfs_post_op_update_inode(dir, data->res.dir_attr);
32317fd6e45SBenjamin Coddington if (status != 0)
32417fd6e45SBenjamin Coddington return ERR_PTR(status);
32517fd6e45SBenjamin Coddington
326cc6f3298SAnna Schumaker return nfs_add_or_obtain(dentry, data->res.fh, data->res.fattr);
3270b4aae7aSTrond Myklebust }
3280b4aae7aSTrond Myklebust
nfs3_free_createdata(struct nfs3_createdata * data)3290b4aae7aSTrond Myklebust static void nfs3_free_createdata(struct nfs3_createdata *data)
3300b4aae7aSTrond Myklebust {
3310b4aae7aSTrond Myklebust kfree(data);
3320b4aae7aSTrond Myklebust }
3330b4aae7aSTrond Myklebust
3341da177e4SLinus Torvalds /*
3351da177e4SLinus Torvalds * Create a regular file.
3361da177e4SLinus Torvalds */
3371da177e4SLinus Torvalds static int
nfs3_proc_create(struct inode * dir,struct dentry * dentry,struct iattr * sattr,int flags)3381da177e4SLinus Torvalds nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
3398867fe58SMiklos Szeredi int flags)
3401da177e4SLinus Torvalds {
341013cdf10SChristoph Hellwig struct posix_acl *default_acl, *acl;
3420b4aae7aSTrond Myklebust struct nfs3_createdata *data;
34317fd6e45SBenjamin Coddington struct dentry *d_alias;
3440b4aae7aSTrond Myklebust int status = -ENOMEM;
3451da177e4SLinus Torvalds
3466de1472fSAl Viro dprintk("NFS call create %pd\n", dentry);
3470b4aae7aSTrond Myklebust
3480b4aae7aSTrond Myklebust data = nfs3_alloc_createdata();
3490b4aae7aSTrond Myklebust if (data == NULL)
3500b4aae7aSTrond Myklebust goto out;
3510b4aae7aSTrond Myklebust
3520b4aae7aSTrond Myklebust data->msg.rpc_proc = &nfs3_procedures[NFS3PROC_CREATE];
3530b4aae7aSTrond Myklebust data->arg.create.fh = NFS_FH(dir);
3540b4aae7aSTrond Myklebust data->arg.create.name = dentry->d_name.name;
3550b4aae7aSTrond Myklebust data->arg.create.len = dentry->d_name.len;
3560b4aae7aSTrond Myklebust data->arg.create.sattr = sattr;
3570b4aae7aSTrond Myklebust
3580b4aae7aSTrond Myklebust data->arg.create.createmode = NFS3_CREATE_UNCHECKED;
3591da177e4SLinus Torvalds if (flags & O_EXCL) {
3600b4aae7aSTrond Myklebust data->arg.create.createmode = NFS3_CREATE_EXCLUSIVE;
361a9943d11STrond Myklebust data->arg.create.verifier[0] = cpu_to_be32(jiffies);
362a9943d11STrond Myklebust data->arg.create.verifier[1] = cpu_to_be32(current->pid);
3631da177e4SLinus Torvalds }
3641da177e4SLinus Torvalds
365013cdf10SChristoph Hellwig status = posix_acl_create(dir, &sattr->ia_mode, &default_acl, &acl);
366013cdf10SChristoph Hellwig if (status)
367013cdf10SChristoph Hellwig goto out;
368055ffbeaSAndreas Gruenbacher
3690b4aae7aSTrond Myklebust for (;;) {
37017fd6e45SBenjamin Coddington d_alias = nfs3_do_create(dir, dentry, data);
37117fd6e45SBenjamin Coddington status = PTR_ERR_OR_ZERO(d_alias);
3721da177e4SLinus Torvalds
3730b4aae7aSTrond Myklebust if (status != -ENOTSUPP)
3740b4aae7aSTrond Myklebust break;
3750b4aae7aSTrond Myklebust /* If the server doesn't support the exclusive creation
3760b4aae7aSTrond Myklebust * semantics, try again with simple 'guarded' mode. */
3770b4aae7aSTrond Myklebust switch (data->arg.create.createmode) {
3781da177e4SLinus Torvalds case NFS3_CREATE_EXCLUSIVE:
3790b4aae7aSTrond Myklebust data->arg.create.createmode = NFS3_CREATE_GUARDED;
3801da177e4SLinus Torvalds break;
3811da177e4SLinus Torvalds
3821da177e4SLinus Torvalds case NFS3_CREATE_GUARDED:
3830b4aae7aSTrond Myklebust data->arg.create.createmode = NFS3_CREATE_UNCHECKED;
3841da177e4SLinus Torvalds break;
3851da177e4SLinus Torvalds
3861da177e4SLinus Torvalds case NFS3_CREATE_UNCHECKED:
3871fcb6fcdSGao Xiang goto out_release_acls;
3881da177e4SLinus Torvalds }
3890b4aae7aSTrond Myklebust nfs_fattr_init(data->res.dir_attr);
3900b4aae7aSTrond Myklebust nfs_fattr_init(data->res.fattr);
3911da177e4SLinus Torvalds }
3921da177e4SLinus Torvalds
3931da177e4SLinus Torvalds if (status != 0)
394013cdf10SChristoph Hellwig goto out_release_acls;
3951da177e4SLinus Torvalds
39617fd6e45SBenjamin Coddington if (d_alias)
39717fd6e45SBenjamin Coddington dentry = d_alias;
39817fd6e45SBenjamin Coddington
3991da177e4SLinus Torvalds /* When we created the file with exclusive semantics, make
4001da177e4SLinus Torvalds * sure we set the attributes afterwards. */
4010b4aae7aSTrond Myklebust if (data->arg.create.createmode == NFS3_CREATE_EXCLUSIVE) {
4021da177e4SLinus Torvalds dprintk("NFS call setattr (post-create)\n");
4031da177e4SLinus Torvalds
4041da177e4SLinus Torvalds if (!(sattr->ia_valid & ATTR_ATIME_SET))
4051da177e4SLinus Torvalds sattr->ia_valid |= ATTR_ATIME;
4061da177e4SLinus Torvalds if (!(sattr->ia_valid & ATTR_MTIME_SET))
4071da177e4SLinus Torvalds sattr->ia_valid |= ATTR_MTIME;
4081da177e4SLinus Torvalds
4091da177e4SLinus Torvalds /* Note: we could use a guarded setattr here, but I'm
4101da177e4SLinus Torvalds * not sure this buys us anything (and I'd have
4111da177e4SLinus Torvalds * to revamp the NFSv3 XDR code) */
4120b4aae7aSTrond Myklebust status = nfs3_proc_setattr(dentry, data->res.fattr, sattr);
4132b0143b5SDavid Howells nfs_post_op_update_inode(d_inode(dentry), data->res.fattr);
4141da177e4SLinus Torvalds dprintk("NFS reply setattr (post-create): %d\n", status);
415055ffbeaSAndreas Gruenbacher if (status != 0)
41617fd6e45SBenjamin Coddington goto out_dput;
4170b4aae7aSTrond Myklebust }
418013cdf10SChristoph Hellwig
4192b0143b5SDavid Howells status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl);
420013cdf10SChristoph Hellwig
42117fd6e45SBenjamin Coddington out_dput:
42217fd6e45SBenjamin Coddington dput(d_alias);
423013cdf10SChristoph Hellwig out_release_acls:
424013cdf10SChristoph Hellwig posix_acl_release(acl);
425013cdf10SChristoph Hellwig posix_acl_release(default_acl);
4261da177e4SLinus Torvalds out:
4270b4aae7aSTrond Myklebust nfs3_free_createdata(data);
4281da177e4SLinus Torvalds dprintk("NFS reply create: %d\n", status);
4291da177e4SLinus Torvalds return status;
4301da177e4SLinus Torvalds }
4311da177e4SLinus Torvalds
4321da177e4SLinus Torvalds static int
nfs3_proc_remove(struct inode * dir,struct dentry * dentry)433912678dbSTrond Myklebust nfs3_proc_remove(struct inode *dir, struct dentry *dentry)
4341da177e4SLinus Torvalds {
4354fdc17b2STrond Myklebust struct nfs_removeargs arg = {
4361da177e4SLinus Torvalds .fh = NFS_FH(dir),
437912678dbSTrond Myklebust .name = dentry->d_name,
4381da177e4SLinus Torvalds };
4394fdc17b2STrond Myklebust struct nfs_removeres res;
4401da177e4SLinus Torvalds struct rpc_message msg = {
4411da177e4SLinus Torvalds .rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE],
4421da177e4SLinus Torvalds .rpc_argp = &arg,
4434fdc17b2STrond Myklebust .rpc_resp = &res,
4441da177e4SLinus Torvalds };
445d346890bSTrond Myklebust int status = -ENOMEM;
4461da177e4SLinus Torvalds
447912678dbSTrond Myklebust dprintk("NFS call remove %pd2\n", dentry);
448d346890bSTrond Myklebust res.dir_attr = nfs_alloc_fattr();
449d346890bSTrond Myklebust if (res.dir_attr == NULL)
450d346890bSTrond Myklebust goto out;
451d346890bSTrond Myklebust
4521da177e4SLinus Torvalds status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
453d346890bSTrond Myklebust nfs_post_op_update_inode(dir, res.dir_attr);
454d346890bSTrond Myklebust nfs_free_fattr(res.dir_attr);
455d346890bSTrond Myklebust out:
4561da177e4SLinus Torvalds dprintk("NFS reply remove: %d\n", status);
4571da177e4SLinus Torvalds return status;
4581da177e4SLinus Torvalds }
4591da177e4SLinus Torvalds
460e4eff1a6STrond Myklebust static void
nfs3_proc_unlink_setup(struct rpc_message * msg,struct dentry * dentry,struct inode * inode)461ed7e9ad0STrond Myklebust nfs3_proc_unlink_setup(struct rpc_message *msg,
462ed7e9ad0STrond Myklebust struct dentry *dentry,
463ed7e9ad0STrond Myklebust struct inode *inode)
4641da177e4SLinus Torvalds {
4651da177e4SLinus Torvalds msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
4661da177e4SLinus Torvalds }
4671da177e4SLinus Torvalds
nfs3_proc_unlink_rpc_prepare(struct rpc_task * task,struct nfs_unlinkdata * data)46834e137ccSBryan Schumaker static void nfs3_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data)
46934e137ccSBryan Schumaker {
47034e137ccSBryan Schumaker rpc_call_start(task);
47134e137ccSBryan Schumaker }
47234e137ccSBryan Schumaker
4731da177e4SLinus Torvalds static int
nfs3_proc_unlink_done(struct rpc_task * task,struct inode * dir)474e4eff1a6STrond Myklebust nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir)
4751da177e4SLinus Torvalds {
476e4eff1a6STrond Myklebust struct nfs_removeres *res;
477e4eff1a6STrond Myklebust if (nfs3_async_handle_jukebox(task, dir))
4781da177e4SLinus Torvalds return 0;
479e4eff1a6STrond Myklebust res = task->tk_msg.rpc_resp;
480d346890bSTrond Myklebust nfs_post_op_update_inode(dir, res->dir_attr);
481e4eff1a6STrond Myklebust return 1;
4821da177e4SLinus Torvalds }
4831da177e4SLinus Torvalds
484d3d4152aSJeff Layton static void
nfs3_proc_rename_setup(struct rpc_message * msg,struct dentry * old_dentry,struct dentry * new_dentry)485f2c2c552STrond Myklebust nfs3_proc_rename_setup(struct rpc_message *msg,
486f2c2c552STrond Myklebust struct dentry *old_dentry,
487f2c2c552STrond Myklebust struct dentry *new_dentry)
488d3d4152aSJeff Layton {
489d3d4152aSJeff Layton msg->rpc_proc = &nfs3_procedures[NFS3PROC_RENAME];
490d3d4152aSJeff Layton }
491d3d4152aSJeff Layton
nfs3_proc_rename_rpc_prepare(struct rpc_task * task,struct nfs_renamedata * data)492c6bfa1a1SBryan Schumaker static void nfs3_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
493c6bfa1a1SBryan Schumaker {
494c6bfa1a1SBryan Schumaker rpc_call_start(task);
495c6bfa1a1SBryan Schumaker }
496c6bfa1a1SBryan Schumaker
497d3d4152aSJeff Layton static int
nfs3_proc_rename_done(struct rpc_task * task,struct inode * old_dir,struct inode * new_dir)498d3d4152aSJeff Layton nfs3_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
499d3d4152aSJeff Layton struct inode *new_dir)
500d3d4152aSJeff Layton {
501d3d4152aSJeff Layton struct nfs_renameres *res;
502d3d4152aSJeff Layton
503d3d4152aSJeff Layton if (nfs3_async_handle_jukebox(task, old_dir))
504d3d4152aSJeff Layton return 0;
505d3d4152aSJeff Layton res = task->tk_msg.rpc_resp;
506d3d4152aSJeff Layton
507d3d4152aSJeff Layton nfs_post_op_update_inode(old_dir, res->old_fattr);
508d3d4152aSJeff Layton nfs_post_op_update_inode(new_dir, res->new_fattr);
509d3d4152aSJeff Layton return 1;
510d3d4152aSJeff Layton }
511d3d4152aSJeff Layton
5121da177e4SLinus Torvalds static int
nfs3_proc_link(struct inode * inode,struct inode * dir,const struct qstr * name)513beffb8feSAl Viro nfs3_proc_link(struct inode *inode, struct inode *dir, const struct qstr *name)
5141da177e4SLinus Torvalds {
5151da177e4SLinus Torvalds struct nfs3_linkargs arg = {
5161da177e4SLinus Torvalds .fromfh = NFS_FH(inode),
5171da177e4SLinus Torvalds .tofh = NFS_FH(dir),
5181da177e4SLinus Torvalds .toname = name->name,
5191da177e4SLinus Torvalds .tolen = name->len
5201da177e4SLinus Torvalds };
521136f2627STrond Myklebust struct nfs3_linkres res;
522dead28daSChuck Lever struct rpc_message msg = {
523dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_LINK],
524dead28daSChuck Lever .rpc_argp = &arg,
525dead28daSChuck Lever .rpc_resp = &res,
526dead28daSChuck Lever };
527136f2627STrond Myklebust int status = -ENOMEM;
5281da177e4SLinus Torvalds
5291da177e4SLinus Torvalds dprintk("NFS call link %s\n", name->name);
530136f2627STrond Myklebust res.fattr = nfs_alloc_fattr();
531136f2627STrond Myklebust res.dir_attr = nfs_alloc_fattr();
532136f2627STrond Myklebust if (res.fattr == NULL || res.dir_attr == NULL)
533136f2627STrond Myklebust goto out;
534136f2627STrond Myklebust
535dead28daSChuck Lever status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
536136f2627STrond Myklebust nfs_post_op_update_inode(dir, res.dir_attr);
537136f2627STrond Myklebust nfs_post_op_update_inode(inode, res.fattr);
538136f2627STrond Myklebust out:
539136f2627STrond Myklebust nfs_free_fattr(res.dir_attr);
540136f2627STrond Myklebust nfs_free_fattr(res.fattr);
5411da177e4SLinus Torvalds dprintk("NFS reply link: %d\n", status);
5421da177e4SLinus Torvalds return status;
5431da177e4SLinus Torvalds }
5441da177e4SLinus Torvalds
5451da177e4SLinus Torvalds static int
nfs3_proc_symlink(struct inode * dir,struct dentry * dentry,struct page * page,unsigned int len,struct iattr * sattr)54694a6d753SChuck Lever nfs3_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
54794a6d753SChuck Lever unsigned int len, struct iattr *sattr)
5481da177e4SLinus Torvalds {
5490b4aae7aSTrond Myklebust struct nfs3_createdata *data;
55017fd6e45SBenjamin Coddington struct dentry *d_alias;
5510b4aae7aSTrond Myklebust int status = -ENOMEM;
5521da177e4SLinus Torvalds
55394a6d753SChuck Lever if (len > NFS3_MAXPATHLEN)
5541da177e4SLinus Torvalds return -ENAMETOOLONG;
5554f390c15SChuck Lever
5566de1472fSAl Viro dprintk("NFS call symlink %pd\n", dentry);
55794a6d753SChuck Lever
5580b4aae7aSTrond Myklebust data = nfs3_alloc_createdata();
5590b4aae7aSTrond Myklebust if (data == NULL)
5604f390c15SChuck Lever goto out;
5610b4aae7aSTrond Myklebust data->msg.rpc_proc = &nfs3_procedures[NFS3PROC_SYMLINK];
5620b4aae7aSTrond Myklebust data->arg.symlink.fromfh = NFS_FH(dir);
5630b4aae7aSTrond Myklebust data->arg.symlink.fromname = dentry->d_name.name;
5640b4aae7aSTrond Myklebust data->arg.symlink.fromlen = dentry->d_name.len;
5650b4aae7aSTrond Myklebust data->arg.symlink.pages = &page;
5660b4aae7aSTrond Myklebust data->arg.symlink.pathlen = len;
5670b4aae7aSTrond Myklebust data->arg.symlink.sattr = sattr;
5680b4aae7aSTrond Myklebust
56917fd6e45SBenjamin Coddington d_alias = nfs3_do_create(dir, dentry, data);
57017fd6e45SBenjamin Coddington status = PTR_ERR_OR_ZERO(d_alias);
57117fd6e45SBenjamin Coddington
57217fd6e45SBenjamin Coddington if (status == 0)
57317fd6e45SBenjamin Coddington dput(d_alias);
5740b4aae7aSTrond Myklebust
5750b4aae7aSTrond Myklebust nfs3_free_createdata(data);
5764f390c15SChuck Lever out:
5771da177e4SLinus Torvalds dprintk("NFS reply symlink: %d\n", status);
5781da177e4SLinus Torvalds return status;
5791da177e4SLinus Torvalds }
5801da177e4SLinus Torvalds
5811da177e4SLinus Torvalds static int
nfs3_proc_mkdir(struct inode * dir,struct dentry * dentry,struct iattr * sattr)5821da177e4SLinus Torvalds nfs3_proc_mkdir(struct inode *dir, struct dentry *dentry, struct iattr *sattr)
5831da177e4SLinus Torvalds {
584013cdf10SChristoph Hellwig struct posix_acl *default_acl, *acl;
5850b4aae7aSTrond Myklebust struct nfs3_createdata *data;
58617fd6e45SBenjamin Coddington struct dentry *d_alias;
5870b4aae7aSTrond Myklebust int status = -ENOMEM;
5881da177e4SLinus Torvalds
5896de1472fSAl Viro dprintk("NFS call mkdir %pd\n", dentry);
590055ffbeaSAndreas Gruenbacher
5910b4aae7aSTrond Myklebust data = nfs3_alloc_createdata();
5920b4aae7aSTrond Myklebust if (data == NULL)
5930b4aae7aSTrond Myklebust goto out;
5940b4aae7aSTrond Myklebust
595013cdf10SChristoph Hellwig status = posix_acl_create(dir, &sattr->ia_mode, &default_acl, &acl);
596013cdf10SChristoph Hellwig if (status)
597013cdf10SChristoph Hellwig goto out;
598013cdf10SChristoph Hellwig
5990b4aae7aSTrond Myklebust data->msg.rpc_proc = &nfs3_procedures[NFS3PROC_MKDIR];
6000b4aae7aSTrond Myklebust data->arg.mkdir.fh = NFS_FH(dir);
6010b4aae7aSTrond Myklebust data->arg.mkdir.name = dentry->d_name.name;
6020b4aae7aSTrond Myklebust data->arg.mkdir.len = dentry->d_name.len;
6030b4aae7aSTrond Myklebust data->arg.mkdir.sattr = sattr;
6040b4aae7aSTrond Myklebust
60517fd6e45SBenjamin Coddington d_alias = nfs3_do_create(dir, dentry, data);
60617fd6e45SBenjamin Coddington status = PTR_ERR_OR_ZERO(d_alias);
60717fd6e45SBenjamin Coddington
608055ffbeaSAndreas Gruenbacher if (status != 0)
609013cdf10SChristoph Hellwig goto out_release_acls;
6100b4aae7aSTrond Myklebust
61117fd6e45SBenjamin Coddington if (d_alias)
61217fd6e45SBenjamin Coddington dentry = d_alias;
61317fd6e45SBenjamin Coddington
6142b0143b5SDavid Howells status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl);
615013cdf10SChristoph Hellwig
61617fd6e45SBenjamin Coddington dput(d_alias);
617013cdf10SChristoph Hellwig out_release_acls:
618013cdf10SChristoph Hellwig posix_acl_release(acl);
619013cdf10SChristoph Hellwig posix_acl_release(default_acl);
620055ffbeaSAndreas Gruenbacher out:
6210b4aae7aSTrond Myklebust nfs3_free_createdata(data);
6221da177e4SLinus Torvalds dprintk("NFS reply mkdir: %d\n", status);
6231da177e4SLinus Torvalds return status;
6241da177e4SLinus Torvalds }
6251da177e4SLinus Torvalds
6261da177e4SLinus Torvalds static int
nfs3_proc_rmdir(struct inode * dir,const struct qstr * name)627beffb8feSAl Viro nfs3_proc_rmdir(struct inode *dir, const struct qstr *name)
6281da177e4SLinus Torvalds {
62939967ddfSTrond Myklebust struct nfs_fattr *dir_attr;
6301da177e4SLinus Torvalds struct nfs3_diropargs arg = {
6311da177e4SLinus Torvalds .fh = NFS_FH(dir),
6321da177e4SLinus Torvalds .name = name->name,
6331da177e4SLinus Torvalds .len = name->len
6341da177e4SLinus Torvalds };
635dead28daSChuck Lever struct rpc_message msg = {
636dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_RMDIR],
637dead28daSChuck Lever .rpc_argp = &arg,
638dead28daSChuck Lever };
63939967ddfSTrond Myklebust int status = -ENOMEM;
6401da177e4SLinus Torvalds
6411da177e4SLinus Torvalds dprintk("NFS call rmdir %s\n", name->name);
64239967ddfSTrond Myklebust dir_attr = nfs_alloc_fattr();
64339967ddfSTrond Myklebust if (dir_attr == NULL)
64439967ddfSTrond Myklebust goto out;
64539967ddfSTrond Myklebust
64639967ddfSTrond Myklebust msg.rpc_resp = dir_attr;
647dead28daSChuck Lever status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
64839967ddfSTrond Myklebust nfs_post_op_update_inode(dir, dir_attr);
64939967ddfSTrond Myklebust nfs_free_fattr(dir_attr);
65039967ddfSTrond Myklebust out:
6511da177e4SLinus Torvalds dprintk("NFS reply rmdir: %d\n", status);
6521da177e4SLinus Torvalds return status;
6531da177e4SLinus Torvalds }
6541da177e4SLinus Torvalds
6551da177e4SLinus Torvalds /*
6561da177e4SLinus Torvalds * The READDIR implementation is somewhat hackish - we pass the user buffer
6571da177e4SLinus Torvalds * to the encode function, which installs it in the receive iovec.
6581da177e4SLinus Torvalds * The decode function itself doesn't perform any decoding, it just makes
6591da177e4SLinus Torvalds * sure the reply is syntactically correct.
6601da177e4SLinus Torvalds *
6611da177e4SLinus Torvalds * Also note that this implementation handles both plain readdir and
6621da177e4SLinus Torvalds * readdirplus.
6631da177e4SLinus Torvalds */
nfs3_proc_readdir(struct nfs_readdir_arg * nr_arg,struct nfs_readdir_res * nr_res)66482e22a5eSTrond Myklebust static int nfs3_proc_readdir(struct nfs_readdir_arg *nr_arg,
66582e22a5eSTrond Myklebust struct nfs_readdir_res *nr_res)
6661da177e4SLinus Torvalds {
66782e22a5eSTrond Myklebust struct inode *dir = d_inode(nr_arg->dentry);
6681da177e4SLinus Torvalds struct nfs3_readdirargs arg = {
6691da177e4SLinus Torvalds .fh = NFS_FH(dir),
67082e22a5eSTrond Myklebust .cookie = nr_arg->cookie,
67182e22a5eSTrond Myklebust .plus = nr_arg->plus,
67282e22a5eSTrond Myklebust .count = nr_arg->page_len,
67382e22a5eSTrond Myklebust .pages = nr_arg->pages
6741da177e4SLinus Torvalds };
6751da177e4SLinus Torvalds struct nfs3_readdirres res = {
67682e22a5eSTrond Myklebust .verf = nr_res->verf,
67782e22a5eSTrond Myklebust .plus = nr_arg->plus,
6781da177e4SLinus Torvalds };
6791da177e4SLinus Torvalds struct rpc_message msg = {
6801da177e4SLinus Torvalds .rpc_proc = &nfs3_procedures[NFS3PROC_READDIR],
6811da177e4SLinus Torvalds .rpc_argp = &arg,
6821da177e4SLinus Torvalds .rpc_resp = &res,
68382e22a5eSTrond Myklebust .rpc_cred = nr_arg->cred,
6841da177e4SLinus Torvalds };
685aa49b4cfSTrond Myklebust int status = -ENOMEM;
6861da177e4SLinus Torvalds
68782e22a5eSTrond Myklebust if (nr_arg->plus)
6881da177e4SLinus Torvalds msg.rpc_proc = &nfs3_procedures[NFS3PROC_READDIRPLUS];
68982e22a5eSTrond Myklebust if (arg.cookie)
69082e22a5eSTrond Myklebust memcpy(arg.verf, nr_arg->verf, sizeof(arg.verf));
6911da177e4SLinus Torvalds
69282e22a5eSTrond Myklebust dprintk("NFS call readdir%s %llu\n", nr_arg->plus ? "plus" : "",
69382e22a5eSTrond Myklebust (unsigned long long)nr_arg->cookie);
6941da177e4SLinus Torvalds
695aa49b4cfSTrond Myklebust res.dir_attr = nfs_alloc_fattr();
696aa49b4cfSTrond Myklebust if (res.dir_attr == NULL)
697aa49b4cfSTrond Myklebust goto out;
698aa49b4cfSTrond Myklebust
6991da177e4SLinus Torvalds status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
700c4812998STrond Myklebust
701c4812998STrond Myklebust nfs_invalidate_atime(dir);
702aa49b4cfSTrond Myklebust nfs_refresh_inode(dir, res.dir_attr);
703c4812998STrond Myklebust
704aa49b4cfSTrond Myklebust nfs_free_fattr(res.dir_attr);
705aa49b4cfSTrond Myklebust out:
70682e22a5eSTrond Myklebust dprintk("NFS reply readdir%s: %d\n", nr_arg->plus ? "plus" : "",
70782e22a5eSTrond Myklebust status);
7081da177e4SLinus Torvalds return status;
7091da177e4SLinus Torvalds }
7101da177e4SLinus Torvalds
7111da177e4SLinus Torvalds static int
nfs3_proc_mknod(struct inode * dir,struct dentry * dentry,struct iattr * sattr,dev_t rdev)7121da177e4SLinus Torvalds nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
7131da177e4SLinus Torvalds dev_t rdev)
7141da177e4SLinus Torvalds {
715013cdf10SChristoph Hellwig struct posix_acl *default_acl, *acl;
7160b4aae7aSTrond Myklebust struct nfs3_createdata *data;
71717fd6e45SBenjamin Coddington struct dentry *d_alias;
7180b4aae7aSTrond Myklebust int status = -ENOMEM;
7191da177e4SLinus Torvalds
7206de1472fSAl Viro dprintk("NFS call mknod %pd %u:%u\n", dentry,
7211da177e4SLinus Torvalds MAJOR(rdev), MINOR(rdev));
722055ffbeaSAndreas Gruenbacher
7230b4aae7aSTrond Myklebust data = nfs3_alloc_createdata();
7240b4aae7aSTrond Myklebust if (data == NULL)
725055ffbeaSAndreas Gruenbacher goto out;
7260b4aae7aSTrond Myklebust
727013cdf10SChristoph Hellwig status = posix_acl_create(dir, &sattr->ia_mode, &default_acl, &acl);
728013cdf10SChristoph Hellwig if (status)
729013cdf10SChristoph Hellwig goto out;
730013cdf10SChristoph Hellwig
7310b4aae7aSTrond Myklebust data->msg.rpc_proc = &nfs3_procedures[NFS3PROC_MKNOD];
7320b4aae7aSTrond Myklebust data->arg.mknod.fh = NFS_FH(dir);
7330b4aae7aSTrond Myklebust data->arg.mknod.name = dentry->d_name.name;
7340b4aae7aSTrond Myklebust data->arg.mknod.len = dentry->d_name.len;
7350b4aae7aSTrond Myklebust data->arg.mknod.sattr = sattr;
7360b4aae7aSTrond Myklebust data->arg.mknod.rdev = rdev;
7370b4aae7aSTrond Myklebust
7380b4aae7aSTrond Myklebust switch (sattr->ia_mode & S_IFMT) {
7390b4aae7aSTrond Myklebust case S_IFBLK:
7400b4aae7aSTrond Myklebust data->arg.mknod.type = NF3BLK;
7410b4aae7aSTrond Myklebust break;
7420b4aae7aSTrond Myklebust case S_IFCHR:
7430b4aae7aSTrond Myklebust data->arg.mknod.type = NF3CHR;
7440b4aae7aSTrond Myklebust break;
7450b4aae7aSTrond Myklebust case S_IFIFO:
7460b4aae7aSTrond Myklebust data->arg.mknod.type = NF3FIFO;
7470b4aae7aSTrond Myklebust break;
7480b4aae7aSTrond Myklebust case S_IFSOCK:
7490b4aae7aSTrond Myklebust data->arg.mknod.type = NF3SOCK;
7500b4aae7aSTrond Myklebust break;
7510b4aae7aSTrond Myklebust default:
7520b4aae7aSTrond Myklebust status = -EINVAL;
7531fcb6fcdSGao Xiang goto out_release_acls;
7540b4aae7aSTrond Myklebust }
7550b4aae7aSTrond Myklebust
75617fd6e45SBenjamin Coddington d_alias = nfs3_do_create(dir, dentry, data);
75717fd6e45SBenjamin Coddington status = PTR_ERR_OR_ZERO(d_alias);
758055ffbeaSAndreas Gruenbacher if (status != 0)
759013cdf10SChristoph Hellwig goto out_release_acls;
760013cdf10SChristoph Hellwig
76117fd6e45SBenjamin Coddington if (d_alias)
76217fd6e45SBenjamin Coddington dentry = d_alias;
76317fd6e45SBenjamin Coddington
7642b0143b5SDavid Howells status = nfs3_proc_setacls(d_inode(dentry), acl, default_acl);
765013cdf10SChristoph Hellwig
76617fd6e45SBenjamin Coddington dput(d_alias);
767013cdf10SChristoph Hellwig out_release_acls:
768013cdf10SChristoph Hellwig posix_acl_release(acl);
769013cdf10SChristoph Hellwig posix_acl_release(default_acl);
770055ffbeaSAndreas Gruenbacher out:
7710b4aae7aSTrond Myklebust nfs3_free_createdata(data);
7721da177e4SLinus Torvalds dprintk("NFS reply mknod: %d\n", status);
7731da177e4SLinus Torvalds return status;
7741da177e4SLinus Torvalds }
7751da177e4SLinus Torvalds
7761da177e4SLinus Torvalds static int
nfs3_proc_statfs(struct nfs_server * server,struct nfs_fh * fhandle,struct nfs_fsstat * stat)7771da177e4SLinus Torvalds nfs3_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
7781da177e4SLinus Torvalds struct nfs_fsstat *stat)
7791da177e4SLinus Torvalds {
780dead28daSChuck Lever struct rpc_message msg = {
781dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_FSSTAT],
782dead28daSChuck Lever .rpc_argp = fhandle,
783dead28daSChuck Lever .rpc_resp = stat,
784dead28daSChuck Lever };
7851da177e4SLinus Torvalds int status;
7861da177e4SLinus Torvalds
7871da177e4SLinus Torvalds dprintk("NFS call fsstat\n");
7880e574af1STrond Myklebust nfs_fattr_init(stat->fattr);
789dead28daSChuck Lever status = rpc_call_sync(server->client, &msg, 0);
790d141d974SChuck Lever dprintk("NFS reply fsstat: %d\n", status);
7911da177e4SLinus Torvalds return status;
7921da177e4SLinus Torvalds }
7931da177e4SLinus Torvalds
7941da177e4SLinus Torvalds static int
do_proc_fsinfo(struct rpc_clnt * client,struct nfs_fh * fhandle,struct nfs_fsinfo * info)79537ca8f5cSEG Keizer do_proc_fsinfo(struct rpc_clnt *client, struct nfs_fh *fhandle,
7961da177e4SLinus Torvalds struct nfs_fsinfo *info)
7971da177e4SLinus Torvalds {
798dead28daSChuck Lever struct rpc_message msg = {
799dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_FSINFO],
800dead28daSChuck Lever .rpc_argp = fhandle,
801dead28daSChuck Lever .rpc_resp = info,
802dead28daSChuck Lever };
8031da177e4SLinus Torvalds int status;
8041da177e4SLinus Torvalds
8051da177e4SLinus Torvalds dprintk("NFS call fsinfo\n");
8060e574af1STrond Myklebust nfs_fattr_init(info->fattr);
80737ca8f5cSEG Keizer status = rpc_call_sync(client, &msg, 0);
8081da177e4SLinus Torvalds dprintk("NFS reply fsinfo: %d\n", status);
8091da177e4SLinus Torvalds return status;
8101da177e4SLinus Torvalds }
8111da177e4SLinus Torvalds
81237ca8f5cSEG Keizer /*
81337ca8f5cSEG Keizer * Bare-bones access to fsinfo: this is for nfs_get_root/nfs_get_sb via
81437ca8f5cSEG Keizer * nfs_create_server
81537ca8f5cSEG Keizer */
81637ca8f5cSEG Keizer static int
nfs3_proc_fsinfo(struct nfs_server * server,struct nfs_fh * fhandle,struct nfs_fsinfo * info)81737ca8f5cSEG Keizer nfs3_proc_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
81837ca8f5cSEG Keizer struct nfs_fsinfo *info)
81937ca8f5cSEG Keizer {
82037ca8f5cSEG Keizer int status;
82137ca8f5cSEG Keizer
82237ca8f5cSEG Keizer status = do_proc_fsinfo(server->client, fhandle, info);
82337ca8f5cSEG Keizer if (status && server->nfs_client->cl_rpcclient != server->client)
82437ca8f5cSEG Keizer status = do_proc_fsinfo(server->nfs_client->cl_rpcclient, fhandle, info);
82537ca8f5cSEG Keizer return status;
82637ca8f5cSEG Keizer }
82737ca8f5cSEG Keizer
8281da177e4SLinus Torvalds static int
nfs3_proc_pathconf(struct nfs_server * server,struct nfs_fh * fhandle,struct nfs_pathconf * info)8291da177e4SLinus Torvalds nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
8301da177e4SLinus Torvalds struct nfs_pathconf *info)
8311da177e4SLinus Torvalds {
832dead28daSChuck Lever struct rpc_message msg = {
833dead28daSChuck Lever .rpc_proc = &nfs3_procedures[NFS3PROC_PATHCONF],
834dead28daSChuck Lever .rpc_argp = fhandle,
835dead28daSChuck Lever .rpc_resp = info,
836dead28daSChuck Lever };
8371da177e4SLinus Torvalds int status;
8381da177e4SLinus Torvalds
8391da177e4SLinus Torvalds dprintk("NFS call pathconf\n");
8400e574af1STrond Myklebust nfs_fattr_init(info->fattr);
841dead28daSChuck Lever status = rpc_call_sync(server->client, &msg, 0);
8421da177e4SLinus Torvalds dprintk("NFS reply pathconf: %d\n", status);
8431da177e4SLinus Torvalds return status;
8441da177e4SLinus Torvalds }
8451da177e4SLinus Torvalds
nfs3_read_done(struct rpc_task * task,struct nfs_pgio_header * hdr)846d45f60c6SWeston Andros Adamson static int nfs3_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
8471da177e4SLinus Torvalds {
848d45f60c6SWeston Andros Adamson struct inode *inode = hdr->inode;
8498d8928d8STrond Myklebust struct nfs_server *server = NFS_SERVER(inode);
850cd841605SFred Isaman
85116cecdf6STrond Myklebust if (hdr->pgio_done_cb != NULL)
85216cecdf6STrond Myklebust return hdr->pgio_done_cb(task, hdr);
85316cecdf6STrond Myklebust
854cd841605SFred Isaman if (nfs3_async_handle_jukebox(task, inode))
855ec06c096STrond Myklebust return -EAGAIN;
8568850df99STrond Myklebust
8578d8928d8STrond Myklebust if (task->tk_status >= 0 && !server->read_hdrsize)
8588d8928d8STrond Myklebust cmpxchg(&server->read_hdrsize, 0, hdr->res.replen);
8598d8928d8STrond Myklebust
860cd841605SFred Isaman nfs_invalidate_atime(inode);
861d45f60c6SWeston Andros Adamson nfs_refresh_inode(inode, &hdr->fattr);
862ec06c096STrond Myklebust return 0;
8631da177e4SLinus Torvalds }
8641da177e4SLinus Torvalds
nfs3_proc_read_setup(struct nfs_pgio_header * hdr,struct rpc_message * msg)865d45f60c6SWeston Andros Adamson static void nfs3_proc_read_setup(struct nfs_pgio_header *hdr,
866d45f60c6SWeston Andros Adamson struct rpc_message *msg)
8671da177e4SLinus Torvalds {
868bdc7f021STrond Myklebust msg->rpc_proc = &nfs3_procedures[NFS3PROC_READ];
8698d8928d8STrond Myklebust hdr->args.replen = NFS_SERVER(hdr->inode)->read_hdrsize;
8701da177e4SLinus Torvalds }
8711da177e4SLinus Torvalds
nfs3_proc_pgio_rpc_prepare(struct rpc_task * task,struct nfs_pgio_header * hdr)872d45f60c6SWeston Andros Adamson static int nfs3_proc_pgio_rpc_prepare(struct rpc_task *task,
873d45f60c6SWeston Andros Adamson struct nfs_pgio_header *hdr)
874ea7c3303SBryan Schumaker {
875ea7c3303SBryan Schumaker rpc_call_start(task);
876ef1820f9SNeilBrown return 0;
877ea7c3303SBryan Schumaker }
878ea7c3303SBryan Schumaker
nfs3_write_done(struct rpc_task * task,struct nfs_pgio_header * hdr)879d45f60c6SWeston Andros Adamson static int nfs3_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
8801da177e4SLinus Torvalds {
881d45f60c6SWeston Andros Adamson struct inode *inode = hdr->inode;
882cd841605SFred Isaman
88316cecdf6STrond Myklebust if (hdr->pgio_done_cb != NULL)
88416cecdf6STrond Myklebust return hdr->pgio_done_cb(task, hdr);
88516cecdf6STrond Myklebust
886cd841605SFred Isaman if (nfs3_async_handle_jukebox(task, inode))
887788e7a89STrond Myklebust return -EAGAIN;
8881da177e4SLinus Torvalds if (task->tk_status >= 0)
889a08a8cd3STrond Myklebust nfs_writeback_update_inode(hdr);
890788e7a89STrond Myklebust return 0;
8911da177e4SLinus Torvalds }
8921da177e4SLinus Torvalds
nfs3_proc_write_setup(struct nfs_pgio_header * hdr,struct rpc_message * msg,struct rpc_clnt ** clnt)893d45f60c6SWeston Andros Adamson static void nfs3_proc_write_setup(struct nfs_pgio_header *hdr,
894fb91fb0eSAnna Schumaker struct rpc_message *msg,
895fb91fb0eSAnna Schumaker struct rpc_clnt **clnt)
8961da177e4SLinus Torvalds {
897bdc7f021STrond Myklebust msg->rpc_proc = &nfs3_procedures[NFS3PROC_WRITE];
8981da177e4SLinus Torvalds }
8991da177e4SLinus Torvalds
nfs3_proc_commit_rpc_prepare(struct rpc_task * task,struct nfs_commit_data * data)9000b7c0153SFred Isaman static void nfs3_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data)
9010b7c0153SFred Isaman {
9020b7c0153SFred Isaman rpc_call_start(task);
9030b7c0153SFred Isaman }
9040b7c0153SFred Isaman
nfs3_commit_done(struct rpc_task * task,struct nfs_commit_data * data)9050b7c0153SFred Isaman static int nfs3_commit_done(struct rpc_task *task, struct nfs_commit_data *data)
9061da177e4SLinus Torvalds {
90716cecdf6STrond Myklebust if (data->commit_done_cb != NULL)
90816cecdf6STrond Myklebust return data->commit_done_cb(task, data);
90916cecdf6STrond Myklebust
910006ea73eSChuck Lever if (nfs3_async_handle_jukebox(task, data->inode))
911788e7a89STrond Myklebust return -EAGAIN;
9129e08a3c5STrond Myklebust nfs_refresh_inode(data->inode, data->res.fattr);
913788e7a89STrond Myklebust return 0;
9141da177e4SLinus Torvalds }
9151da177e4SLinus Torvalds
nfs3_proc_commit_setup(struct nfs_commit_data * data,struct rpc_message * msg,struct rpc_clnt ** clnt)916e9ae1ee2SAnna Schumaker static void nfs3_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg,
917e9ae1ee2SAnna Schumaker struct rpc_clnt **clnt)
9181da177e4SLinus Torvalds {
919bdc7f021STrond Myklebust msg->rpc_proc = &nfs3_procedures[NFS3PROC_COMMIT];
9201da177e4SLinus Torvalds }
9211da177e4SLinus Torvalds
nfs3_nlm_alloc_call(void * data)922bb3393d5STrond Myklebust static void nfs3_nlm_alloc_call(void *data)
923f30cb757SBenjamin Coddington {
924f30cb757SBenjamin Coddington struct nfs_lock_context *l_ctx = data;
925f30cb757SBenjamin Coddington if (l_ctx && test_bit(NFS_CONTEXT_UNLOCK, &l_ctx->open_context->flags)) {
926f30cb757SBenjamin Coddington get_nfs_open_context(l_ctx->open_context);
927f30cb757SBenjamin Coddington nfs_get_lock_context(l_ctx->open_context);
928f30cb757SBenjamin Coddington }
929f30cb757SBenjamin Coddington }
930f30cb757SBenjamin Coddington
nfs3_nlm_unlock_prepare(struct rpc_task * task,void * data)931bb3393d5STrond Myklebust static bool nfs3_nlm_unlock_prepare(struct rpc_task *task, void *data)
932f30cb757SBenjamin Coddington {
933f30cb757SBenjamin Coddington struct nfs_lock_context *l_ctx = data;
934f30cb757SBenjamin Coddington if (l_ctx && test_bit(NFS_CONTEXT_UNLOCK, &l_ctx->open_context->flags))
935f30cb757SBenjamin Coddington return nfs_async_iocounter_wait(task, l_ctx);
936f30cb757SBenjamin Coddington return false;
937f30cb757SBenjamin Coddington
938f30cb757SBenjamin Coddington }
939f30cb757SBenjamin Coddington
nfs3_nlm_release_call(void * data)940bb3393d5STrond Myklebust static void nfs3_nlm_release_call(void *data)
941f30cb757SBenjamin Coddington {
942f30cb757SBenjamin Coddington struct nfs_lock_context *l_ctx = data;
943f30cb757SBenjamin Coddington struct nfs_open_context *ctx;
944f30cb757SBenjamin Coddington if (l_ctx && test_bit(NFS_CONTEXT_UNLOCK, &l_ctx->open_context->flags)) {
945f30cb757SBenjamin Coddington ctx = l_ctx->open_context;
946f30cb757SBenjamin Coddington nfs_put_lock_context(l_ctx);
947f30cb757SBenjamin Coddington put_nfs_open_context(ctx);
948f30cb757SBenjamin Coddington }
949f30cb757SBenjamin Coddington }
950f30cb757SBenjamin Coddington
9511b720406SColin Ian King static const struct nlmclnt_operations nlmclnt_fl_close_lock_ops = {
952f30cb757SBenjamin Coddington .nlmclnt_alloc_call = nfs3_nlm_alloc_call,
953f30cb757SBenjamin Coddington .nlmclnt_unlock_prepare = nfs3_nlm_unlock_prepare,
954f30cb757SBenjamin Coddington .nlmclnt_release_call = nfs3_nlm_release_call,
955f30cb757SBenjamin Coddington };
956f30cb757SBenjamin Coddington
9571da177e4SLinus Torvalds static int
nfs3_proc_lock(struct file * filp,int cmd,struct file_lock * fl)9581da177e4SLinus Torvalds nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
9591da177e4SLinus Torvalds {
960496ad9aaSAl Viro struct inode *inode = file_inode(filp);
961f30cb757SBenjamin Coddington struct nfs_lock_context *l_ctx = NULL;
962f30cb757SBenjamin Coddington struct nfs_open_context *ctx = nfs_file_open_context(filp);
963f30cb757SBenjamin Coddington int status;
9641093a60eSChuck Lever
965f30cb757SBenjamin Coddington if (fl->fl_flags & FL_CLOSE) {
966f30cb757SBenjamin Coddington l_ctx = nfs_get_lock_context(ctx);
967f30cb757SBenjamin Coddington if (IS_ERR(l_ctx))
968f30cb757SBenjamin Coddington l_ctx = NULL;
969f30cb757SBenjamin Coddington else
970f30cb757SBenjamin Coddington set_bit(NFS_CONTEXT_UNLOCK, &ctx->flags);
971f30cb757SBenjamin Coddington }
972f30cb757SBenjamin Coddington
973f30cb757SBenjamin Coddington status = nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl, l_ctx);
974f30cb757SBenjamin Coddington
975f30cb757SBenjamin Coddington if (l_ctx)
976f30cb757SBenjamin Coddington nfs_put_lock_context(l_ctx);
977f30cb757SBenjamin Coddington
978f30cb757SBenjamin Coddington return status;
9791da177e4SLinus Torvalds }
9801da177e4SLinus Torvalds
nfs3_have_delegation(struct inode * inode,fmode_t flags)981011e2a7fSBryan Schumaker static int nfs3_have_delegation(struct inode *inode, fmode_t flags)
982011e2a7fSBryan Schumaker {
983011e2a7fSBryan Schumaker return 0;
984011e2a7fSBryan Schumaker }
985011e2a7fSBryan Schumaker
986ab96291eSBryan Schumaker static const struct inode_operations nfs3_dir_inode_operations = {
987ab96291eSBryan Schumaker .create = nfs_create,
988ab96291eSBryan Schumaker .lookup = nfs_lookup,
989ab96291eSBryan Schumaker .link = nfs_link,
990ab96291eSBryan Schumaker .unlink = nfs_unlink,
991ab96291eSBryan Schumaker .symlink = nfs_symlink,
992ab96291eSBryan Schumaker .mkdir = nfs_mkdir,
993ab96291eSBryan Schumaker .rmdir = nfs_rmdir,
994ab96291eSBryan Schumaker .mknod = nfs_mknod,
995ab96291eSBryan Schumaker .rename = nfs_rename,
996ab96291eSBryan Schumaker .permission = nfs_permission,
997ab96291eSBryan Schumaker .getattr = nfs_getattr,
998ab96291eSBryan Schumaker .setattr = nfs_setattr,
9995f13ee9cSChristoph Hellwig #ifdef CONFIG_NFS_V3_ACL
100074adf83fSChristoph Hellwig .listxattr = nfs3_listxattr,
1001*cac2f8b8SChristian Brauner .get_inode_acl = nfs3_get_acl,
1002013cdf10SChristoph Hellwig .set_acl = nfs3_set_acl,
1003013cdf10SChristoph Hellwig #endif
1004ab96291eSBryan Schumaker };
1005ab96291eSBryan Schumaker
1006ab96291eSBryan Schumaker static const struct inode_operations nfs3_file_inode_operations = {
1007ab96291eSBryan Schumaker .permission = nfs_permission,
1008ab96291eSBryan Schumaker .getattr = nfs_getattr,
1009ab96291eSBryan Schumaker .setattr = nfs_setattr,
10105f13ee9cSChristoph Hellwig #ifdef CONFIG_NFS_V3_ACL
101174adf83fSChristoph Hellwig .listxattr = nfs3_listxattr,
1012*cac2f8b8SChristian Brauner .get_inode_acl = nfs3_get_acl,
1013013cdf10SChristoph Hellwig .set_acl = nfs3_set_acl,
1014013cdf10SChristoph Hellwig #endif
1015ab96291eSBryan Schumaker };
1016ab96291eSBryan Schumaker
1017509de811SDavid Howells const struct nfs_rpc_ops nfs_v3_clientops = {
10181da177e4SLinus Torvalds .version = 3, /* protocol version */
10191da177e4SLinus Torvalds .dentry_ops = &nfs_dentry_operations,
1020b7fa0554SAndreas Gruenbacher .dir_inode_ops = &nfs3_dir_inode_operations,
1021b7fa0554SAndreas Gruenbacher .file_inode_ops = &nfs3_file_inode_operations,
10221788ea6eSJeff Layton .file_ops = &nfs_file_operations,
1023f30cb757SBenjamin Coddington .nlmclnt_ops = &nlmclnt_fl_close_lock_ops,
10241da177e4SLinus Torvalds .getroot = nfs3_proc_get_root,
1025281cad46SBryan Schumaker .submount = nfs_submount,
1026f2aedb71SDavid Howells .try_get_tree = nfs_try_get_tree,
10271da177e4SLinus Torvalds .getattr = nfs3_proc_getattr,
10281da177e4SLinus Torvalds .setattr = nfs3_proc_setattr,
10291da177e4SLinus Torvalds .lookup = nfs3_proc_lookup,
10303c5e9a59STrond Myklebust .lookupp = nfs3_proc_lookupp,
10311da177e4SLinus Torvalds .access = nfs3_proc_access,
10321da177e4SLinus Torvalds .readlink = nfs3_proc_readlink,
10331da177e4SLinus Torvalds .create = nfs3_proc_create,
10341da177e4SLinus Torvalds .remove = nfs3_proc_remove,
10351da177e4SLinus Torvalds .unlink_setup = nfs3_proc_unlink_setup,
103634e137ccSBryan Schumaker .unlink_rpc_prepare = nfs3_proc_unlink_rpc_prepare,
10371da177e4SLinus Torvalds .unlink_done = nfs3_proc_unlink_done,
1038d3d4152aSJeff Layton .rename_setup = nfs3_proc_rename_setup,
1039c6bfa1a1SBryan Schumaker .rename_rpc_prepare = nfs3_proc_rename_rpc_prepare,
1040d3d4152aSJeff Layton .rename_done = nfs3_proc_rename_done,
10411da177e4SLinus Torvalds .link = nfs3_proc_link,
10421da177e4SLinus Torvalds .symlink = nfs3_proc_symlink,
10431da177e4SLinus Torvalds .mkdir = nfs3_proc_mkdir,
10441da177e4SLinus Torvalds .rmdir = nfs3_proc_rmdir,
10451da177e4SLinus Torvalds .readdir = nfs3_proc_readdir,
10461da177e4SLinus Torvalds .mknod = nfs3_proc_mknod,
10471da177e4SLinus Torvalds .statfs = nfs3_proc_statfs,
10481da177e4SLinus Torvalds .fsinfo = nfs3_proc_fsinfo,
10491da177e4SLinus Torvalds .pathconf = nfs3_proc_pathconf,
10501da177e4SLinus Torvalds .decode_dirent = nfs3_decode_dirent,
1051a4cdda59SAnna Schumaker .pgio_rpc_prepare = nfs3_proc_pgio_rpc_prepare,
10521da177e4SLinus Torvalds .read_setup = nfs3_proc_read_setup,
1053ec06c096STrond Myklebust .read_done = nfs3_read_done,
10541da177e4SLinus Torvalds .write_setup = nfs3_proc_write_setup,
1055788e7a89STrond Myklebust .write_done = nfs3_write_done,
10561da177e4SLinus Torvalds .commit_setup = nfs3_proc_commit_setup,
10570b7c0153SFred Isaman .commit_rpc_prepare = nfs3_proc_commit_rpc_prepare,
1058788e7a89STrond Myklebust .commit_done = nfs3_commit_done,
10591da177e4SLinus Torvalds .lock = nfs3_proc_lock,
1060013cdf10SChristoph Hellwig .clear_acl_cache = forget_all_cached_acls,
10617fe5c398STrond Myklebust .close_context = nfs_close_context,
1062011e2a7fSBryan Schumaker .have_delegation = nfs3_have_delegation,
10636663ee7fSBryan Schumaker .alloc_client = nfs_alloc_client,
106445a52a02SAndy Adamson .init_client = nfs_init_client,
1065cdb7ecedSBryan Schumaker .free_client = nfs_free_client,
10661179acc6SBryan Schumaker .create_server = nfs3_create_server,
10671179acc6SBryan Schumaker .clone_server = nfs3_clone_server,
10681da177e4SLinus Torvalds };
1069