summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sysfs.h3
-rw-r--r--lib/sysfs.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/include/sysfs.h b/include/sysfs.h
index 664359243..36d3cbd4f 100644
--- a/include/sysfs.h
+++ b/include/sysfs.h
@@ -27,7 +27,8 @@ struct sysfs_cxt {
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 }
diff --git a/lib/sysfs.c b/lib/sysfs.c
index b6501291c..f52b7a885 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -882,11 +882,12 @@ int sysfs_scsi_get_hctl(struct sysfs_cxt *cxt, int *h, int *c, int *t, int *l)
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;
@@ -911,6 +912,8 @@ done:
*t = cxt->scsi_target;
if (l)
*l = cxt->scsi_lun;
+
+ cxt->hctl_error = 0;
return 0;
}