Re: [RFC PATCH 2/9] iscsi: associate endpoints with a host
On Tue, Mar 14, 2023 at 05:23:26PM +0100, Hannes Reinecke wrote: > On 2/8/23 18:40, Lee Duncan wrote: > > From: Lee Duncan > > @@ -230,6 +230,7 @@ iscsi_create_endpoint(int dd_size) > > ep->id = id; > > ep->dev.class = _endpoint_class; > > + ep->dev.parent = >shost_gendev; > > dev_set_name(>dev, "ep-%d", id); > > err = device_register(>dev); > > if (err) > > Umm... doesn't this change the sysfs layout? > IE won't the endpoint node be moved under the Scsi_Host directory? > > But even if it does: do we care? It does, but it shouldn't matter. The Open-iSCSI tools look under the subsystem, not the device path. Being a child of the host makes more sense then being a floating virtual device. I just re-tested with bnx2i to make sure moving an endpoint devpath in sysfs didn't break anything. - Chris -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/20230412023125.GA110%40localhost.
Re: [PATCH 11/11] iscsi: force destroy sesions when a network namespace exits
On Tue, Apr 11, 2023 at 08:21:22AM +0200, Hannes Reinecke wrote: > On 4/10/23 21:10, Chris Leech wrote: > > The namespace is gone, so there is no userspace to clean up. > > Force close all the sessions. > > > > This should be enough for software transports, there's no implementation > > of migrating physical iSCSI hosts between network namespaces currently. > > > Ah, you shouldn't have mentioned that. > (Not quite sure how being namespace-aware relates to migration, though.) > We should be checking/modifying the iSCSI offload drivers, too. > But maybe with a later patch. I shouldn't have left that opening ;-) The idea with this design is to keep everything rooted on the iscsi_host, and for physical HBAs those stay assigned to init_net. With this patch set, offload drivers remain unusable in a net namespace other than init_net. They simply are not visible. By migration, I was implying the possibilty of assigment of an HBA iscsi_host into a namespace like you can do with a network interface. Such an iscsi_host would then need to be migrated back to init_net on namespace exit. I don't think it works to try and share an iscsi_host across namespaces, and manage different sessions. The iSCSI HBAs have a limited number of network configurations, exposed as iscsi_iface objects, and I don't want to go down the road of figuring out how to share those. - Chris -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/20230411181945.GB1234639%40localhost.
Re: [RFC PATCH 5/9] iscsi: set netns for iscsi_tcp hosts
On Tue, Apr 11, 2023 at 08:58:54AM +0200, Hannes Reinecke wrote: > On 4/11/23 02:21, Chris Leech wrote: > > diff --git a/include/scsi/scsi_transport_iscsi.h > > b/include/scsi/scsi_transport_iscsi.h > > index 0c3fd690ecf8..4d8a3d770bed 100644 > > --- a/include/scsi/scsi_transport_iscsi.h > > +++ b/include/scsi/scsi_transport_iscsi.h > > @@ -79,6 +79,9 @@ struct iscsi_transport { > > struct iscsi_cls_session *(*create_session) (struct iscsi_endpoint *ep, > > uint16_t cmds_max, uint16_t qdepth, > > uint32_t sn); > > + struct iscsi_cls_session *(*create_unbound_session) (struct net *net, > > + uint16_t cmds_max, uint16_t qdepth, > > + uint32_t sn); > > void (*destroy_session) (struct iscsi_cls_session *session); > > struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, > > uint32_t cid); > > I'm not _that_ happy with these two functions; but can't really see a way > around it. > Can't we rename the 'unbound' version to > 'create_session_ns' or something? Yes, in my mind I was matching the netlink commands, but those are create_session and create_bound_session. I got it exactly backwards with which one had the additional text. I'm OK with changing to a shorter name, like the one you suggested. Thanks, - Chris -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/20230411180337.GA1234639%40localhost.
Re: [RFC PATCH 5/9] iscsi: set netns for iscsi_tcp hosts
On 4/11/23 02:21, Chris Leech wrote: On Tue, Mar 14, 2023 at 05:29:25PM +0100, Hannes Reinecke wrote: On 2/8/23 18:40, Lee Duncan wrote: From: Lee Duncan This lets iscsi_tcp operate in multiple namespaces. It uses current during session creation to find the net namespace, but it might be better to manage to pass it along from the iscsi netlink socket. And indeed, I'd rather use the namespace from the iscsi netlink socket. If you use the namespace from session creation you'd better hope that this function is not called from a workqueue ... The cleanest way I see to do this is to split the transport session_create function between bound and unbound, instead of checking for a NULL ep. That should cleanly serperate out the host-per-session behavior of iscsi_tcp, so we can pass in the namespace without changing the other drivers. This is what that looks like on top of the existing patches, but we can merge it in and rearrange if desired. - Chris --- Distinguish between bound and unbound session creation with different transport functions, instead of just checking for a NULL endpoint. This let's the transport code pass the network namespace into the unbound session creation of iscsi_tcp, without changing the offloading drivers which all expect an bound endpoint. iSER has compatibility checks to work without a bound endpoint, so expose both transport functions there. Signed-off-by: Chris Leech --- drivers/infiniband/ulp/iser/iscsi_iser.c | 41 +--- drivers/scsi/iscsi_tcp.c | 16 - drivers/scsi/iscsi_tcp.h | 1 + drivers/scsi/scsi_transport_iscsi.c | 17 +++--- include/scsi/scsi_transport_iscsi.h | 3 ++ 5 files changed, 52 insertions(+), 26 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 6865f62eb831..ca8de612d585 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -593,20 +593,10 @@ static inline unsigned int iser_dif_prot_caps(int prot_caps) return ret; } -/** - * iscsi_iser_session_create() - create an iscsi-iser session - * @ep: iscsi end-point handle - * @cmds_max: maximum commands in this session - * @qdepth: session command queue depth - * @initial_cmdsn: initiator command sequnce number - * - * Allocates and adds a scsi host, expose DIF supprot if - * exists, and sets up an iscsi session. - */ static struct iscsi_cls_session * -iscsi_iser_session_create(struct iscsi_endpoint *ep, +__iscsi_iser_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, uint16_t qdepth, - uint32_t initial_cmdsn) + uint32_t initial_cmdsn, struct net *net) { struct iscsi_cls_session *cls_session; struct Scsi_Host *shost; @@ -694,6 +684,32 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, return NULL; } +/** + * iscsi_iser_session_create() - create an iscsi-iser session + * @ep: iscsi end-point handle + * @cmds_max: maximum commands in this session + * @qdepth: session command queue depth + * @initial_cmdsn: initiator command sequnce number + * + * Allocates and adds a scsi host, expose DIF supprot if + * exists, and sets up an iscsi session. + */ +static struct iscsi_cls_session * +iscsi_iser_session_create(struct iscsi_endpoint *ep, + uint16_t cmds_max, uint16_t qdepth, + uint32_t initial_cmdsn) { + return __iscsi_iser_session_create(ep, cmds_max, qdepth, + initial_cmdsn, NULL); +} + +static struct iscsi_cls_session * +iscsi_iser_unbound_session_create(struct net *net, + uint16_t cmds_max, uint16_t qdepth, + uint32_t initial_cmdsn) { + return __iscsi_iser_session_create(NULL, cmds_max, qdepth, + initial_cmdsn, net); +} + static int iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, char *buf, int buflen) { @@ -983,6 +999,7 @@ static struct iscsi_transport iscsi_iser_transport = { .caps = CAP_RECOVERY_L0 | CAP_MULTI_R2T | CAP_TEXT_NEGO, /* session management */ .create_session = iscsi_iser_session_create, + .create_unbound_session = iscsi_iser_unbound_session_create, .destroy_session= iscsi_iser_session_destroy, /* connection management */ .create_conn= iscsi_iser_conn_create, diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 171685011ad9..b78239f25073 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -922,7 +922,7 @@ iscsi_sw_tcp_conn_get_stats(struct iscsi_cls_conn *cls_conn, } static struct iscsi_cls_session
Re: [RFC PATCH 4/9] iscsi: make all iSCSI netlink multicast namespace aware
On 4/10/23 21:10, Chris Leech wrote: As discussed with Lee: you should tear down sessions related to this namespace from the pernet ->exit callback, otherwise you end up with session which can no longer been reached as the netlink socket is gone. These two follow on changes handle removing active sesions when the namespace exits. Tested with iscsi_tcp and seems to be working for me. Chris Leech (2): iscsi: make session and connection lists per-net iscsi: force destroy sesions when a network namespace exits drivers/scsi/scsi_transport_iscsi.c | 122 ++-- 1 file changed, 79 insertions(+), 43 deletions(-) Thanks a lot! That's precisely what I had been looking for. But you really shouldn't have mentioned iSCSI offloads; that was too large an opening to _not_ comment on :-) Cheers, Hannes -- Dr. Hannes ReineckeKernel Storage Architect h...@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/f3c23291-2f77-4935-4e1c-a61cbe29241a%40suse.de.
Re: [PATCH 11/11] iscsi: force destroy sesions when a network namespace exits
On 4/10/23 21:10, Chris Leech wrote: The namespace is gone, so there is no userspace to clean up. Force close all the sessions. This should be enough for software transports, there's no implementation of migrating physical iSCSI hosts between network namespaces currently. Ah, you shouldn't have mentioned that. (Not quite sure how being namespace-aware relates to migration, though.) We should be checking/modifying the iSCSI offload drivers, too. But maybe with a later patch. Signed-off-by: Chris Leech --- drivers/scsi/scsi_transport_iscsi.c | 18 ++ 1 file changed, 18 insertions(+) Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes ReineckeKernel Storage Architect h...@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/85458436-702f-2e38-c7cc-ff7329731eda%40suse.de.
Re: [PATCH 10/11] iscsi: make session and connection lists per-net
On 4/10/23 21:10, Chris Leech wrote: Eliminate the comparisions on list lookups, and it will make it easier to shut down session on net namespace exit in the next patch. Signed-off-by: Chris Leech --- drivers/scsi/scsi_transport_iscsi.c | 104 1 file changed, 61 insertions(+), 43 deletions(-) Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes ReineckeKernel Storage Architect h...@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/0288a1cb-d2a0-6493-eae0-1d1b1fe9209c%40suse.de.