Re: sysfs interface sometimes does not get the block device name, for a logged in iSCSI target

2018-12-16 Thread The Lee-Man
On Friday, December 14, 2018 at 12:13:46 PM UTC-8, Satyajit Deshmukh wrote:
>
> Hello,
>
> An update on the issue. I could observe that the target entries were not 
> populated under sysfs.
>
> This is for a session that has a valid block device:
> $ ls /sys/class/iscsi_session/session778/device
> connection778:0 iscsi_session power target162:0:0 uevent 
>
> This is for a session that does not have a valid block device:
> $ls /sys/class/iscsi_session/session780/device
> connection780:0 iscsi_session power uevent
>
> As we can see, the target... directory is missing.
> So, an event responsible to create the sysfs entry could not get created.
>
> journalctl does not print this info. Is there a way to enable some 
> debugging, to debug this?
>
>
>
It seems like the iscsi initiator code in the kernel is not creating the 
target directory. I will have to look at the code to figure out why. Is 
there any difference between the two targets? How many targets to you have? 
What type of targets are they (i.e. hardware, software)?

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


Re: sysfs interface sometimes does not get the block device name, for a logged in iSCSI target

2018-12-16 Thread The Lee-Man
On Monday, December 10, 2018 at 5:52:19 PM UTC-8, Satyajit Deshmukh wrote:
>
> Hello,
>
> We are fairly frequently now running into this. Looks like an issue with 
> the sysfs interface.
>
> iscsi_sysfs_get_blockdev_from_lun() sometimes does not find the SCSI block 
> device (say /dev/sdd) for a logged in iSCSI target.
>
> Thus, iscsiadm -m session -P0 does not print the SCSI device block path 
> (say /dev/sdd)
>
> From code walk-through, I can see there are 2 places, where it can happen. 
> Sharing that here.
>
> diff -uNr open-iscsi-2.0.874/usr/iscsi_sysfs.c 
> open-iscsi-2.0.874_2/usr/iscsi_sysfs.c
> --- open-iscsi-2.0.874/usr/iscsi_sysfs.c2018-11-19 19:25:38.935602682 
> +
> +++ open-iscsi-2.0.874_2/usr/iscsi_sysfs.c  2018-11-19 19:43:08.214013706 
> +
> @@ -1557,19 +1557,24 @@
> snprintf(id, sizeof(id), "%d:0:%d:%d", host_no, target, lun);
> if (!sysfs_lookup_devpath_by_subsys_id(devpath, sizeof(devpath),
>SCSI_SUBSYS, id)) {
> -   log_debug(3, "Could not lookup devpath for %s %s",
> +   log_error("Could not lookup devpath for %s %s",
>   SCSI_SUBSYS, id);
> return NULL;
> }
> +   log_debug(0, "devpath is %s for id %s", devpath, id);
>
>
> sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full));
> if (sysfs_len >= sizeof(path_full))
> sysfs_len = sizeof(path_full) - 1;
> strlcat(path_full, devpath, sizeof(path_full));
>  
> +   log_debug(0, "path_full is %s", path_full);
> dirfd = opendir(path_full);
> -   if (!dirfd) 
> +   if (!dirfd) {
> +   log_error("Could not open sysfs dir %s",
> + path_full);
> return NULL;
> +   }
> 
> while ((dent = readdir(dirfd))) {
> if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
>
>
> Are there such known issues with the sysfs where device paths are not 
> found, for logged in targets?
> Any pointers/suggestions on debugging this greatly appreciated.
> We too are trying to root-cause and would share our finding here.
>
> Thanks,
> Satyajit
>
>
>
>
> Based on the code, I'm not sure it should always be considered an error 
when no block device is found, so I'm not comfortable changing the code to 
assume this.

I believe the path created depends on the target. For example, for a tape 
device target, there will be no block device.

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


[PATCH AUTOSEL 3.18 01/16] scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset

2018-12-16 Thread Sasha Levin
From: Fred Herard 

[ Upstream commit 5db6dd14b31397e8cccaaddab2ff44ebec1acf25 ]

This commit addresses NULL pointer dereference in iscsi_eh_session_reset.
Reference should not be made to session->leadconn when session->state is
set to ISCSI_STATE_TERMINATE.

Signed-off-by: Fred Herard 
Reviewed-by: Konrad Rzeszutek Wilk 
Reviewed-by: Lee Duncan 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/libiscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 857bf9417817..56441a5ec3d7 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2433,8 +2433,8 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc)
 failed:
ISCSI_DBG_EH(session,
 "failing session reset: Could not log back into "
-"%s, %s [age %d]\n", session->targetname,
-conn->persistent_address, session->age);
+"%s [age %d]\n", session->targetname,
+session->age);
spin_unlock_bh(&session->frwd_lock);
mutex_unlock(&session->eh_mutex);
return FAILED;
-- 
2.19.1

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


[PATCH AUTOSEL 4.19 04/73] scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset

2018-12-16 Thread Sasha Levin
From: Fred Herard 

[ Upstream commit 5db6dd14b31397e8cccaaddab2ff44ebec1acf25 ]

This commit addresses NULL pointer dereference in iscsi_eh_session_reset.
Reference should not be made to session->leadconn when session->state is
set to ISCSI_STATE_TERMINATE.

Signed-off-by: Fred Herard 
Reviewed-by: Konrad Rzeszutek Wilk 
Reviewed-by: Lee Duncan 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/libiscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 93c66ebad907..f78d2e5c1471 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2416,8 +2416,8 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc)
 failed:
