All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Mike Christie <mchristi@redhat.com>,
	bstroesser@ts.fujitsu.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH 02/11] target: separate acl name from port ids
Date: Tue, 28 Apr 2020 16:14:48 +0000	[thread overview]
Message-ID: <81c299f2-cb40-d910-f5ca-3ba0e700365f@acm.org> (raw)
In-Reply-To: <20200428061109.3042-3-mchristi@redhat.com>

On 2020-04-27 23:11, Mike Christie wrote:
> The PGR code assumes the ACL name is going to be based on the SPC4
> transportID type of values. The problem is that for iSCSI we have an
> extra session id as part of the SCSI port id and some fabric modules
> support or would like to support non transportID values for the ACL
> name. For example, iSCSI and SRP would like to use the source address
> for the ACL name, but that is not a valud transportID value that you
> can get in a PGR request.
> 
> This patch adds a new transport_id struct which maps to the SPC
> transportID. In the future will be used for PGR commands instead of
> the ACL name. In this patchset, it is used to export the initiator
> info in the session's sysfs dir, so tools can disply the info and
                                                ^^^^^^
                                                display?
> daemons that execute commands like PGRs in userspace can build a
> session id to I_T nexus mapping.

[ ... ]

> --- a/drivers/target/loopback/tcm_loop.c
> +++ b/drivers/target/loopback/tcm_loop.c
> @@ -725,10 +725,11 @@ static int tcm_loop_alloc_sess_cb(struct se_portal_group *se_tpg,
>  
>  static int tcm_loop_make_nexus(
>  	struct tcm_loop_tpg *tl_tpg,
> -	const char *name)
> +	char *name)
>  {

What needs to be changed to keep the type of the argument as 'const char
*'? How about removing the target_cp_transport_id() call from
target_setup_session() and making all transports allocate the transport
ID dynamically such that target_setup_session() does not have to
duplicate the transport ID?

> +struct t10_transport_id *target_cp_transport_id(struct t10_transport_id *src)
> +{
> +	struct t10_transport_id *dst;
> +
> +	dst = kzalloc(sizeof(*dst), GFP_KERNEL);
> +	if (!dst)
> +		return NULL;
> +	dst->proto = src->proto;
> +
> +	dst->name = kstrdup(src->name, GFP_KERNEL);
> +	if (!dst->name)
> +		goto free_tpid;
> +
> +	if (src->session_id) {
> +		dst->session_id = kstrdup(src->session_id, GFP_KERNEL);
> +		if (!dst->session_id)
> +			goto free_name;
> +	}
> +
> +	return dst;
> +
> +free_name:
> +	kfree(dst->name);
> +free_tpid:
> +	kfree(dst);
> +	return NULL;
> +}
> +EXPORT_SYMBOL(target_cp_transport_id);

How about changing "cp" into "dup" in the name of the
target_cp_transport_id() function?

> -static int scsiback_make_nexus(struct scsiback_tpg *tpg,
> -				const char *name)
> +static int scsiback_make_nexus(struct scsiback_tpg *tpg, char *name)
>  {

Also for this function, is it possible to keep the type of 'name' as
'const char *'?

Thanks,

Bart.

WARNING: multiple messages have this Message-ID (diff)
From: Bart Van Assche <bvanassche@acm.org>
To: Mike Christie <mchristi@redhat.com>,
	bstroesser@ts.fujitsu.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Subject: Re: [PATCH 02/11] target: separate acl name from port ids
Date: Tue, 28 Apr 2020 09:14:48 -0700	[thread overview]
Message-ID: <81c299f2-cb40-d910-f5ca-3ba0e700365f@acm.org> (raw)
In-Reply-To: <20200428061109.3042-3-mchristi@redhat.com>

On 2020-04-27 23:11, Mike Christie wrote:
> The PGR code assumes the ACL name is going to be based on the SPC4
> transportID type of values. The problem is that for iSCSI we have an
> extra session id as part of the SCSI port id and some fabric modules
> support or would like to support non transportID values for the ACL
> name. For example, iSCSI and SRP would like to use the source address
> for the ACL name, but that is not a valud transportID value that you
> can get in a PGR request.
> 
> This patch adds a new transport_id struct which maps to the SPC
> transportID. In the future will be used for PGR commands instead of
> the ACL name. In this patchset, it is used to export the initiator
> info in the session's sysfs dir, so tools can disply the info and
                                                ^^^^^^
                                                display?
> daemons that execute commands like PGRs in userspace can build a
> session id to I_T nexus mapping.

[ ... ]

> --- a/drivers/target/loopback/tcm_loop.c
> +++ b/drivers/target/loopback/tcm_loop.c
> @@ -725,10 +725,11 @@ static int tcm_loop_alloc_sess_cb(struct se_portal_group *se_tpg,
>  
>  static int tcm_loop_make_nexus(
>  	struct tcm_loop_tpg *tl_tpg,
> -	const char *name)
> +	char *name)
>  {

What needs to be changed to keep the type of the argument as 'const char
*'? How about removing the target_cp_transport_id() call from
target_setup_session() and making all transports allocate the transport
ID dynamically such that target_setup_session() does not have to
duplicate the transport ID?

> +struct t10_transport_id *target_cp_transport_id(struct t10_transport_id *src)
> +{
> +	struct t10_transport_id *dst;
> +
> +	dst = kzalloc(sizeof(*dst), GFP_KERNEL);
> +	if (!dst)
> +		return NULL;
> +	dst->proto = src->proto;
> +
> +	dst->name = kstrdup(src->name, GFP_KERNEL);
> +	if (!dst->name)
> +		goto free_tpid;
> +
> +	if (src->session_id) {
> +		dst->session_id = kstrdup(src->session_id, GFP_KERNEL);
> +		if (!dst->session_id)
> +			goto free_name;
> +	}
> +
> +	return dst;
> +
> +free_name:
> +	kfree(dst->name);
> +free_tpid:
> +	kfree(dst);
> +	return NULL;
> +}
> +EXPORT_SYMBOL(target_cp_transport_id);

How about changing "cp" into "dup" in the name of the
target_cp_transport_id() function?

> -static int scsiback_make_nexus(struct scsiback_tpg *tpg,
> -				const char *name)
> +static int scsiback_make_nexus(struct scsiback_tpg *tpg, char *name)
>  {

Also for this function, is it possible to keep the type of 'name' as
'const char *'?

Thanks,

Bart.

  reply	other threads:[~2020-04-28 16:14 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  6:10 [PATCH 00/11] target: add sysfs support Mike Christie
2020-04-28  6:10 ` Mike Christie
2020-04-28  6:10 ` [PATCH 01/11] target: check enforce_pr_isids during registration Mike Christie
2020-04-28  6:10   ` Mike Christie
2020-04-28  6:11 ` [PATCH 02/11] target: separate acl name from port ids Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28 16:14   ` Bart Van Assche [this message]
2020-04-28 16:14     ` Bart Van Assche
2020-04-28  6:11 ` [PATCH 03/11] iscsi target: setup transport_id Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28  6:11 ` [PATCH 04/11] target: use tpid in target_stat_iport_port_ident_show Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28  6:11 ` [PATCH 05/11] target: drop sess_get_initiator_sid from PR code Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28  6:11 ` [PATCH 06/11] target: drop sess_get_initiator_sid Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28 16:25   ` Bart Van Assche
2020-04-28 16:25     ` Bart Van Assche
2020-04-28  6:11 ` [PATCH 07/11] target: add sysfs support Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28 16:29   ` Bart Van Assche
2020-04-28 16:29     ` Bart Van Assche
2020-04-28 16:33     ` Mike Christie
2020-04-28 16:33       ` Mike Christie
2020-04-28  6:11 ` [PATCH 08/11] target: add sysfs session helper functions Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28 16:43   ` Bart Van Assche
2020-04-28 16:43     ` Bart Van Assche
2020-04-28 17:06     ` Mike Christie
2020-04-28 17:06       ` Mike Christie
2020-04-28  6:11 ` [PATCH 09/11] target: add target_setup_session sysfs support Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28  6:11 ` [PATCH 10/11] iscsi target: use session sysfs helpers Mike Christie
2020-04-28  6:11   ` Mike Christie
2020-04-28  6:11 ` [PATCH 11/11] target: drop sess_get_index Mike Christie
2020-04-28  6:11   ` Mike Christie

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=81c299f2-cb40-d910-f5ca-3ba0e700365f@acm.org \
    --to=bvanassche@acm.org \
    --cc=bstroesser@ts.fujitsu.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mchristi@redhat.com \
    --cc=target-devel@vger.kernel.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.