diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-07 15:31:36 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:32 -0400 |
commit | 6e84c7b66a0aa0be16a7728d1e687c57978dac2c (patch) | |
tree | 0aa7ab3d44b1749dca78d554f1d18a5b6fad43ff | |
parent | 3b68aaeaf54065e5c44583a1d33ffb7793953ba4 (diff) |
SUNRPC: Add a downcall queue to struct rpc_inode
Currently, the downcall queue is tied to the struct gss_auth, which means
that different RPCSEC_GSS pseudoflavours must use different upcall pipes.
Add a list to struct rpc_inode that can be used instead.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | include/linux/sunrpc/rpc_pipe_fs.h | 1 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 29 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 1 |
3 files changed, 12 insertions, 19 deletions
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index ad293760f6eb..430cea104817 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h | |||
@@ -23,6 +23,7 @@ struct rpc_inode { | |||
23 | void *private; | 23 | void *private; |
24 | struct list_head pipe; | 24 | struct list_head pipe; |
25 | struct list_head in_upcall; | 25 | struct list_head in_upcall; |
26 | struct list_head in_downcall; | ||
26 | int pipelen; | 27 | int pipelen; |
27 | int nreaders; | 28 | int nreaders; |
28 | int nwriters; | 29 | int nwriters; |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index e407a352440f..50809086fa1b 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -85,7 +85,6 @@ struct gss_auth { | |||
85 | struct rpc_auth rpc_auth; | 85 | struct rpc_auth rpc_auth; |
86 | struct gss_api_mech *mech; | 86 | struct gss_api_mech *mech; |
87 | enum rpc_gss_svc service; | 87 | enum rpc_gss_svc service; |
88 | struct list_head upcalls; | ||
89 | struct rpc_clnt *client; | 88 | struct rpc_clnt *client; |
90 | struct dentry *dentry; | 89 | struct dentry *dentry; |
91 | }; | 90 | }; |
@@ -268,10 +267,10 @@ gss_release_msg(struct gss_upcall_msg *gss_msg) | |||
268 | } | 267 | } |
269 | 268 | ||
270 | static struct gss_upcall_msg * | 269 | static struct gss_upcall_msg * |
271 | __gss_find_upcall(struct gss_auth *gss_auth, uid_t uid) | 270 | __gss_find_upcall(struct rpc_inode *rpci, uid_t uid) |
272 | { | 271 | { |
273 | struct gss_upcall_msg *pos; | 272 | struct gss_upcall_msg *pos; |
274 | list_for_each_entry(pos, &gss_auth->upcalls, list) { | 273 | list_for_each_entry(pos, &rpci->in_downcall, list) { |
275 | if (pos->uid != uid) | 274 | if (pos->uid != uid) |
276 | continue; | 275 | continue; |
277 | atomic_inc(&pos->count); | 276 | atomic_inc(&pos->count); |
@@ -290,13 +289,14 @@ static inline struct gss_upcall_msg * | |||
290 | gss_add_msg(struct gss_auth *gss_auth, struct gss_upcall_msg *gss_msg) | 289 | gss_add_msg(struct gss_auth *gss_auth, struct gss_upcall_msg *gss_msg) |
291 | { | 290 | { |
292 | struct inode *inode = gss_auth->dentry->d_inode; | 291 | struct inode *inode = gss_auth->dentry->d_inode; |
292 | struct rpc_inode *rpci = RPC_I(inode); | ||
293 | struct gss_upcall_msg *old; | 293 | struct gss_upcall_msg *old; |
294 | 294 | ||
295 | spin_lock(&inode->i_lock); | 295 | spin_lock(&inode->i_lock); |
296 | old = __gss_find_upcall(gss_auth, gss_msg->uid); | 296 | old = __gss_find_upcall(rpci, gss_msg->uid); |
297 | if (old == NULL) { | 297 | if (old == NULL) { |
298 | atomic_inc(&gss_msg->count); | 298 | atomic_inc(&gss_msg->count); |
299 | list_add(&gss_msg->list, &gss_auth->upcalls); | 299 | list_add(&gss_msg->list, &rpci->in_downcall); |
300 | } else | 300 | } else |
301 | gss_msg = old; | 301 | gss_msg = old; |
302 | spin_unlock(&inode->i_lock); | 302 | spin_unlock(&inode->i_lock); |
@@ -493,7 +493,6 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
493 | const void *p, *end; | 493 | const void *p, *end; |
494 | void *buf; | 494 | void *buf; |
495 | struct rpc_clnt *clnt; | 495 | struct rpc_clnt *clnt; |
496 | struct gss_auth *gss_auth; | ||
497 | struct gss_upcall_msg *gss_msg; | 496 | struct gss_upcall_msg *gss_msg; |
498 | struct inode *inode = filp->f_path.dentry->d_inode; | 497 | struct inode *inode = filp->f_path.dentry->d_inode; |
499 | struct gss_cl_ctx *ctx; | 498 | struct gss_cl_ctx *ctx; |
@@ -526,9 +525,8 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
526 | 525 | ||
527 | err = -ENOENT; | 526 | err = -ENOENT; |
528 | /* Find a matching upcall */ | 527 | /* Find a matching upcall */ |
529 | gss_auth = container_of(clnt->cl_auth, struct gss_auth, rpc_auth); | ||
530 | spin_lock(&inode->i_lock); | 528 | spin_lock(&inode->i_lock); |
531 | gss_msg = __gss_find_upcall(gss_auth, uid); | 529 | gss_msg = __gss_find_upcall(RPC_I(inode), uid); |
532 | if (gss_msg == NULL) { | 530 | if (gss_msg == NULL) { |
533 | spin_unlock(&inode->i_lock); | 531 | spin_unlock(&inode->i_lock); |
534 | goto err_put_ctx; | 532 | goto err_put_ctx; |
@@ -536,7 +534,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
536 | list_del_init(&gss_msg->list); | 534 | list_del_init(&gss_msg->list); |
537 | spin_unlock(&inode->i_lock); | 535 | spin_unlock(&inode->i_lock); |
538 | 536 | ||
539 | p = gss_fill_context(p, end, ctx, gss_auth->mech); | 537 | p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); |
540 | if (IS_ERR(p)) { | 538 | if (IS_ERR(p)) { |
541 | err = PTR_ERR(p); | 539 | err = PTR_ERR(p); |
542 | gss_msg->msg.errno = (err == -EACCES) ? -EACCES : -EAGAIN; | 540 | gss_msg->msg.errno = (err == -EACCES) ? -EACCES : -EAGAIN; |
@@ -563,18 +561,12 @@ static void | |||
563 | gss_pipe_release(struct inode *inode) | 561 | gss_pipe_release(struct inode *inode) |
564 | { | 562 | { |
565 | struct rpc_inode *rpci = RPC_I(inode); | 563 | struct rpc_inode *rpci = RPC_I(inode); |
566 | struct rpc_clnt *clnt; | 564 | struct gss_upcall_msg *gss_msg; |
567 | struct rpc_auth *auth; | ||
568 | struct gss_auth *gss_auth; | ||
569 | 565 | ||
570 | clnt = rpci->private; | ||
571 | auth = clnt->cl_auth; | ||
572 | gss_auth = container_of(auth, struct gss_auth, rpc_auth); | ||
573 | spin_lock(&inode->i_lock); | 566 | spin_lock(&inode->i_lock); |
574 | while (!list_empty(&gss_auth->upcalls)) { | 567 | while (!list_empty(&rpci->in_downcall)) { |
575 | struct gss_upcall_msg *gss_msg; | ||
576 | 568 | ||
577 | gss_msg = list_entry(gss_auth->upcalls.next, | 569 | gss_msg = list_entry(rpci->in_downcall.next, |
578 | struct gss_upcall_msg, list); | 570 | struct gss_upcall_msg, list); |
579 | gss_msg->msg.errno = -EPIPE; | 571 | gss_msg->msg.errno = -EPIPE; |
580 | atomic_inc(&gss_msg->count); | 572 | atomic_inc(&gss_msg->count); |
@@ -637,7 +629,6 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
637 | gss_auth->service = gss_pseudoflavor_to_service(gss_auth->mech, flavor); | 629 | gss_auth->service = gss_pseudoflavor_to_service(gss_auth->mech, flavor); |
638 | if (gss_auth->service == 0) | 630 | if (gss_auth->service == 0) |
639 | goto err_put_mech; | 631 | goto err_put_mech; |
640 | INIT_LIST_HEAD(&gss_auth->upcalls); | ||
641 | auth = &gss_auth->rpc_auth; | 632 | auth = &gss_auth->rpc_auth; |
642 | auth->au_cslack = GSS_CRED_SLACK >> 2; | 633 | auth->au_cslack = GSS_CRED_SLACK >> 2; |
643 | auth->au_rslack = GSS_VERF_SLACK >> 2; | 634 | auth->au_rslack = GSS_VERF_SLACK >> 2; |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 826190dacfce..2320f1e42da4 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -833,6 +833,7 @@ init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) | |||
833 | rpci->nreaders = 0; | 833 | rpci->nreaders = 0; |
834 | rpci->nwriters = 0; | 834 | rpci->nwriters = 0; |
835 | INIT_LIST_HEAD(&rpci->in_upcall); | 835 | INIT_LIST_HEAD(&rpci->in_upcall); |
836 | INIT_LIST_HEAD(&rpci->in_downcall); | ||
836 | INIT_LIST_HEAD(&rpci->pipe); | 837 | INIT_LIST_HEAD(&rpci->pipe); |
837 | rpci->pipelen = 0; | 838 | rpci->pipelen = 0; |
838 | init_waitqueue_head(&rpci->waitq); | 839 | init_waitqueue_head(&rpci->waitq); |