All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: mwilck@suse.com
Cc: dm-devel@redhat.com
Subject: Re: [dm-devel] [PATCH 2/3] libmultipath: sysfs_set_nexus_loss_tmo(): support SAS expanders
Date: Mon, 1 Feb 2021 22:00:20 -0600	[thread overview]
Message-ID: <20210202040020.GN15006@octiron.msp.redhat.com> (raw)
In-Reply-To: <20210128204544.18563-3-mwilck@suse.com>

On Thu, Jan 28, 2021 at 09:45:43PM +0100, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> With SAS expanders, SAS node names have 3 digits. libmultipath
> would fail to discover the sas_end_device matching a given SCSI
> target in this case. Fix it.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  libmultipath/discovery.c | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
> index f3ce3f8..7878454 100644
> --- a/libmultipath/discovery.c
> +++ b/libmultipath/discovery.c
> @@ -789,14 +789,28 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
>  static void
>  sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
>  {
> -	struct udev_device *sas_dev = NULL;
> -	char end_dev_id[64];
> +	struct udev_device *parent, *sas_dev = NULL;
> +	const char *end_dev_id = NULL;
>  	char value[11];
> +	static const char ed_str[] = "end_device-";
>  
> -	if (mpp->dev_loss == DEV_LOSS_TMO_UNSET)
> +	if (!pp->udev || mpp->dev_loss == DEV_LOSS_TMO_UNSET)
>  		return;
> -	sprintf(end_dev_id, "end_device-%d:%d",
> -		pp->sg_id.host_no, pp->sg_id.transport_id);
> +
> +	for (parent = udev_device_get_parent(pp->udev);
> +	     parent;
> +	     parent = udev_device_get_parent(parent)) {
> +		const char *ed = udev_device_get_sysname(parent);
> +
> +		if (!strncmp(ed, ed_str, sizeof(ed_str) - 1)) {
> +			end_dev_id = ed;
> +			break;
> +		}
> +	}
> +	if (!end_dev_id) {
> +		condlog(1, "%s: No SAS end device", pp->dev);
> +		return;
> +	}
>  	sas_dev = udev_device_new_from_subsystem_sysname(udev,
>  				"sas_end_device", end_dev_id);
>  	if (!sas_dev) {
> -- 
> 2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2021-02-02  4:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28 20:45 [dm-devel] [PATCH 0/3] multipath: fixes for SAS expanders and root FS access mwilck
2021-01-28 20:45 ` [dm-devel] [PATCH 1/3] libmultipath: use 3rd digit as transport_id for expanders mwilck
2021-02-02  2:22   ` Benjamin Marzinski
2021-02-02  9:28     ` Martin Wilck
2021-01-28 20:45 ` [dm-devel] [PATCH 2/3] libmultipath: sysfs_set_nexus_loss_tmo(): support SAS expanders mwilck
2021-02-02  4:00   ` Benjamin Marzinski [this message]
2021-01-28 20:45 ` [dm-devel] [PATCH 3/3] multipathd: add code to initalize unwinder mwilck
2021-02-02  4:10   ` Benjamin Marzinski
2021-02-02  3:15 ` [dm-devel] [PATCH 0/3] multipath: fixes for SAS expanders and root FS access Benjamin Marzinski
2021-02-02  9:33   ` Martin Wilck

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=20210202040020.GN15006@octiron.msp.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mwilck@suse.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.