ISCSI_DBG_EH(session,
 "failing session reset: Could not log back into "
-"%s, %s [age %d]\n", session->targetname,
-conn->persistent_address, session->age);
+"%s [age %d]\n", session->targetname,
+session->age);
spin_unlock_bh(&session->frwd_lock);
mutex_unlock(&session->eh_mutex);
return FAILED;
-- 
2.19.1

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


[PATCH AUTOSEL 4.4 02/23] scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset

2018-12-16 Thread Sasha Levin
From: Fred Herard 

[ Upstream commit 5db6dd14b31397e8cccaaddab2ff44ebec1acf25 ]

This commit addresses NULL pointer dereference in iscsi_eh_session_reset.
Reference should not be made to session->leadconn when session->state is
set to ISCSI_STATE_TERMINATE.

Signed-off-by: Fred Herard 
Reviewed-by: Konrad Rzeszutek Wilk 
Reviewed-by: Lee Duncan 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/libiscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index a74f8fbefd33..009a2ef829d6 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2416,8 +2416,8 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc)
 failed:
ISCSI_DBG_EH(session,
 "failing session reset: Could not log back into "
-"%s, %s [age %d]\n", session->targetname,
-conn->persistent_address, session->age);
+"%s [age %d]\n", session->targetname,
+session->age);
spin_unlock_bh(&session->frwd_lock);
mutex_unlock(&session->eh_mutex);
return FAILED;
-- 
2.19.1

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


[PATCH AUTOSEL 4.9 02/34] scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset

2018-12-16 Thread Sasha Levin
From: Fred Herard 

[ Upstream commit 5db6dd14b31397e8cccaaddab2ff44ebec1acf25 ]

This commit addresses NULL pointer dereference in iscsi_eh_session_reset.
Reference should not be made to session->leadconn when session->state is
set to ISCSI_STATE_TERMINATE.

Signed-off-by: Fred Herard 
Reviewed-by: Konrad Rzeszutek Wilk 
Reviewed-by: Lee Duncan 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/libiscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index cc8f2a7c2463..c79743de48f9 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2414,8 +2414,8 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc)
 failed:
ISCSI_DBG_EH(session,
 "failing session reset: Could not log back into "
-"%s, %s [age %d]\n", session->targetname,
-conn->persistent_address, session->age);
+"%s [age %d]\n", session->targetname,
+session->age);
spin_unlock_bh(&session->frwd_lock);
mutex_unlock(&session->eh_mutex);
return FAILED;
-- 
2.19.1

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


Re: [PATCH] iscsi: Capture iscsi debug messages using tracepoints

2018-12-16 Thread haveanicedaysamij
:)

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


Re: Running iscsiadm in containers

2018-12-16 Thread mss
As a baseline here are the previous threads discussing this issue including 
the RFC from Chris Leech.

https://groups.google.com/forum/#!msg/open-iscsi/vWbi_LTMEeM/P8-oUDkb14YJ
https://groups.google.com/forum/#!msg/open-iscsi/kgjck_GixsM/U_FqTbYhCgAJ

I think we should try and move Chris's implementation forward if possible.  
Many organizations are hitting real pain-points not having a 
container-compatible open-iscsi implementation, especially with the advent 
of the ubiquity of containers within the storage vendor world.

On Tuesday, October 23, 2018 at 9:03:01 AM UTC-7, Shailesh Mittal wrote:
>
> Hi there,
>
> I understand that it was the topic of discussion earlier. As containers 
> are getting used more and more to run applications, there are frameworks 
> like Kubernetes (and more) where the calls to talk to scsi storage devices 
> are being made through a container.
>
> Here, vendors are in flux as they need to execute iscsiadm commands to 
> connect their iscsi based storage to the application-containers. These 
> caller modules (responsible for connecting to the remote storage) are 
> running in the containers and thus have no choice but executing iscsiadm 
> commands from the containers itself.
>
> Is there a well understood way to implement this? I remember the thread 
> from Chris Leech talking about containerizing iscsid but not sure the 
> end-result of that. (
> https://groups.google.com/forum/#!msg/open-iscsi/vWbi_LTMEeM/NdZPh33ed0oJ)
>
> Any help/direction here is much appreciated.
>
> Thanks,
> Shailesh Mittal.
>

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


[PATCH AUTOSEL 4.14 03/41] scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset

2018-12-16 Thread Sasha Levin
From: Fred Herard 

[ Upstream commit 5db6dd14b31397e8cccaaddab2ff44ebec1acf25 ]

This commit addresses NULL pointer dereference in iscsi_eh_session_reset.
Reference should not be made to session->leadconn when session->state is
set to ISCSI_STATE_TERMINATE.

Signed-off-by: Fred Herard 
Reviewed-by: Konrad Rzeszutek Wilk 
Reviewed-by: Lee Duncan 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/libiscsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index cf8a15e54d83..3ff536b350a1 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2416,8 +2416,8 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc)
 failed:
ISCSI_DBG_EH(session,
 "failing session reset: Could not log back into "
-"%s, %s [age %d]\n", session->targetname,
-conn->persistent_address, session->age);
+"%s [age %d]\n", session->targetname,
+session->age);
spin_unlock_bh(&session->frwd_lock);
mutex_unlock(&session->eh_mutex);
return FAILED;
-- 
2.19.1

-- 
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 post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.