diff options
author | Andy Adamson <andros@netapp.com> | 2011-01-05 21:04:31 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-01-06 14:46:24 -0500 |
commit | 2c2618c6f29c41a0a966f14f05c8bf45fcabb750 (patch) | |
tree | c247cfda9f847028e1d43cab1e69d2cd8a2146a4 /fs/nfs/callback.c | |
parent | f4eecd5da3422e82e88e36c33cbd2595eebcacb1 (diff) |
NFS associate sessionid with callback connection
The sessions based callback service is started prior to the CREATE_SESSION call
so that it can handle CB_NULL requests which can be sent before the
CREATE_SESSION call returns and the session ID is known.
Set the callback sessionid after a sucessful CREATE_SESSION.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/callback.c')
-rw-r--r-- | fs/nfs/callback.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 0e9fae831dfa..c0b05497972b 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -137,6 +137,33 @@ out_err: | |||
137 | 137 | ||
138 | #if defined(CONFIG_NFS_V4_1) | 138 | #if defined(CONFIG_NFS_V4_1) |
139 | /* | 139 | /* |
140 | * * CB_SEQUENCE operations will fail until the callback sessionid is set. | ||
141 | * */ | ||
142 | int nfs4_set_callback_sessionid(struct nfs_client *clp) | ||
143 | { | ||
144 | struct svc_serv *serv = clp->cl_rpcclient->cl_xprt->bc_serv; | ||
145 | struct nfs4_sessionid *bc_sid; | ||
146 | |||
147 | if (!serv->bc_xprt) | ||
148 | return -EINVAL; | ||
149 | |||
150 | /* on success freed in xprt_free */ | ||
151 | bc_sid = kmalloc(sizeof(struct nfs4_sessionid), GFP_KERNEL); | ||
152 | if (!bc_sid) | ||
153 | return -ENOMEM; | ||
154 | memcpy(bc_sid->data, &clp->cl_session->sess_id.data, | ||
155 | NFS4_MAX_SESSIONID_LEN); | ||
156 | spin_lock_bh(&serv->sv_cb_lock); | ||
157 | serv->bc_xprt->xpt_bc_sid = bc_sid; | ||
158 | spin_unlock_bh(&serv->sv_cb_lock); | ||
159 | dprintk("%s set xpt_bc_sid=%u:%u:%u:%u for bc_xprt %p\n", __func__, | ||
160 | ((u32 *)bc_sid->data)[0], ((u32 *)bc_sid->data)[1], | ||
161 | ((u32 *)bc_sid->data)[2], ((u32 *)bc_sid->data)[3], | ||
162 | serv->bc_xprt); | ||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | /* | ||
140 | * The callback service for NFSv4.1 callbacks | 167 | * The callback service for NFSv4.1 callbacks |
141 | */ | 168 | */ |
142 | static int | 169 | static int |
@@ -241,6 +268,10 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt, | |||
241 | struct nfs_callback_data *cb_info) | 268 | struct nfs_callback_data *cb_info) |
242 | { | 269 | { |
243 | } | 270 | } |
271 | int nfs4_set_callback_sessionid(struct nfs_client *clp) | ||
272 | { | ||
273 | return 0; | ||
274 | } | ||
244 | #endif /* CONFIG_NFS_V4_1 */ | 275 | #endif /* CONFIG_NFS_V4_1 */ |
245 | 276 | ||
246 | /* | 277 | /* |