From: Joe Thornber <thornber@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Joe Thornber <ejt@redhat.com>, dm-devel@redhat.com
Subject: Re: [PATCH 3/4] [block-manager] remove spurious decrement of write_lock_pending in the case of a recycled block.
Date: Thu, 4 Aug 2011 10:06:36 +0100 [thread overview]
Message-ID: <20110804090635.GA3509@ubuntu> (raw)
In-Reply-To: <Pine.LNX.4.64.1108031043020.28467@hs20-bc2-1.build.redhat.com>
On Wed, Aug 03, 2011 at 10:50:33AM -0400, Mikulas Patocka wrote:
> I think this is not correct.
I had a similar thought last night, however my concern was the
previous 'read' patch that you've acked. I'll go back and look at
these today.
- Joe
>
> The problem here is that the block may have been recycled and the newly
> created block may have the same block number as the old block.
>
> If b->where != block, we know that the block was recycled.
> If b->where == block, the block may have been recycled or not and we
> don't know.
>
>
> I think the correct solution could be: make write_lock_pending a boolean
> variable, not a counter.
>
> Set write_lock_pending inside __wait_block when we are about to wait (the
> block may have been recycled each time we waited, so we need to set it
> each time we are going to wait)
> Clear write_lock_pending when __wait_unlocked exits.
>
> If we make it a boolean variable, double clearing makes no harm.
>
> Mikulas
>
> On Tue, 2 Aug 2011, Joe Thornber wrote:
>
> > ---
> > drivers/md/persistent-data/dm-block-manager.c | 8 +++++++-
> > 1 files changed, 7 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/md/persistent-data/dm-block-manager.c b/drivers/md/persistent-data/dm-block-manager.c
> > index b68be88..d27ab6e 100644
> > --- a/drivers/md/persistent-data/dm-block-manager.c
> > +++ b/drivers/md/persistent-data/dm-block-manager.c
> > @@ -756,9 +756,15 @@ retry:
> >
> > b->write_lock_pending++;
> > __wait_unlocked(b, &flags);
> > - b->write_lock_pending--;
> > if (b->where != block)
> > + /*
> > + * Recycled blocks have their
> > + * write_lock_pending count reset
> > + * to zero, so no need to undo the
> > + * above increment.
> > + */
> > goto retry;
> > + b->write_lock_pending--;
> > }
> > break;
> > }
> > --
> > 1.7.4.1
> >
next prev parent reply other threads:[~2011-08-04 9:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 21:00 Review of dm-block-manager.c Mikulas Patocka
2011-08-01 21:17 ` Mike Snitzer
2011-08-02 0:15 ` Mike Snitzer
2011-08-02 0:30 ` Mike Snitzer
2011-08-02 13:07 ` Joe Thornber
2011-08-02 13:29 ` Joe Thornber
2011-08-02 14:36 ` [PATCH 1/4] The return code from the various wait functions is never acted upon. So change to uninterrupible waits and change the return type to void Joe Thornber
2011-08-02 14:36 ` [PATCH 2/4] Fix a race between reading a new block and having it recycled Joe Thornber
2011-08-03 14:53 ` Mikulas Patocka
2011-08-02 14:36 ` [PATCH 3/4] [block-manager] remove spurious decrement of write_lock_pending in the case of a recycled block Joe Thornber
2011-08-03 14:50 ` Mikulas Patocka
2011-08-04 9:06 ` Joe Thornber [this message]
2011-08-02 14:36 ` [PATCH 4/4] Track errored blocks Joe Thornber
2011-08-03 15:00 ` Mikulas Patocka
2011-08-03 14:42 ` [PATCH 1/4] The return code from the various wait functions is never acted upon. So change to uninterrupible waits and change the return type to void Mikulas Patocka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110804090635.GA3509@ubuntu \
--to=thornber@redhat.com \
--cc=dm-devel@redhat.com \
--cc=ejt@redhat.com \
--cc=mpatocka@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.