Re: [PATCH Version 1 08/11] SUNRPC: add rpc_drain_queue to empty an rpc_waitq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2012-03-16 at 11:13 -0400, Andy Adamson wrote:
> On Thu, Mar 15, 2012 at 8:10 PM, Myklebust, Trond
> <Trond.Myklebust@xxxxxxxxxx> wrote:
> > On Thu, 2012-03-15 at 14:40 -0400, andros@xxxxxxxxxx wrote:
> >> From: Andy Adamson <andros@xxxxxxxxxx>
> >>
> >> Signed-off-by: Andy Adamson <andros@xxxxxxxxxx>
> >> ---
> >>  include/linux/sunrpc/sched.h |    1 +
> >>  net/sunrpc/sched.c           |   27 +++++++++++++++++++++++++++
> >>  2 files changed, 28 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
> >> index dc0c3cc..fce0873 100644
> >> --- a/include/linux/sunrpc/sched.h
> >> +++ b/include/linux/sunrpc/sched.h
> >> @@ -235,6 +235,7 @@ void              rpc_sleep_on_priority(struct rpc_wait_queue *,
> >>  void         rpc_wake_up_queued_task(struct rpc_wait_queue *,
> >>                                       struct rpc_task *);
> >>  void         rpc_wake_up(struct rpc_wait_queue *);
> >> +void         rpc_drain_queue(struct rpc_wait_queue *);
> >>  struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
> >>  struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
> >>                                       bool (*)(struct rpc_task *, void *),
> >> diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
> >> index 1c570a8..11928ff 100644
> >> --- a/net/sunrpc/sched.c
> >> +++ b/net/sunrpc/sched.c
> >> @@ -551,6 +551,33 @@ void rpc_wake_up(struct rpc_wait_queue *queue)
> >>  EXPORT_SYMBOL_GPL(rpc_wake_up);
> >>
> >>  /**
> >> + * rpc_drain_queue - empty the queue and wake up all rpc_tasks
> >> + * @queue: rpc_wait_queue on which the tasks are sleeping
> >> + *
> >> + * Grabs queue->lock
> >> + */
> >> +void rpc_drain_queue(struct rpc_wait_queue *queue)
> >> +{
> >> +     struct rpc_task *task;
> >> +     struct list_head *head;
> >> +
> >> +     spin_lock_bh(&queue->lock);
> >> +     head = &queue->tasks[queue->maxpriority];
> >> +     for (;;) {
> >> +             while (!list_empty(head)) {
> >> +                     task = list_entry(head->next, struct rpc_task,
> >> +                                       u.tk_wait.list);
> >> +                     rpc_wake_up_task_queue_locked(queue, task);
> >> +             }
> >> +             if (head == &queue->tasks[0])
> >> +                     break;
> >> +             head--;
> >> +     }
> >> +     spin_unlock_bh(&queue->lock);
> >> +}
> >> +EXPORT_SYMBOL_GPL(rpc_drain_queue);
> >> +
> >
> > Confused... How is this function any different from rpc_wake_up()?
> 
> Because it actually drains the queues where rpc_wake_up does not.  See
> the attached output where I added the same printks to both
> rpc_drain_queue and rpc_wake_up.

So you are seeing a bug in rpc_wake_up()? I'm surprised; a bug of that
magnitude should have caused a lot of hangs. Can you please look into
what is happening.

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux