diff options
author | \"J. Bruce Fields\ <bfields@citi.umich.edu> | 2008-12-23 16:15:44 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-12-23 16:15:44 -0500 |
commit | 5b7ddd4a7b19f913901140ef7807dbf5e2b301cd (patch) | |
tree | 24ecff49a5dfeadb66a5805cc84abd580f52e994 /net/sunrpc/auth_gss/auth_gss.c | |
parent | 79a3f20b641f9f93787ada49d1d7cfa98ee5a11e (diff) |
rpc: store pointer to pipe inode in gss upcall message
Keep a pointer to the inode that the message is queued on in the struct
gss_upcall_msg. This will be convenient, especially after we have a
choice of two pipes that an upcall could be queued on.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_gss/auth_gss.c')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index e451d104a434..fe06acd6029b 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -234,6 +234,7 @@ struct gss_upcall_msg { | |||
234 | struct rpc_pipe_msg msg; | 234 | struct rpc_pipe_msg msg; |
235 | struct list_head list; | 235 | struct list_head list; |
236 | struct gss_auth *auth; | 236 | struct gss_auth *auth; |
237 | struct rpc_inode *inode; | ||
237 | struct rpc_wait_queue rpc_waitqueue; | 238 | struct rpc_wait_queue rpc_waitqueue; |
238 | wait_queue_head_t waitqueue; | 239 | wait_queue_head_t waitqueue; |
239 | struct gss_cl_ctx *ctx; | 240 | struct gss_cl_ctx *ctx; |
@@ -296,8 +297,8 @@ __gss_find_upcall(struct rpc_inode *rpci, uid_t uid) | |||
296 | static inline struct gss_upcall_msg * | 297 | static inline struct gss_upcall_msg * |
297 | gss_add_msg(struct gss_auth *gss_auth, struct gss_upcall_msg *gss_msg) | 298 | gss_add_msg(struct gss_auth *gss_auth, struct gss_upcall_msg *gss_msg) |
298 | { | 299 | { |
299 | struct inode *inode = gss_auth->dentry->d_inode; | 300 | struct rpc_inode *rpci = gss_msg->inode; |
300 | struct rpc_inode *rpci = RPC_I(inode); | 301 | struct inode *inode = &rpci->vfs_inode; |
301 | struct gss_upcall_msg *old; | 302 | struct gss_upcall_msg *old; |
302 | 303 | ||
303 | spin_lock(&inode->i_lock); | 304 | spin_lock(&inode->i_lock); |
@@ -323,8 +324,7 @@ __gss_unhash_msg(struct gss_upcall_msg *gss_msg) | |||
323 | static void | 324 | static void |
324 | gss_unhash_msg(struct gss_upcall_msg *gss_msg) | 325 | gss_unhash_msg(struct gss_upcall_msg *gss_msg) |
325 | { | 326 | { |
326 | struct gss_auth *gss_auth = gss_msg->auth; | 327 | struct inode *inode = &gss_msg->inode->vfs_inode; |
327 | struct inode *inode = gss_auth->dentry->d_inode; | ||
328 | 328 | ||
329 | if (list_empty(&gss_msg->list)) | 329 | if (list_empty(&gss_msg->list)) |
330 | return; | 330 | return; |
@@ -340,7 +340,7 @@ gss_upcall_callback(struct rpc_task *task) | |||
340 | struct gss_cred *gss_cred = container_of(task->tk_msg.rpc_cred, | 340 | struct gss_cred *gss_cred = container_of(task->tk_msg.rpc_cred, |
341 | struct gss_cred, gc_base); | 341 | struct gss_cred, gc_base); |
342 | struct gss_upcall_msg *gss_msg = gss_cred->gc_upcall; | 342 | struct gss_upcall_msg *gss_msg = gss_cred->gc_upcall; |
343 | struct inode *inode = gss_msg->auth->dentry->d_inode; | 343 | struct inode *inode = &gss_msg->inode->vfs_inode; |
344 | 344 | ||
345 | spin_lock(&inode->i_lock); | 345 | spin_lock(&inode->i_lock); |
346 | if (gss_msg->ctx) | 346 | if (gss_msg->ctx) |
@@ -367,6 +367,7 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) | |||
367 | kfree(gss_msg); | 367 | kfree(gss_msg); |
368 | return ERR_PTR(vers); | 368 | return ERR_PTR(vers); |
369 | } | 369 | } |
370 | gss_msg->inode = RPC_I(gss_auth->dentry->d_inode); | ||
370 | INIT_LIST_HEAD(&gss_msg->list); | 371 | INIT_LIST_HEAD(&gss_msg->list); |
371 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); | 372 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); |
372 | init_waitqueue_head(&gss_msg->waitqueue); | 373 | init_waitqueue_head(&gss_msg->waitqueue); |
@@ -395,7 +396,8 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr | |||
395 | return gss_new; | 396 | return gss_new; |
396 | gss_msg = gss_add_msg(gss_auth, gss_new); | 397 | gss_msg = gss_add_msg(gss_auth, gss_new); |
397 | if (gss_msg == gss_new) { | 398 | if (gss_msg == gss_new) { |
398 | int res = rpc_queue_upcall(gss_auth->dentry->d_inode, &gss_new->msg); | 399 | struct inode *inode = &gss_new->inode->vfs_inode; |
400 | int res = rpc_queue_upcall(inode, &gss_new->msg); | ||
399 | if (res) { | 401 | if (res) { |
400 | gss_unhash_msg(gss_new); | 402 | gss_unhash_msg(gss_new); |
401 | gss_msg = ERR_PTR(res); | 403 | gss_msg = ERR_PTR(res); |
@@ -426,7 +428,7 @@ gss_refresh_upcall(struct rpc_task *task) | |||
426 | struct gss_cred *gss_cred = container_of(cred, | 428 | struct gss_cred *gss_cred = container_of(cred, |
427 | struct gss_cred, gc_base); | 429 | struct gss_cred, gc_base); |
428 | struct gss_upcall_msg *gss_msg; | 430 | struct gss_upcall_msg *gss_msg; |
429 | struct inode *inode = gss_auth->dentry->d_inode; | 431 | struct inode *inode; |
430 | int err = 0; | 432 | int err = 0; |
431 | 433 | ||
432 | dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid, | 434 | dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid, |
@@ -444,6 +446,7 @@ gss_refresh_upcall(struct rpc_task *task) | |||
444 | err = PTR_ERR(gss_msg); | 446 | err = PTR_ERR(gss_msg); |
445 | goto out; | 447 | goto out; |
446 | } | 448 | } |
449 | inode = &gss_msg->inode->vfs_inode; | ||
447 | spin_lock(&inode->i_lock); | 450 | spin_lock(&inode->i_lock); |
448 | if (gss_cred->gc_upcall != NULL) | 451 | if (gss_cred->gc_upcall != NULL) |
449 | rpc_sleep_on(&gss_cred->gc_upcall->rpc_waitqueue, task, NULL); | 452 | rpc_sleep_on(&gss_cred->gc_upcall->rpc_waitqueue, task, NULL); |
@@ -470,7 +473,7 @@ out: | |||
470 | static inline int | 473 | static inline int |
471 | gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred) | 474 | gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred) |
472 | { | 475 | { |
473 | struct inode *inode = gss_auth->dentry->d_inode; | 476 | struct inode *inode; |
474 | struct rpc_cred *cred = &gss_cred->gc_base; | 477 | struct rpc_cred *cred = &gss_cred->gc_base; |
475 | struct gss_upcall_msg *gss_msg; | 478 | struct gss_upcall_msg *gss_msg; |
476 | DEFINE_WAIT(wait); | 479 | DEFINE_WAIT(wait); |
@@ -492,6 +495,7 @@ retry: | |||
492 | err = PTR_ERR(gss_msg); | 495 | err = PTR_ERR(gss_msg); |
493 | goto out; | 496 | goto out; |
494 | } | 497 | } |
498 | inode = &gss_msg->inode->vfs_inode; | ||
495 | for (;;) { | 499 | for (;;) { |
496 | prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_INTERRUPTIBLE); | 500 | prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_INTERRUPTIBLE); |
497 | spin_lock(&inode->i_lock); | 501 | spin_lock(&inode->i_lock); |