dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Christophe Varoqui <christophe.varoqui@gmail.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: [PATCH] multipath: fix multipath locking
Date: Fri, 05 Nov 2010 08:11:31 +0100	[thread overview]
Message-ID: <1288941091.16233.14.camel@zezette> (raw)
In-Reply-To: <20101105055952.GA9165@us.ibm.com>

Applied with fix,
Thanks.

On jeu., 2010-11-04 at 22:59 -0700, Malahal Naineni wrote:
> Benjamin Marzinski [bmarzins@redhat.com] wrote:
> > @@ -294,12 +295,25 @@ lock_multipath (struct multipath * mpp, 
> >  		vector_foreach_slot(pgp->paths, pp, j) {
> >  			if (lock && flock(pp->fd, LOCK_EX | LOCK_NB) &&
> >  			    errno == EWOULDBLOCK)
> > -				return 1;
> > +				goto fail;
> >  			else if (!lock)
> >  				flock(pp->fd, LOCK_UN);
> >  		}
> >  	}
> >  	return 0;
> > +fail:
> > +	vector_foreach_slot (mpp->pg, pgp, x) {
> > +		if (x > i)
> > +			return 1;
> > +		if (!pgp->paths)
> > +			continue;
> > +		vector_foreach_slot(pgp->paths, pp, y) {
> > +			if (x == i && y > j)
> 
> Path 'j' has failed to get the lock dropping us to the fail label.
> We should NOT be unlocking for path "j", so the above if expression
> should be "(x ==i && y >= j)" instead.
> 
> Otherwise, it looks good.
> 
> > +				return 1;
> > +			flock(pp->fd, LOCK_UN);
> > +		}
> > +	}
> > +	return 1;
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

      reply	other threads:[~2010-11-05  7:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-05  4:59 [PATCH] multipath: fix multipath locking Benjamin Marzinski
2010-11-05  5:59 ` Malahal Naineni
2010-11-05  7:11   ` Christophe Varoqui [this message]

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=1288941091.16233.14.camel@zezette \
    --to=christophe.varoqui@gmail.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).