Signed-off-by: Karel Zak <kzak@redhat.com>
scsi_target,
scsi_lun;
- unsigned int has_hctl : 1;
+ unsigned int has_hctl : 1,
+ hctl_error : 1 ;
};
#define UL_SYSFSCXT_EMPTY { 0, -1, NULL, NULL, 0, 0, 0, 0, 0 }
char buf[PATH_MAX], *hctl;
ssize_t len;
- if (!cxt)
+ if (!cxt || cxt->hctl_error)
return -EINVAL;
if (cxt->has_hctl)
goto done;
+ cxt->hctl_error = 1;
len = sysfs_readlink(cxt, "device", buf, sizeof(buf) - 1);
if (len < 0)
return len;
*t = cxt->scsi_target;
if (l)
*l = cxt->scsi_lun;
+
+ cxt->hctl_error = 0;
return 0;
}