This patch tries to fix the lack of outputting logs when
iscsid_req_by_rec is used.
When using iscsid_req_by_rec, the current codes does not tell you whether you
are successfully logged in or hitting some errors because you cannot
get into the
loop of list_for_each_entry_safe() in iscsid_login_reqs_wait(). I
modify some codes
so that iscsid_req_by_rec will output logs.
Please give me a feedback if any.
-- Yangkook Kim
Signed-off-by: Yangkook Kim <[email protected]>
---
--- a/usr/iscsiadm.c 2009-11-12 06:22:10.000000000 +0900
+++ b/usr/iscsiadm.c 2009-11-12 06:23:01.000000000 +0900
@@ -597,29 +597,31 @@
INIT_LIST_HEAD(&async_req->list);
}
- if (async_req)
- rc = iscsid_req_by_rec_async(MGMT_IPC_SESSION_LOGIN,
- rec, &fd);
- else
- rc = iscsid_req_by_rec(MGMT_IPC_SESSION_LOGIN, rec);
- /* we raced with another app or instance of iscsiadm */
- if (rc == MGMT_IPC_ERR_EXISTS) {
- if (async_req)
- free(async_req);
- return 0;
- } else if (rc) {
- iscsid_handle_error(rc);
- if (async_req)
- free(async_req);
- return ENOTCONN;
- }
-
if (async_req) {
+ rc = iscsid_req_by_rec_async(MGMT_IPC_SESSION_LOGIN,
+ rec, &fd);
+ if (rc == MGMT_IPC_ERR_EXISTS) {
+ if (async_req)
+ free(async_req);
+ return 0;
+ } else if (rc) {
+ iscsid_handle_error(rc);
+ if (async_req)
+ free(async_req);
+ return ENOTCONN;
+ }
list_add_tail(&async_req->list, list);
async_req->fd = fd;
async_req->data = rec;
+ return 0;
+ } else {
+ rc = iscsid_req_by_rec(MGMT_IPC_SESSION_LOGIN, rec);
+ if (rc) {
+ iscsid_handle_error(rc);
+ return ENOTCONN;
+ } else
+ return rc;
}
- return 0;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---
--- a/usr/iscsiadm.c 2009-11-12 06:22:10.000000000 +0900
+++ b/usr/iscsiadm.c 2009-11-12 06:23:01.000000000 +0900
@@ -597,29 +597,31 @@
INIT_LIST_HEAD(&async_req->list);
}
- if (async_req)
- rc = iscsid_req_by_rec_async(MGMT_IPC_SESSION_LOGIN,
- rec, &fd);
- else
- rc = iscsid_req_by_rec(MGMT_IPC_SESSION_LOGIN, rec);
- /* we raced with another app or instance of iscsiadm */
- if (rc == MGMT_IPC_ERR_EXISTS) {
- if (async_req)
- free(async_req);
- return 0;
- } else if (rc) {
- iscsid_handle_error(rc);
- if (async_req)
- free(async_req);
- return ENOTCONN;
- }
-
if (async_req) {
+ rc = iscsid_req_by_rec_async(MGMT_IPC_SESSION_LOGIN,
+ rec, &fd);
+ if (rc == MGMT_IPC_ERR_EXISTS) {
+ if (async_req)
+ free(async_req);
+ return 0;
+ } else if (rc) {
+ iscsid_handle_error(rc);
+ if (async_req)
+ free(async_req);
+ return ENOTCONN;
+ }
list_add_tail(&async_req->list, list);
async_req->fd = fd;
async_req->data = rec;
+ return 0;
+ } else {
+ rc = iscsid_req_by_rec(MGMT_IPC_SESSION_LOGIN, rec);
+ if (rc) {
+ iscsid_handle_error(rc);
+ return ENOTCONN;
+ } else
+ return rc;
}
- return 0;
}
static int __login_portals(void *data, int *nr_found,