Commit 6b2e6856 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker
Browse files

SUNRPC: Add function rpc_sleep_on_timeout()



Clean up the RPC task sleep interfaces by replacing the task->tk_timeout
'hidden parameter' to rpc_sleep_on() with a new function that takes an
absolute timeout.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 8357a9b6
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -978,10 +978,8 @@ int nfs4_setup_sequence(struct nfs_client *client,
	if (res->sr_slot != NULL)
		goto out_start;

	if (session) {
	if (session)
		tbl = &session->fc_slot_table;
		task->tk_timeout = 0;
	}

	spin_lock(&tbl->slot_tbl_lock);
	/* The state manager will wait until the slot table is empty */
@@ -990,9 +988,8 @@ int nfs4_setup_sequence(struct nfs_client *client,

	slot = nfs4_alloc_slot(tbl);
	if (IS_ERR(slot)) {
		/* Try again in 1/4 second */
		if (slot == ERR_PTR(-ENOMEM))
			task->tk_timeout = HZ >> 2;
			goto out_sleep_timeout;
		goto out_sleep;
	}
	spin_unlock(&tbl->slot_tbl_lock);
@@ -1004,7 +1001,16 @@ out_start:
	nfs41_sequence_res_init(res);
	rpc_call_start(task);
	return 0;

out_sleep_timeout:
	/* Try again in 1/4 second */
	if (args->sa_privileged)
		rpc_sleep_on_priority_timeout(&tbl->slot_tbl_waitq, task,
				jiffies + (HZ >> 2), RPC_PRIORITY_PRIVILEGED);
	else
		rpc_sleep_on_timeout(&tbl->slot_tbl_waitq, task,
				NULL, jiffies + (HZ >> 2));
	spin_unlock(&tbl->slot_tbl_lock);
	return -EAGAIN;
out_sleep:
	if (args->sa_privileged)
		rpc_sleep_on_priority(&tbl->slot_tbl_waitq, task,
+8 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ struct rpc_wait {
	struct list_head	list;		/* wait queue links */
	struct list_head	links;		/* Links to related tasks */
	struct list_head	timer_list;	/* Timer list */
	unsigned long		expires;
};

/*
@@ -227,8 +226,16 @@ void rpc_execute(struct rpc_task *);
void		rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
void		rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
void		rpc_destroy_wait_queue(struct rpc_wait_queue *);
void		rpc_sleep_on_timeout(struct rpc_wait_queue *queue,
					struct rpc_task *task,
					rpc_action action,
					unsigned long timeout);
void		rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
					rpc_action action);
void		rpc_sleep_on_priority_timeout(struct rpc_wait_queue *queue,
					struct rpc_task *task,
					unsigned long timeout,
					int priority);
void		rpc_sleep_on_priority(struct rpc_wait_queue *,
					struct rpc_task *,
					int priority);
+2 −3
Original line number Diff line number Diff line
@@ -581,8 +581,8 @@ gss_refresh_upcall(struct rpc_task *task)
		/* XXX: warning on the first, under the assumption we
		 * shouldn't normally hit this case on a refresh. */
		warn_gssd();
		task->tk_timeout = 15*HZ;
		rpc_sleep_on(&pipe_version_rpc_waitqueue, task, NULL);
		rpc_sleep_on_timeout(&pipe_version_rpc_waitqueue,
				task, NULL, jiffies + (15 * HZ));
		err = -EAGAIN;
		goto out;
	}
@@ -595,7 +595,6 @@ gss_refresh_upcall(struct rpc_task *task)
	if (gss_cred->gc_upcall != NULL)
		rpc_sleep_on(&gss_cred->gc_upcall->rpc_waitqueue, task, NULL);
	else if (gss_msg->ctx == NULL && gss_msg->msg.errno >= 0) {
		task->tk_timeout = 0;
		gss_cred->gc_upcall = gss_msg;
		/* gss_upcall_callback will release the reference to gss_upcall_msg */
		refcount_inc(&gss_msg->count);
+0 −1
Original line number Diff line number Diff line
@@ -1851,7 +1851,6 @@ call_bind(struct rpc_task *task)
	if (!xprt_prepare_transmit(task))
		return;

	task->tk_timeout = xprt->bind_timeout;
	xprt->ops->rpcbind(task);
}

+2 −1
Original line number Diff line number Diff line
@@ -694,7 +694,8 @@ void rpcb_getport_async(struct rpc_task *task)

	/* Put self on the wait queue to ensure we get notified if
	 * some other task is already attempting to bind the port */
	rpc_sleep_on(&xprt->binding, task, NULL);
	rpc_sleep_on_timeout(&xprt->binding, task,
			NULL, jiffies + xprt->bind_timeout);

	if (xprt_test_and_set_binding(xprt)) {
		dprintk("RPC: %5u %s: waiting for another binder\n",
Loading