aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2005-06-22 13:16:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 16:07:16 -0400
commit6a19275ada9137435da58990c8f8d3f58e170bf1 (patch)
tree927f8aa96c9b558a0bed5355dde66df9c0ec8554 /fs/nfs
parent438b6fdebf2a2e8573e7290bc176feb4d4475f43 (diff)
[PATCH] RPC: [PATCH] improve rpcauthauth_create error returns
Currently we return -ENOMEM for every single failure to create a new auth. This is actually accurate for auth_null and auth_unix, but for auth_gss it's a bit confusing. Allow rpcauth_create (and the ->create methods) to return errors. With this patch, the user may sometimes see an EINVAL instead. Whee. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/inode.c27
-rw-r--r--fs/nfs/nfs4state.c3
2 files changed, 19 insertions, 11 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 350c48c12639..97b3fe7ece63 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -160,11 +160,10 @@ nfs_clear_inode(struct inode *inode)
160void 160void
161nfs_umount_begin(struct super_block *sb) 161nfs_umount_begin(struct super_block *sb)
162{ 162{
163 struct nfs_server *server = NFS_SB(sb); 163 struct rpc_clnt *rpc = NFS_SB(sb)->client;
164 struct rpc_clnt *rpc;
165 164
166 /* -EIO all pending I/O */ 165 /* -EIO all pending I/O */
167 if ((rpc = server->client) != NULL) 166 if (!IS_ERR(rpc))
168 rpc_killall_tasks(rpc); 167 rpc_killall_tasks(rpc);
169} 168}
170 169
@@ -450,11 +449,14 @@ nfs_fill_super(struct super_block *sb, struct nfs_mount_data *data, int silent)
450 return PTR_ERR(server->client); 449 return PTR_ERR(server->client);
451 /* RFC 2623, sec 2.3.2 */ 450 /* RFC 2623, sec 2.3.2 */
452 if (authflavor != RPC_AUTH_UNIX) { 451 if (authflavor != RPC_AUTH_UNIX) {
452 struct rpc_auth *auth;
453
453 server->client_sys = rpc_clone_client(server->client); 454 server->client_sys = rpc_clone_client(server->client);
454 if (IS_ERR(server->client_sys)) 455 if (IS_ERR(server->client_sys))
455 return PTR_ERR(server->client_sys); 456 return PTR_ERR(server->client_sys);
456 if (!rpcauth_create(RPC_AUTH_UNIX, server->client_sys)) 457 auth = rpcauth_create(RPC_AUTH_UNIX, server->client_sys);
457 return -ENOMEM; 458 if (IS_ERR(auth))
459 return PTR_ERR(auth);
458 } else { 460 } else {
459 atomic_inc(&server->client->cl_count); 461 atomic_inc(&server->client->cl_count);
460 server->client_sys = server->client; 462 server->client_sys = server->client;
@@ -1450,6 +1452,7 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
1450 memset(server, 0, sizeof(struct nfs_server)); 1452 memset(server, 0, sizeof(struct nfs_server));
1451 /* Zero out the NFS state stuff */ 1453 /* Zero out the NFS state stuff */
1452 init_nfsv4_state(server); 1454 init_nfsv4_state(server);
1455 server->client = server->client_sys = ERR_PTR(-EINVAL);
1453 1456
1454 root = &server->fh; 1457 root = &server->fh;
1455 if (data->flags & NFS_MOUNT_VER3) 1458 if (data->flags & NFS_MOUNT_VER3)
@@ -1506,9 +1509,9 @@ static void nfs_kill_super(struct super_block *s)
1506 1509
1507 kill_anon_super(s); 1510 kill_anon_super(s);
1508 1511
1509 if (server->client != NULL && !IS_ERR(server->client)) 1512 if (!IS_ERR(server->client))
1510 rpc_shutdown_client(server->client); 1513 rpc_shutdown_client(server->client);
1511 if (server->client_sys != NULL && !IS_ERR(server->client_sys)) 1514 if (!IS_ERR(server->client_sys))
1512 rpc_shutdown_client(server->client_sys); 1515 rpc_shutdown_client(server->client_sys);
1513 1516
1514 if (!(server->flags & NFS_MOUNT_NONLM)) 1517 if (!(server->flags & NFS_MOUNT_NONLM))
@@ -1650,7 +1653,7 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data,
1650 } 1653 }
1651 1654
1652 down_write(&clp->cl_sem); 1655 down_write(&clp->cl_sem);
1653 if (clp->cl_rpcclient == NULL) { 1656 if (IS_ERR(clp->cl_rpcclient)) {
1654 xprt = xprt_create_proto(proto, &server->addr, &timeparms); 1657 xprt = xprt_create_proto(proto, &server->addr, &timeparms);
1655 if (IS_ERR(xprt)) { 1658 if (IS_ERR(xprt)) {
1656 up_write(&clp->cl_sem); 1659 up_write(&clp->cl_sem);
@@ -1711,9 +1714,12 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data,
1711 } 1714 }
1712 1715
1713 if (clnt->cl_auth->au_flavor != authflavour) { 1716 if (clnt->cl_auth->au_flavor != authflavour) {
1714 if (rpcauth_create(authflavour, clnt) == NULL) { 1717 struct rpc_auth *auth;
1718
1719 auth = rpcauth_create(authflavour, clnt);
1720 if (IS_ERR(auth)) {
1715 dprintk("%s: couldn't create credcache!\n", __FUNCTION__); 1721 dprintk("%s: couldn't create credcache!\n", __FUNCTION__);
1716 return -ENOMEM; 1722 return PTR_ERR(auth);
1717 } 1723 }
1718 } 1724 }
1719 1725
@@ -1788,6 +1794,7 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
1788 memset(server, 0, sizeof(struct nfs_server)); 1794 memset(server, 0, sizeof(struct nfs_server));
1789 /* Zero out the NFS state stuff */ 1795 /* Zero out the NFS state stuff */
1790 init_nfsv4_state(server); 1796 init_nfsv4_state(server);
1797 server->client = server->client_sys = ERR_PTR(-EINVAL);
1791 1798
1792 p = nfs_copy_user_string(NULL, &data->hostname, 256); 1799 p = nfs_copy_user_string(NULL, &data->hostname, 256);
1793 if (IS_ERR(p)) 1800 if (IS_ERR(p))
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 17b187f2d776..591ad1d51880 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -110,6 +110,7 @@ nfs4_alloc_client(struct in_addr *addr)
110 INIT_LIST_HEAD(&clp->cl_superblocks); 110 INIT_LIST_HEAD(&clp->cl_superblocks);
111 init_waitqueue_head(&clp->cl_waitq); 111 init_waitqueue_head(&clp->cl_waitq);
112 rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS4 client"); 112 rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS4 client");
113 clp->cl_rpcclient = ERR_PTR(-EINVAL);
113 clp->cl_boot_time = CURRENT_TIME; 114 clp->cl_boot_time = CURRENT_TIME;
114 clp->cl_state = 1 << NFS4CLNT_OK; 115 clp->cl_state = 1 << NFS4CLNT_OK;
115 return clp; 116 return clp;
@@ -131,7 +132,7 @@ nfs4_free_client(struct nfs4_client *clp)
131 if (clp->cl_cred) 132 if (clp->cl_cred)
132 put_rpccred(clp->cl_cred); 133 put_rpccred(clp->cl_cred);
133 nfs_idmap_delete(clp); 134 nfs_idmap_delete(clp);
134 if (clp->cl_rpcclient) 135 if (!IS_ERR(clp->cl_rpcclient))
135 rpc_shutdown_client(clp->cl_rpcclient); 136 rpc_shutdown_client(clp->cl_rpcclient);
136 kfree(clp); 137 kfree(clp);
137 nfs_callback_down(); 138 nfs_callback_down();