[pnfs] [PATCH] share one session for mds and ds
Marc Eshel
eshel at almaden.ibm.com
Fri Mar 16 02:58:17 EDT 2007
From: Marc Eshel <eshel at almaden.ibm.com>
---
fs/nfs/nfs4filelayoutdev.c | 37 +++++++++++++++++++++++++------------
1 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index acb36fa..f1fa3fa 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -117,7 +117,15 @@ device_create(struct nfs_server *server,
goto out;
}
- dprintk("device_create: dev_id=%u, ip=%x, port=%hu\n", dev->dev_id, ntohl(dev->ip_addr), ntohs(dev->port));
+ dprintk("device_create: dev_id=%u, ip=%x, port=%hu\n",
+ dev->dev_id, ntohl(dev->ip_addr), ntohs(dev->port));
+
+ if (PTR_ERR(clp->cl_rpcclient) != -EINVAL) {
+ dprintk("device_create: dev_id=%u got rpc client\n",
+ dev->dev_id);
+ dev->clp = clp;
+ goto out;
+ }
xprt = xprt_create_proto(IPPROTO_TCP, &sin,
&mds_rpc->cl_xprt->timeout);
@@ -146,12 +154,16 @@ device_destroy(struct nfs4_pnfs_dev_item
if (!dev)
return;
- if ((status = _nfs4_proc_destroy_session(&dev->clp->cl_session, dev->clp->cl_rpcclient)))
- printk(KERN_WARNING "destroy session on data server failed with status %d...\
+ //??? if shared with MDS jsut return
+ if (dev->clp->cl_exchange_flags & EXCHGID4_FLAG_USE_PNFS_DS) {
+
+ if ((status = _nfs4_proc_destroy_session(&dev->clp->cl_session, dev->clp->cl_rpcclient)))
+ printk(KERN_WARNING "destroy session on data server failed with status %d...\
blowing away device anyways!\n", status);
- /* BUG_ON(!atomic_sub_and_test(0, &dev->count)); */
- rpc_shutdown_client(dev->clp->cl_rpcclient);
+ /* BUG_ON(!atomic_sub_and_test(0, &dev->count)); */
+ rpc_shutdown_client(dev->clp->cl_rpcclient);
+ }
kfree(dev);
}
@@ -217,14 +229,15 @@ nfs4_pnfs_device_add(struct filelayout_m
return err;
}
- /* Set exchange id and create session flags */
- dev->clp->cl_session_flags = 0;
- dev->clp->cl_exchange_flags = EXCHGID4_FLAG_USE_PNFS_DS;
-
- err = server->rpc_ops->setup_session(dev->clp);
- if (err)
- return err;
+ if (dev->clp->cl_session == NULL) {
+ /* Set exchange id and create session flags */
+ dev->clp->cl_session_flags = 0;
+ dev->clp->cl_exchange_flags = EXCHGID4_FLAG_USE_PNFS_DS;
+ err = server->rpc_ops->setup_session(dev->clp);
+ if (err)
+ return err;
+ }
/* Write lock, do lookup again, and then add device */
write_lock(&hlist->dev_lock);
tmp_dev = _device_lookup(hlist, dev->dev_id);
More information about the pNFS
mailing list