aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4state.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index b7e9793b58f5..3b4d74cbb6c8 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -644,25 +644,45 @@ static void nfsd4_conn_lost(struct svc_xpt_user *u)
644 spin_unlock(&clp->cl_lock); 644 spin_unlock(&clp->cl_lock);
645} 645}
646 646
647static __be32 nfsd4_new_conn(struct svc_rqst *rqstp, struct nfsd4_session *ses) 647static struct nfsd4_conn *alloc_conn(struct svc_rqst *rqstp)
648{ 648{
649 struct nfs4_client *clp = ses->se_client;
650 struct nfsd4_conn *conn; 649 struct nfsd4_conn *conn;
651 650
652 conn = kmalloc(sizeof(struct nfsd4_conn), GFP_KERNEL); 651 conn = kmalloc(sizeof(struct nfsd4_conn), GFP_KERNEL);
653 if (!conn) 652 if (!conn)
654 return nfserr_jukebox; 653 return NULL;
655 conn->cn_flags = NFS4_CDFC4_FORE;
656 svc_xprt_get(rqstp->rq_xprt); 654 svc_xprt_get(rqstp->rq_xprt);
657 conn->cn_xprt = rqstp->rq_xprt; 655 conn->cn_xprt = rqstp->rq_xprt;
658 conn->cn_session = ses; 656 conn->cn_flags = NFS4_CDFC4_FORE;
657 INIT_LIST_HEAD(&conn->cn_xpt_user.list);
658 return conn;
659}
660
661static void nfsd4_hash_conn(struct nfsd4_conn *conn, struct nfsd4_session *ses)
662{
663 struct nfs4_client *clp = ses->se_client;
659 664
660 spin_lock(&clp->cl_lock); 665 spin_lock(&clp->cl_lock);
666 conn->cn_session = ses;
661 list_add(&conn->cn_persession, &ses->se_conns); 667 list_add(&conn->cn_persession, &ses->se_conns);
662 spin_unlock(&clp->cl_lock); 668 spin_unlock(&clp->cl_lock);
669}
663 670
671static void nfsd4_register_conn(struct nfsd4_conn *conn)
672{
664 conn->cn_xpt_user.callback = nfsd4_conn_lost; 673 conn->cn_xpt_user.callback = nfsd4_conn_lost;
665 register_xpt_user(rqstp->rq_xprt, &conn->cn_xpt_user); 674 register_xpt_user(conn->cn_xprt, &conn->cn_xpt_user);
675}
676
677static __be32 nfsd4_new_conn(struct svc_rqst *rqstp, struct nfsd4_session *ses)
678{
679 struct nfsd4_conn *conn;
680
681 conn = alloc_conn(rqstp);
682 if (!conn)
683 return nfserr_jukebox;
684 nfsd4_hash_conn(conn, ses);
685 nfsd4_register_conn(conn);
666 return nfs_ok; 686 return nfs_ok;
667} 687}
668 688