|
|
ae92e4 |
From d5483b0df96bd2a1cf86039cf4c6822ec7d7f609 Mon Sep 17 00:00:00 2001
|
|
|
ae92e4 |
From: Gorka Eguileor <geguileo@redhat.com>
|
|
|
ae92e4 |
Date: Fri, 17 Mar 2017 16:00:11 +0100
|
|
|
ae92e4 |
Subject: Fix manual LUN scans feature
|
|
|
ae92e4 |
|
|
|
ae92e4 |
The newly introduced feature to disable automatic scans should not be
|
|
|
ae92e4 |
scanning *any* of the LUNs when the scan is set to manual, but it always
|
|
|
ae92e4 |
scans for LUN0.
|
|
|
ae92e4 |
|
|
|
ae92e4 |
This patch fixes this by skipping the sysfs call altogether, as it
|
|
|
ae92e4 |
should have been doing from the start.
|
|
|
ae92e4 |
---
|
|
|
ae92e4 |
usr/iscsi_sysfs.c | 13 +++++++------
|
|
|
ae92e4 |
usr/iscsi_sysfs.h | 2 +-
|
|
|
ae92e4 |
2 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
ae92e4 |
|
|
|
ae92e4 |
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
|
|
|
ae92e4 |
index 2f94b632baaa..0cc55b97bde9 100644
|
|
|
ae92e4 |
--- a/usr/iscsi_sysfs.c
|
|
|
ae92e4 |
+++ b/usr/iscsi_sysfs.c
|
|
|
ae92e4 |
@@ -1883,18 +1883,19 @@ void iscsi_sysfs_rescan_device(void *data, int hostno, int target, int lun)
|
|
|
ae92e4 |
strlen(write_buf));
|
|
|
ae92e4 |
}
|
|
|
ae92e4 |
|
|
|
ae92e4 |
-pid_t iscsi_sysfs_scan_host(int hostno, int async, int full_scan)
|
|
|
ae92e4 |
+pid_t iscsi_sysfs_scan_host(int hostno, int async, int autoscan)
|
|
|
ae92e4 |
{
|
|
|
ae92e4 |
char id[NAME_SIZE];
|
|
|
ae92e4 |
- char write_buf[6] = "- - 0";
|
|
|
ae92e4 |
+ char *write_buf = "- - -";
|
|
|
ae92e4 |
pid_t pid = 0;
|
|
|
ae92e4 |
|
|
|
ae92e4 |
- if (full_scan)
|
|
|
ae92e4 |
- write_buf[4] = '-';
|
|
|
ae92e4 |
-
|
|
|
ae92e4 |
if (async)
|
|
|
ae92e4 |
pid = fork();
|
|
|
ae92e4 |
- if (pid == 0) {
|
|
|
ae92e4 |
+
|
|
|
ae92e4 |
+ if (pid >= 0 && !autoscan) {
|
|
|
ae92e4 |
+ if (pid)
|
|
|
ae92e4 |
+ log_debug(4, "host%d in manual scan mode, skipping scan", hostno);
|
|
|
ae92e4 |
+ } else if (pid == 0) {
|
|
|
ae92e4 |
/* child */
|
|
|
ae92e4 |
log_debug(4, "scanning host%d", hostno);
|
|
|
ae92e4 |
|
|
|
ae92e4 |
diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h
|
|
|
ae92e4 |
index 3492ce6e033c..cdcefa65f683 100644
|
|
|
ae92e4 |
--- a/usr/iscsi_sysfs.h
|
|
|
ae92e4 |
+++ b/usr/iscsi_sysfs.h
|
|
|
ae92e4 |
@@ -87,7 +87,7 @@ extern void iscsi_sysfs_get_negotiated_session_conf(int sid,
|
|
|
ae92e4 |
struct iscsi_session_operational_config *conf);
|
|
|
ae92e4 |
extern void iscsi_sysfs_get_negotiated_conn_conf(int sid,
|
|
|
ae92e4 |
struct iscsi_conn_operational_config *conf);
|
|
|
ae92e4 |
-extern pid_t iscsi_sysfs_scan_host(int hostno, int async, int full);
|
|
|
ae92e4 |
+extern pid_t iscsi_sysfs_scan_host(int hostno, int async, int autoscan);
|
|
|
ae92e4 |
extern int iscsi_sysfs_get_session_state(char *state, int sid);
|
|
|
ae92e4 |
extern int iscsi_sysfs_get_host_state(char *state, int host_no);
|
|
|
ae92e4 |
extern int iscsi_sysfs_get_device_state(char *state, int host_no, int target,
|
|
|
ae92e4 |
--
|
|
|
ae92e4 |
2.9.3
|
|
|
ae92e4 |
|