lkml.org 
[lkml]   [2003]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] 2.6.0 NBD driver: remove send/recieve race for request
On Fri, Aug 08 2003, Paul Clements wrote:
> Jens Axboe wrote:
> >
> > On Fri, Aug 08 2003, Lou Langholtz wrote:
> > > >@@ -499,12 +508,14 @@ static void do_nbd_request(request_queue
> > > > lo->disk->disk_name);
> > > > spin_lock(&lo->queue_lock);
> > > > list_del_init(&req->queuelist);
> > > >+ req->ref_count--;
> > > > spin_unlock(&lo->queue_lock);
> > > > nbd_end_request(req);
> > > > spin_lock_irq(q->queue_lock);
> > > > continue;
> > > > }
> > > >
> > > >+ req->ref_count--;
> > > > spin_lock_irq(q->queue_lock);
> > > >
> > > Since ref_count isn't atomic, shouldn't ref_count only be changed while
> > > the queue_lock is held???
> >
> > Indeed, needs to be done after regrabbing the lock.
>
> But req is pulled off of nbd's main request queue at this point, so I
> don't think anyone else could be touching it, could they?

In that case you are right, and it would probably be best not to touch
the reference count at all (just leave it at 1).

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.050 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site