Commit 5b7ddd4a authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Trond Myklebust

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: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 79a3f20b
...@@ -234,6 +234,7 @@ struct gss_upcall_msg { ...@@ -234,6 +234,7 @@ struct gss_upcall_msg {
struct rpc_pipe_msg msg; struct rpc_pipe_msg msg;
struct list_head list; struct list_head list;
struct gss_auth *auth; struct gss_auth *auth;
struct rpc_inode *inode;
struct rpc_wait_queue rpc_waitqueue; struct rpc_wait_queue rpc_waitqueue;
wait_queue_head_t waitqueue; wait_queue_head_t waitqueue;
struct gss_cl_ctx *ctx; struct gss_cl_ctx *ctx;
...@@ -296,8 +297,8 @@ __gss_find_upcall(struct rpc_inode *rpci, uid_t uid) ...@@ -296,8 +297,8 @@ __gss_find_upcall(struct rpc_inode *rpci, uid_t uid)
static inline struct gss_upcall_msg * static inline struct gss_upcall_msg *
gss_add_msg(struct gss_auth *gss_auth, struct gss_upcall_msg *gss_msg) gss_add_msg(struct gss_auth *gss_auth, struct gss_upcall_msg *gss_msg)
{ {
struct inode *inode = gss_auth->dentry->d_inode; struct rpc_inode *rpci = gss_msg->inode;
struct rpc_inode *rpci = RPC_I(inode); struct inode *inode = &rpci->vfs_inode;
struct gss_upcall_msg *old; struct gss_upcall_msg *old;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
...@@ -323,8 +324,7 @@ __gss_unhash_msg(struct gss_upcall_msg *gss_msg) ...@@ -323,8 +324,7 @@ __gss_unhash_msg(struct gss_upcall_msg *gss_msg)
static void static void
gss_unhash_msg(struct gss_upcall_msg *gss_msg) gss_unhash_msg(struct gss_upcall_msg *gss_msg)
{ {
struct gss_auth *gss_auth = gss_msg->auth; struct inode *inode = &gss_msg->inode->vfs_inode;
struct inode *inode = gss_auth->dentry->d_inode;
if (list_empty(&gss_msg->list)) if (list_empty(&gss_msg->list))
return; return;
...@@ -340,7 +340,7 @@ gss_upcall_callback(struct rpc_task *task) ...@@ -340,7 +340,7 @@ gss_upcall_callback(struct rpc_task *task)
struct gss_cred *gss_cred = container_of(task->tk_msg.rpc_cred, struct gss_cred *gss_cred = container_of(task->tk_msg.rpc_cred,
struct gss_cred, gc_base); struct gss_cred, gc_base);
struct gss_upcall_msg *gss_msg = gss_cred->gc_upcall; struct gss_upcall_msg *gss_msg = gss_cred->gc_upcall;
struct inode *inode = gss_msg->auth->dentry->d_inode; struct inode *inode = &gss_msg->inode->vfs_inode;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (gss_msg->ctx) if (gss_msg->ctx)
...@@ -367,6 +367,7 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) ...@@ -367,6 +367,7 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid)
kfree(gss_msg); kfree(gss_msg);
return ERR_PTR(vers); return ERR_PTR(vers);
} }
gss_msg->inode = RPC_I(gss_auth->dentry->d_inode);
INIT_LIST_HEAD(&gss_msg->list); INIT_LIST_HEAD(&gss_msg->list);
rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq");
init_waitqueue_head(&gss_msg->waitqueue); 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,7 +396,8 @@ gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cr
return gss_new; return gss_new;
gss_msg = gss_add_msg(gss_auth, gss_new); gss_msg = gss_add_msg(gss_auth, gss_new);
if (gss_msg == gss_new) { if (gss_msg == gss_new) {
int res = rpc_queue_upcall(gss_auth->dentry->d_inode, &gss_new->msg); struct inode *inode = &gss_new->inode->vfs_inode;
int res = rpc_queue_upcall(inode, &gss_new->msg);
if (res) { if (res) {
gss_unhash_msg(gss_new); gss_unhash_msg(gss_new);
gss_msg = ERR_PTR(res); gss_msg = ERR_PTR(res);
...@@ -426,7 +428,7 @@ gss_refresh_upcall(struct rpc_task *task) ...@@ -426,7 +428,7 @@ gss_refresh_upcall(struct rpc_task *task)
struct gss_cred *gss_cred = container_of(cred, struct gss_cred *gss_cred = container_of(cred,
struct gss_cred, gc_base); struct gss_cred, gc_base);
struct gss_upcall_msg *gss_msg; struct gss_upcall_msg *gss_msg;
struct inode *inode = gss_auth->dentry->d_inode; struct inode *inode;
int err = 0; int err = 0;
dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid, 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,6 +446,7 @@ gss_refresh_upcall(struct rpc_task *task)
err = PTR_ERR(gss_msg); err = PTR_ERR(gss_msg);
goto out; goto out;
} }
inode = &gss_msg->inode->vfs_inode;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (gss_cred->gc_upcall != NULL) if (gss_cred->gc_upcall != NULL)
rpc_sleep_on(&gss_cred->gc_upcall->rpc_waitqueue, task, NULL); rpc_sleep_on(&gss_cred->gc_upcall->rpc_waitqueue, task, NULL);
...@@ -470,7 +473,7 @@ gss_refresh_upcall(struct rpc_task *task) ...@@ -470,7 +473,7 @@ gss_refresh_upcall(struct rpc_task *task)
static inline int static inline int
gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred) gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
{ {
struct inode *inode = gss_auth->dentry->d_inode; struct inode *inode;
struct rpc_cred *cred = &gss_cred->gc_base; struct rpc_cred *cred = &gss_cred->gc_base;
struct gss_upcall_msg *gss_msg; struct gss_upcall_msg *gss_msg;
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
...@@ -492,6 +495,7 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred) ...@@ -492,6 +495,7 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred)
err = PTR_ERR(gss_msg); err = PTR_ERR(gss_msg);
goto out; goto out;
} }
inode = &gss_msg->inode->vfs_inode;
for (;;) { for (;;) {
prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_INTERRUPTIBLE); prepare_to_wait(&gss_msg->waitqueue, &wait, TASK_INTERRUPTIBLE);
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment