On Sat, Nov 13, 2010 at 02:24:05PM +0000, Stefan Hajnoczi wrote:
> Does this fix the issue?  Compiled but not tested.
> 
> Subject: [PATCH] drbd: Use irqsave/irqrestore for req_mod() in 
> drbd_endio_pri()
> 
> It is not safe to call req_mod() from drbd_endio_pri() since it uses
> spin_lock_irq()/spin_unlock_irq().  Instead use irqsave/irqrestore and
> call __req_mod() so that local irq mode is preserved.

Right, thanks for your work.

See also my other post.

I previously only "fixed" req_mod(),
wondering why that would show up only now.
But then found the other commit that broke it, back in August, which
contained a chunk that basically looks like your below patch, reversed
  :(

So it's fixed in our internal git already,
the fix should show up in public git early next week.

> Signed-off-by: Stefan Hajnoczi <[email protected]>
> ---
>  drivers/block/drbd/drbd_worker.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/block/drbd/drbd_worker.c 
> b/drivers/block/drbd/drbd_worker.c
> index b0551ba..b136fb8 100644
> --- a/drivers/block/drbd/drbd_worker.c
> +++ b/drivers/block/drbd/drbd_worker.c
> @@ -197,6 +197,8 @@ void drbd_endio_pri(struct bio *bio, int error)
>       struct drbd_request *req = bio->bi_private;
>       struct drbd_conf *mdev = req->mdev;
>       enum drbd_req_event what;
> +     struct bio_and_error m;
> +     unsigned long flags;
>       int uptodate = bio_flagged(bio, BIO_UPTODATE);
>  
>       if (!error && !uptodate) {
> @@ -221,7 +223,12 @@ void drbd_endio_pri(struct bio *bio, int error)
>       bio_put(req->private_bio);
>       req->private_bio = ERR_PTR(error);
>  
> -     req_mod(req, what);
> +     spin_lock_irqsave(&mdev->req_lock, flags);
> +     __req_mod(req, what, &m);
> +     spin_unlock_irqrestore(&mdev->req_lock, flags);
> +
> +     if (m.bio)
> +             complete_master_bio(mdev, &m);
>  }
>  
>  int w_read_retry_remote(struct drbd_conf *mdev, struct drbd_work *w, int 
> cancel)
> -- 
> 1.7.2.3
> 

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
__
please don't Cc me, but send to list   --   I'm subscribed
_______________________________________________
drbd-user mailing list
[email protected]
http://lists.linbit.com/mailman/listinfo/drbd-user

Reply via email to