NFS: Share NFS superblocks per-protocol per-server per-FSID
[deliverable/linux.git] / fs / nfs / nfs4proc.c
index 803c31b88bb5207023f2381bdf529ae7275fec4a..a825547e8214fc969154ddfe8e4d0f3e71e1ccbf 100644 (file)
@@ -758,7 +758,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
        }
        nfs_confirm_seqid(&data->owner->so_seqid, 0);
        if (!(o_res->f_attr->valid & NFS_ATTR_FATTR))
-               return server->rpc_ops->getattr(server, &o_res->fh, o_res->f_attr);
+               return server->nfs_client->rpc_ops->getattr(server, &o_res->fh, o_res->f_attr);
        return 0;
 }
 
@@ -1268,7 +1268,7 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
                BUG_ON(nd->intent.open.flags & O_CREAT);
        }
 
-       cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0);
+       cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0);
        if (IS_ERR(cred))
                return (struct dentry *)cred;
        state = nfs4_do_open(dir, dentry, nd->intent.open.flags, &attr, cred);
@@ -1291,7 +1291,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
        struct rpc_cred *cred;
        struct nfs4_state *state;
 
-       cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0);
+       cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0);
        if (IS_ERR(cred))
                return PTR_ERR(cred);
        state = nfs4_open_delegated(dentry->d_inode, openflags, cred);
@@ -1393,70 +1393,19 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
        return err;
 }
 
+/*
+ * get the file handle for the "/" directory on the server
+ */
 static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
-               struct nfs_fsinfo *info)
+                             struct nfs_fsinfo *info)
 {
-       struct nfs_fattr *      fattr = info->fattr;
-       unsigned char *         p;
-       struct qstr             q;
-       struct nfs4_lookup_arg args = {
-               .dir_fh = fhandle,
-               .name = &q,
-               .bitmask = nfs4_fattr_bitmap,
-       };
-       struct nfs4_lookup_res res = {
-               .server = server,
-               .fattr = fattr,
-               .fh = fhandle,
-       };
-       struct rpc_message msg = {
-               .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LOOKUP],
-               .rpc_argp = &args,
-               .rpc_resp = &res,
-       };
        int status;
 
-       /*
-        * Now we do a separate LOOKUP for each component of the mount path.
-        * The LOOKUPs are done separately so that we can conveniently
-        * catch an ERR_WRONGSEC if it occurs along the way...
-        */
        status = nfs4_lookup_root(server, fhandle, info);
-       if (status)
-               goto out;
-
-       p = server->mnt_path;
-       for (;;) {
-               struct nfs4_exception exception = { };
-
-               while (*p == '/')
-                       p++;
-               if (!*p)
-                       break;
-               q.name = p;
-               while (*p && (*p != '/'))
-                       p++;
-               q.len = p - q.name;
-
-               do {
-                       nfs_fattr_init(fattr);
-                       status = nfs4_handle_exception(server,
-                                       rpc_call_sync(server->client, &msg, 0),
-                                       &exception);
-               } while (exception.retry);
-               if (status == 0)
-                       continue;
-               if (status == -ENOENT) {
-                       printk(KERN_NOTICE "NFS: mount path %s does not exist!\n", server->mnt_path);
-                       printk(KERN_NOTICE "NFS: suggestion: try mounting '/' instead.\n");
-               }
-               break;
-       }
        if (status == 0)
                status = nfs4_server_capabilities(server, fhandle);
        if (status == 0)
                status = nfs4_do_fsinfo(server, fhandle, info);
-out:
        return nfs4_map_errors(status);
 }
 
@@ -1565,7 +1514,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
 
        nfs_fattr_init(fattr);
        
-       cred = rpcauth_lookupcred(NFS_SERVER(inode)->client->cl_auth, 0);
+       cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
        if (IS_ERR(cred))
                return PTR_ERR(cred);
 
@@ -1927,7 +1876,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
        struct rpc_cred *cred;
        int status = 0;
 
-       cred = rpcauth_lookupcred(NFS_SERVER(dir)->client->cl_auth, 0);
+       cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0);
        if (IS_ERR(cred)) {
                status = PTR_ERR(cred);
                goto out;
@@ -2816,7 +2765,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
                return -EOPNOTSUPP;
        nfs_inode_return_delegation(inode);
        buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase);
-       ret = rpc_call_sync(NFS_SERVER(inode)->client, &msg, 0);
+       ret = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
        if (ret == 0)
                nfs4_write_cached_acl(inode, buf, buflen);
        return ret;
@@ -3761,7 +3710,7 @@ static struct inode_operations nfs4_file_inode_operations = {
        .listxattr      = nfs4_listxattr,
 };
 
-struct nfs_rpc_ops     nfs_v4_clientops = {
+const struct nfs_rpc_ops nfs_v4_clientops = {
        .version        = 4,                    /* protocol version */
        .dentry_ops     = &nfs4_dentry_operations,
        .dir_inode_ops  = &nfs4_dir_inode_operations,
This page took 0.028276 seconds and 5 git commands to generate.