All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 11/34] LU-7734 lnet: configure local NI from DLC
Date: Sat, 29 Sep 2018 22:05:34 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.21.1809292150580.25547@casper.infradead.org> (raw)
In-Reply-To: <153783763527.32103.6166409833321456335.stgit@noble>


> From: Amir Shehata <amir.shehata@intel.com>
> 
> This patch adds the ability to configure multiple network interfaces
> on the same network. This can be done via the lnetctl CLI interface
> or through a YAML configuration. Refer to the multi-rail HLD for
> more details on the syntax.
> 
> It also deprecates ip2nets kernel parsing. All string parsing and
> network maching now happens in the DLC userspace library.
> 
> New IOCTLs are added for adding/deleting local NIs, to keep backwards
> compatibility with older version of the DLC and lnetctl.
> 
> The changes also include parsing and matching ip2nets syntax at the
> user level and then passing down the network interfaces down to the
> kernel to be configured.

Nak. This patch introduces a regression in lnet_ioctl() found in
module.c
 
> Signed-off-by: Amir Shehata <amir.shehata@intel.com>
> Change-Id: I19ee7dc76514beb6f34de6517d19654d6468bcec
> Reviewed-on: http://review.whamcloud.com/18886
> Tested-by: Maloo <hpdd-maloo@intel.com>
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  .../lustre/include/linux/libcfs/libcfs_string.h    |   12 -
>  .../staging/lustre/include/linux/lnet/lib-lnet.h   |   13 -
>  .../lustre/include/uapi/linux/lnet/libcfs_ioctl.h  |    6 
>  .../lustre/include/uapi/linux/lnet/lnet-dlc.h      |   57 ++
>  .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |    3 
>  drivers/staging/lustre/lnet/lnet/api-ni.c          |  479 +++++++++++++++++---
>  drivers/staging/lustre/lnet/lnet/config.c          |  107 +++-
>  drivers/staging/lustre/lnet/lnet/module.c          |   70 ++-
>  drivers/staging/lustre/lnet/lnet/peer.c            |   21 +
>  drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c     |    2 
>  drivers/staging/lustre/lustre/ptlrpc/service.c     |    4 
>  11 files changed, 650 insertions(+), 124 deletions(-)

.....

> diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c
> index 9d06664f0c17..c82d27592391 100644
> --- a/drivers/staging/lustre/lnet/lnet/module.c
> +++ b/drivers/staging/lustre/lnet/lnet/module.c
> @@ -92,7 +92,7 @@ lnet_unconfigure(void)
>  }
>  
>  static int
> -lnet_dyn_configure(struct libcfs_ioctl_hdr *hdr)
> +lnet_dyn_configure_net(struct libcfs_ioctl_hdr *hdr)
>  {
>  	struct lnet_ioctl_config_data *conf =
>  		(struct lnet_ioctl_config_data *)hdr;
> @@ -102,19 +102,17 @@ lnet_dyn_configure(struct libcfs_ioctl_hdr *hdr)
>  		return -EINVAL;
>  
>  	mutex_lock(&lnet_config_mutex);
> -	if (!the_lnet.ln_niinit_self) {
> +	if (the_lnet.ln_niinit_self)
> +		rc = lnet_dyn_add_net(conf);
> +	else
>  		rc = -EINVAL;
> -		goto out_unlock;
> -	}
> -	rc = lnet_dyn_add_ni(LNET_PID_LUSTRE, conf);
> -out_unlock:
>  	mutex_unlock(&lnet_config_mutex);
>  
>  	return rc;
>  }
>  
>  static int
> -lnet_dyn_unconfigure(struct libcfs_ioctl_hdr *hdr)
> +lnet_dyn_unconfigure_net(struct libcfs_ioctl_hdr *hdr)
>  {
>  	struct lnet_ioctl_config_data *conf =
>  		(struct lnet_ioctl_config_data *)hdr;
> @@ -124,12 +122,50 @@ lnet_dyn_unconfigure(struct libcfs_ioctl_hdr *hdr)
>  		return -EINVAL;
>  
>  	mutex_lock(&lnet_config_mutex);
> -	if (!the_lnet.ln_niinit_self) {
> +	if (the_lnet.ln_niinit_self)
> +		rc = lnet_dyn_del_net(conf->cfg_net);
> +	else
> +		rc = -EINVAL;
> +	mutex_unlock(&lnet_config_mutex);
> +
> +	return rc;
> +}
> +
> +static int
> +lnet_dyn_configure_ni(struct libcfs_ioctl_hdr *hdr)
> +{
> +	struct lnet_ioctl_config_ni *conf =
> +		(struct lnet_ioctl_config_ni *)hdr;
> +	int rc;
> +
> +	if (conf->lic_cfg_hdr.ioc_len < sizeof(*conf))
> +		return -EINVAL;
> +
> +	mutex_lock(&lnet_config_mutex);
> +	if (the_lnet.ln_niinit_self)
> +		rc = lnet_dyn_add_ni(conf);
> +	else
> +		rc = -EINVAL;
> +	mutex_unlock(&lnet_config_mutex);
> +
> +	return rc;
> +}
> +
> +static int
> +lnet_dyn_unconfigure_ni(struct libcfs_ioctl_hdr *hdr)
> +{
> +	struct lnet_ioctl_config_ni *conf =
> +		(struct lnet_ioctl_config_ni *)hdr;
> +	int rc;
> +
> +	if (conf->lic_cfg_hdr.ioc_len < sizeof(*conf))
> +		return -EINVAL;
> +
> +	mutex_lock(&lnet_config_mutex);
> +	if (the_lnet.ln_niinit_self)
> +		rc = lnet_dyn_del_ni(conf);
> +	else
>  		rc = -EINVAL;
> -		goto out_unlock;
> -	}
> -	rc = lnet_dyn_del_ni(conf->cfg_net);
> -out_unlock:
>  	mutex_unlock(&lnet_config_mutex);
>  
>  	return rc;
> @@ -161,11 +197,17 @@ lnet_ioctl(struct notifier_block *nb,
>  		break;
>  
>  	case IOC_LIBCFS_ADD_NET:
> -		rc = lnet_dyn_configure(hdr);
> +		rc = lnet_dyn_configure_net(hdr);
>  		break;
>  
>  	case IOC_LIBCFS_DEL_NET:
> -		rc = lnet_dyn_unconfigure(hdr);
> +		rc = lnet_dyn_unconfigure_net(hdr);
> +
> +	case IOC_LIBCFS_ADD_LOCAL_NI:
> +		return lnet_dyn_configure_ni(hdr);
> +
> +	case IOC_LIBCFS_DEL_LOCAL_NI:
> +		return lnet_dyn_unconfigure_ni(hdr);
>  		break;
>  
>  	default:

While the above is mostly correct for the OpenSFS branch that is
not the case for the linux client version. The above code assumes
we are using libc_register_ioctl() but that was replace by the
block_notifier handling for ioctls instead. What we want instead is

        case IOC_LIBCFS_DEL_NET:
                rc = lnet_dyn_unconfigure_net(hdr);
                break;

        case IOC_LIBCFS_ADD_LOCAL_NI:
                rc = lnet_dyn_configure_ni(hdr);
                break;

        case IOC_LIBCFS_DEL_LOCAL_NI:
                rc = lnet_dyn_unconfigure_ni(hdr);
                break;

that way the return value is generated by notifier_from_ioctl_errno(rc).
This resolves the last bug in see in this patch set with my testing.

  reply	other threads:[~2018-09-29 21:05 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25  1:07 [lustre-devel] [PATCH 00/34] lustre: remainder of multi-rail series NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 02/34] lnet: change struct lnet_peer to struct lnet_peer_ni NeilBrown
2018-09-29 22:47   ` James Simmons
2018-09-25  1:07 ` [lustre-devel] [PATCH 01/34] lnet: replace all lp_ fields with lpni_ NeilBrown
2018-09-29 22:45   ` James Simmons
2018-09-25  1:07 ` [lustre-devel] [PATCH 03/34] lnet: Change lpni_refcount to atomic_t NeilBrown
2018-09-29 22:47   ` James Simmons
2018-09-25  1:07 ` [lustre-devel] [PATCH 26/34] LU-7734 lnet: Routing fixes part 2 NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 28/34] LU-7734 lnet: Fix crash in router_proc.c NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 13/34] LU-7734 lnet: Primary NID and traffic distribution NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 06/34] lnet: introduce lnet_find_peer_ni_locked() NeilBrown
2018-09-29 22:48   ` James Simmons
2018-09-25  1:07 ` [lustre-devel] [PATCH 12/34] LU-7734 lnet: NUMA support NeilBrown
2018-09-30  1:49   ` James Simmons
2018-09-25  1:07 ` [lustre-devel] [PATCH 08/34] LU-7734 lnet: Multi-Rail peer split NeilBrown
2018-09-29 23:01   ` James Simmons
2018-10-02  3:10     ` NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 04/34] lnet: change some function names - add 'ni' NeilBrown
2018-09-29 22:47   ` James Simmons
2018-09-25  1:07 ` [lustre-devel] [PATCH 09/34] LU-7734 lnet: Multi-Rail local_ni/peer_ni selection NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 15/34] LU-7734 lnet: handle N NIs to 1 LND peer NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 19/34] LU-7734 lnet: proper cpt locking NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 17/34] LU-7734 lnet: Add peer_ni and NI stats for DLC NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 24/34] LU-7734 lnet: fix lnet_select_pathway() NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 22/34] LU-7734 lnet: fix lnet_peer_table_cleanup_locked() NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 07/34] lnet: lnet_peer_tables_cleanup: use an exclusive lock NeilBrown
2018-09-29 22:53   ` James Simmons
2018-10-02  2:25     ` NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 14/34] LU-7734 lnet: handle non-MR peers NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 21/34] LU-7734 lnet: simplify and fix lnet_select_pathway() NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 27/34] LU-7734 lnet: fix routing selection NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 23/34] LU-7734 lnet: configuration fixes NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 18/34] LU-7734 lnet: peer/peer_ni handling adjustments NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 25/34] LU-7734 lnet: Routing fixes part 1 NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 10/34] LU-7734 lnet: configure peers from DLC NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 16/34] LU-7734 lnet: rename LND peer to peer_ni NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 20/34] LU-7734 lnet: protect peer_ni credits NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 11/34] LU-7734 lnet: configure local NI from DLC NeilBrown
2018-09-29 21:05   ` James Simmons [this message]
2018-10-02  3:19     ` NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 05/34] lnet: make lnet_nid_cpt_hash non-static NeilBrown
2018-09-29 22:48   ` James Simmons
2018-09-25  1:07 ` [lustre-devel] [PATCH 30/34] LU-7734 lnet: set primary NID in ptlrpc_connection_get() NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 29/34] LU-7734 lnet: double free in lnet_add_net_common() NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 34/34] LU-7734 lnet: cpt locking NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 32/34] LU-7734 lnet: rename peer key_nid to prim_nid NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 33/34] lnet: use BIT() macro for LNET_MD_* flags NeilBrown
2018-09-28 16:25   ` James Simmons
2018-10-02  3:31     ` NeilBrown
2018-09-25  1:07 ` [lustre-devel] [PATCH 31/34] LU-7734 lnet: fix NULL access in lnet_peer_aliveness_enabled NeilBrown
2018-09-30  2:17 ` [lustre-devel] [PATCH 00/34] lustre: remainder of multi-rail series James Simmons
2018-10-02  3:41   ` NeilBrown
2018-10-01  2:06 ` James Simmons

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=alpine.LFD.2.21.1809292150580.25547@casper.infradead.org \
    --to=jsimmons@infradead.org \
    --cc=lustre-devel@lists.lustre.org \
    /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.