All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Junichi Nomura <j-nomura@ce.jp.nec.com>,
	"dm-devel@redhat.com" <dm-devel@redhat.com>,
	Alasdair Kergon <agk@redhat.com>
Subject: Re: [PATCH 8/8] dm-mpath: do not activate failed paths
Date: Fri, 28 Feb 2014 09:22:31 -0500	[thread overview]
Message-ID: <20140228142230.GA1140@redhat.com> (raw)
In-Reply-To: <53105C4D.50305@suse.de>

On Fri, Feb 28 2014 at  4:52am -0500,
Hannes Reinecke <hare@suse.de> wrote:

> On 02/28/2014 10:37 AM, Junichi Nomura wrote:
> > On 02/28/14 18:32, Hannes Reinecke wrote:
> >> On 02/28/2014 09:49 AM, Junichi Nomura wrote:
> >>> On 02/27/14 16:30, Hannes Reinecke wrote:
> >>>> activate_path() is run without a lock, so the path might be
> >>>> set to failed before activate_path() had a chance to run.
> >>>>
> >>>> Signed-off-by: Hannes Reinecke <hare@suse.de>
> >>>> ---
> >>>>  drivers/md/dm-mpath.c | 7 +++++--
> >>>>  1 file changed, 5 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
> >>>> index 0a40fa9..22e7365 100644
> >>>> --- a/drivers/md/dm-mpath.c
> >>>> +++ b/drivers/md/dm-mpath.c
> >>>> @@ -1196,8 +1196,11 @@ static void activate_path(struct work_struct *work)
> >>>>  	struct pgpath *pgpath =
> >>>>  		container_of(work, struct pgpath, activate_path.work);
> >>>>  
> >>>> -	scsi_dh_activate(bdev_get_queue(pgpath->path.dev->bdev),
> >>>> -				pg_init_done, pgpath);
> >>>> +	if (pgpath->is_active)
> >>>> +		scsi_dh_activate(bdev_get_queue(pgpath->path.dev->bdev),
> >>>> +				 pg_init_done, pgpath);
> >>>> +	else
> >>>> +		pg_init_done(pgpath, SCSI_DH_DEV_OFFLINED);
> >>>
> >>> Hi Hannes,
> >>>
> >>> What problem are you going to fix with this?
> >>> It is still possible that the path is set to failed just after
> >>> "if (pgpath->is_active)" and before "scsi_dh_activate".
> >>>
> >> activate_path() is run from a workqueue, so there is a race window
> >> between the check ->is_active in __pg_init_all_paths() and the time
> >> the scsi_dh_activate() is executed. And as activate_path)() is run
> >> without any locks we don't have any synchronization with fail_path().
> >> So it's well possible that a path gets failed in between
> >> __pg_init_all_paths() and activate_paths().
> > 
> > What I pointed is that your patch makes the window very small
> > but doesn't close it.
> > If the race is a problem, this patch doesn't fix the problem.
> > 
> True. As said I just want to avoid unnecessary overhead by calling
> functions which are known to be failing.
> This patch actually makes more sense in combination with the 'accept
> failed paths' patch, where it's much more likely to trigger.

FYI, I still intend to review/take your "accept failed paths" patch.
Would be helpful if any rebase is needed for that patch that you do so
and re-post.

One thing I noticed is you're only converting MAJ:MIN paths to devices.
I think we should factor a helper out of DM core that does the full path
lookup check from dm_get_device() -- rather than you open coding an
older version of the MAJ:MIN device path processing.

But is there a reason for not using lookup_bdev()?  Because the device
is failed it cannot be found using lookup_bdev()?

  parent reply	other threads:[~2014-02-28 14:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27  7:30 [PATCHv8 0/8] dm-multipath: push back requests instead of queueing Hannes Reinecke
2014-02-27  7:30 ` [PATCH 1/8] dm mpath: do not call pg_init when it is already running Hannes Reinecke
2014-02-27  7:30 ` [PATCH 2/8] dm table: add dm_table_run_md_queue_async Hannes Reinecke
2014-02-27  7:30 ` [PATCH 3/8] dm mpath: push back requests instead of queueing Hannes Reinecke
2014-02-27  7:30 ` [PATCH 4/8] dm mpath: remove process_queued_ios() Hannes Reinecke
2014-02-28  9:05   ` Junichi Nomura
2014-02-28  9:37     ` Hannes Reinecke
2014-02-27  7:30 ` [PATCH 5/8] dm mpath: reduce memory pressure when requeuing Hannes Reinecke
2014-02-27  7:30 ` [PATCH 6/8] dm mpath: remove map_io() Hannes Reinecke
2014-02-28  9:06   ` Junichi Nomura
2014-02-27  7:30 ` [PATCH 7/8] dm mpath: remove extra nesting in map function Hannes Reinecke
2014-02-27  7:30 ` [PATCH 8/8] dm-mpath: do not activate failed paths Hannes Reinecke
2014-02-28  8:49   ` Junichi Nomura
2014-02-28  9:32     ` Hannes Reinecke
2014-02-28  9:37       ` Junichi Nomura
2014-02-28  9:52         ` Hannes Reinecke
2014-02-28 10:08           ` Junichi Nomura
2014-02-28 14:22           ` Mike Snitzer [this message]
2014-02-28 14:44             ` Hannes Reinecke
2014-02-28 15:02               ` Mike Snitzer
2014-02-28 15:08                 ` Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2014-02-28 14:33 [PATCHv9 0/8] dm-multipath: push back requests instead of queueing Hannes Reinecke
2014-02-28 14:33 ` [PATCH 8/8] dm-mpath: do not activate failed paths Hannes Reinecke

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=20140228142230.GA1140@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=hare@suse.de \
    --cc=j-nomura@ce.jp.nec.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.