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?

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.c        2018-11-19 19:25:38.935602682 
> +0000
> +++ open-iscsi-2.0.874_2/usr/iscsi_sysfs.c      2018-11-19 19:43:08.214013706 
> +0000
> @@ -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
>
>
>
>
>
>
>
>
>
>

-- 
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.

Reply via email to