Hello community, here is the log from the commit of package open-iscsi for openSUSE:Factory checked in at 2020-11-10 13:38:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/open-iscsi (Old) and /work/SRC/openSUSE:Factory/.open-iscsi.new.11331 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "open-iscsi" Tue Nov 10 13:38:20 2020 rev:98 rq:846080 version:unknown Changes: -------- --- /work/SRC/openSUSE:Factory/open-iscsi/open-iscsi.changes 2020-08-02 12:29:16.819914016 +0200 +++ /work/SRC/openSUSE:Factory/.open-iscsi.new.11331/open-iscsi.changes 2020-11-10 13:39:07.320513009 +0100 @@ -1,0 +2,17 @@ +Wed Nov 4 18:58:29 UTC 2020 - Lee Duncan <ldun...@suse.com> + +- Updated to latest upstream, including async login ability: + * TODO: Update to todo list. + * Implement login "no_wait" for iscsiadm NODE mode + * iscsiadm buffer overflow regression when discovering many targets at once + * iscsid: Check Invalid Session id for stop connection + * Add ability to attempt target logins asynchronously + +------------------------------------------------------------------- +Tue Nov 3 14:34:25 UTC 2020 - Franck Bui <f...@suse.com> + +- %service_del_postun_without_restart is now available on SLE + + More accurately it's been introduced in SLE12-SP2+ and SLE15+ + ++------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ open-iscsi.spec ++++++ --- /var/tmp/diff_new_pack.C6rXXD/_old 2020-11-10 13:39:08.060511538 +0100 +++ /var/tmp/diff_new_pack.C6rXXD/_new 2020-11-10 13:39:08.064511531 +0100 @@ -146,11 +146,7 @@ %{?regenerate_initrd_posttrans} %postun -%if %{defined service_del_postun_without_restart} - %service_del_postun_without_restart iscsi.service -%else - %service_del_postun -n iscsi.service -%endif +%service_del_postun_without_restart iscsi.service %service_del_postun iscsid.service iscsid.socket %pre ++++++ open-iscsi-SUSE-latest.diff.bz2 ++++++ --- /var/tmp/diff_new_pack.C6rXXD/_old 2020-11-10 13:39:08.084511491 +0100 +++ /var/tmp/diff_new_pack.C6rXXD/_new 2020-11-10 13:39:08.088511483 +0100 @@ -0,0 +1,453 @@ +diff --git a/README b/README +index 2499d9a7b638..508c9d7b2bfe 100644 +--- a/README ++++ b/README +@@ -218,7 +218,7 @@ The output will be similar to the following. + + iscsiadm -m discoverydb [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -Dl ] ] | [ [ -p ip:port -t type] [ -o operation ] [ -n name ] [ -v value ] [ -lD ] ] + iscsiadm -m discovery [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -l ] ] | [ [ -p ip:port ] [ -l | -D ] ] +-iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,automatic ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port -I ifaceN ] [ -l | -u | -R | -s] ] [ [ -o operation ] [ -n name ] [ -v value ] ] ++iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,automatic ] [ -W ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port -I ifaceN ] [ -l | -u | -R | -s] ] [ [ -o operation ] [ -n name ] [ -v value ] ] + iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ] + iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o operation ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ] + iscsiadm -m fw [ -d debug_level ] [ -l ] +@@ -380,7 +380,7 @@ Mode "node" + + -m node --targetname=[name] --portal=[ip:port] \ + --interface=iscsi_ifacename] \ +- [--login|--logout|--rescan|--stats] ++ [--login|--logout|--rescan|--stats] [-W] + -m node --targetname=[name] --portal=[ip:port] + --interface=[driver,HWaddress] \ + --op=[op] [--name=[name] --value=[value]] +@@ -407,6 +407,13 @@ Mode "node" + + --stats prints the iSCSI stats for the session. + ++ --login normally sends a login request to the specified ++ target and normally waits for the results. If ++ -W/--no_wait is supplied return success if we are ++ able to send the login request, and do not wait ++ for the response. The user will have to poll for ++ success ++ + Print level can be 0 to 1. + + -m node --logoutall=[all|manual|automatic] +@@ -414,11 +421,16 @@ Mode "node" + with a node startup value manual or automatic. + Nodes marked as ONBOOT are skipped. + +- -m node --loginall=[all|manual|automatic] ++ -m node --loginall=[all|manual|automatic] [-W] + Login "all" the running sessions or just the ones + with a node startup value manual or automatic. + Nodes marked as ONBOOT are skipped. + ++ If -W is supplied then do not wait for the login ++ response for the target, returning success if we ++ are able to just send the request. The client ++ will have to poll for success. ++ + Mode "session" + -------------- + +@@ -915,8 +927,8 @@ Passing in none of them will result in all node records being operated on. + iscsiadm -m node -l + + - iSCSI login to all portals on a node/target through each interface set +- in the db: +- iscsiadm -m node -T iqn.2005-03.com.max -l ++ in the db, but do not wait for the login response: ++ iscsiadm -m node -T iqn.2005-03.com.max -l -W + + - iSCSI login to a specific portal through each interface set in the db: + iscsiadm -m node -T iqn.2005-03.com.max -p 192.168.0.4:3260 -l +@@ -1131,11 +1143,11 @@ copied into e.g. /usr/local/share/man8. + ================== + + There are three steps needed to set up a system to use iSCSI storage: +-7.1. iSCSI startup using the init script or manual startup. ++7.1. iSCSI startup using the systemd units or manual startup. + 7.2. Discover targets. + 7.3. Automate target logins for future system reboots. + +-The init scripts will start the iSCSI daemon and log into any ++The systemd startup units will start the iSCSI daemon and log into any + portals that are set up for automatic login (discussed in 7.2) + or discovered through the discover daemon iscsid.conf params + (discussed in 7.1.2). +@@ -1151,12 +1163,11 @@ Red Hat or Fedora: + ----------------- + To start open-iscsi in Red Hat/Fedora you can do: + +- service open-iscsi start ++ systemctl start open-iscsi + + To get open-iscsi to automatically start at run time you may have to + run: +- chkconfig --level <levels> open-iscsi on +-Where <levels> are the run levels. ++ systemctl enable open-iscsi + + And, to automatically mount a file system during startup + you must have the partition entry in /etc/fstab marked with the "_netdev" +@@ -1166,12 +1177,10 @@ option. For example this would mount an iscsi disk sdb: + + SUSE or Debian: + --------------- +-Otherwise, if there is an initd script for your distro in etc/initd that +-gets installed with "make install" +- +- /etc/init.d/open-iscsi start +- +-will usually get you started. ++The open-iscsi service is socket activated, so there is no need to ++enable the open-iscsi service. Likewise, the iscsi.service login ++service is enabled automatically, so setting 'startup' to "automatic' ++will enable automatic login to open-iscsi targets. + + + 7.1.2 Manual Startup +@@ -1184,12 +1193,12 @@ If there is no initd script, you must start the tools by hand. First load the + iscsi modules: + modprobe -q iscsi_tcp + +-After that, start iSCSI daemon process: +- ./iscsid ++After that, start iSCSI as a daemon process: ++ iscsid + +-or alternatively, start it with debug enabled and with output +-redirected to the current console: +- ./iscsid -d 8 -f & ++or alternatively, start it with debug enabled, in a seperate window, ++which will force it into "foreground" mode: ++ iscsid -d 8 + + + 7.1.2.2 Logging into Targets +@@ -1198,7 +1207,7 @@ redirected to the current console: + Use the configuration utility, iscsiadm, to add/remove/update Discovery + records, iSCSI Node records or monitor active iSCSI sessions (see above or the + iscsiadm man files and see section 7.2 below for how to discover targets): +- ./iscsiadm -m node ++ iscsiadm -m node + + will print out the nodes that have been discovered as: + +@@ -1210,7 +1219,7 @@ The format is: + + If you are using the iface argument or want to see the driver + info, use the following: +- ./iscsiadm -m node -P 1 ++ iscsiadm -m node -P 1 + + Example output: + Target: iqn.1992-08.com.netapp:sn.33615311 +@@ -1234,14 +1243,22 @@ Default here is iscsi_tcp/tcp to be used over whichever NIC the + network layer decides is best. + + To login, take the ip, port and targetname from above and run: +- ./iscsiadm -m node -T targetname -p ip:port -l ++ iscsiadm -m node -T targetname -p ip:port -l + + In this example we would run: +- ./iscsiadm -m node -T iqn.1992-08.com.netapp:sn.33615311 \ ++ iscsiadm -m node -T iqn.1992-08.com.netapp:sn.33615311 \ + -p 10.15.84.19:3260 -l + + Note: drop the portal group tag from the "iscsiadm -m node" output. + ++If you wish, for example to login to all targets represented in the node ++database, but not wait for the login responses: ++ ++ iscsiadm -m node -l -W ++ ++after which you can use "session" mode to detect when the logins complete: ++ ++ iscsiadm -m session + + 7.2. Discover Targets + ===================== +@@ -1318,8 +1335,8 @@ all sessions add the following to the /etc/iscsi/iscsid.conf: + Setting this in iscsid.conf will not affect existing nodes. It will only + affect nodes that are discovered after setting the value. + +-To login to all automated nodes, simply restart the iscsi service, e.g. with: +- /etc/init.d/open-iscsi restart ++To login to all automated nodes, simply restart the iscsi login service, e.g. with: ++ systemctl restart iscsi + + On your next startup the nodes will be logged into automatically. + +@@ -1375,7 +1392,7 @@ SendTargets + -n discovery.sendtargets.discoveryd_poll_inval -v 30 + + To have the new settings take effect, restart iscsid by restarting the +-iscsi service. ++iscsi services. + + Note: + When iscsiadm is run with the -o new argument, it will use the +@@ -1404,7 +1421,7 @@ iSNS + -n discovery.isns.discoveryd_poll_inval -v 30 + + To have the new settings take effect, restart iscsid by restarting the +-iscsi service. ++iscsi services. + + Note: + When iscsiadm is run with the -o new argument, it will use the +diff --git a/TODO b/TODO +index 732818067e4c..a3d1d91c9fb6 100644 +--- a/TODO ++++ b/TODO +@@ -377,3 +377,16 @@ I am working on this one. Hopefully it should be done soon. + it gets out of sync with the kernel version, and that's not good. + + --------------------------------------------------------------------------- ++ ++13. Node database ++ ++Current implementation of node data is not scalable. It handles database using ++some bunch of files and directories. It has not locking and can not handle ++thousands of targets. ++ ++--------------------------------------------------------------------------- ++ ++14. Migration of duplicate functionality out of iscsid/iscsiadm into libopeniscsi ++and add better error handling . ++ ++--------------------------------------------------------------------------- +diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8 +index bf23dd2e6e27..597f7aac1964 100644 +--- a/doc/iscsiadm.8 ++++ b/doc/iscsiadm.8 +@@ -51,6 +51,7 @@ iscsiadm \- open-iscsi administration utility + .IR printlevel ] + .RB [ \-L + .IR all,manual,automatic,onboot ] ++.RB [ \-W ] + .RB [ \-U + .IR all,manual,automatic,onboot ] + .RB [ \-S ] +@@ -292,7 +293,13 @@ in or all running session, except ones marked onboot, if all is passed in. + This option is only valid for node mode (it is valid but not functional + for session mode). + .TP +-\fB\-m, \-\-mode \fIop\fR ++\fB\-W\fR, \fB\-\-\-no_wait\fR ++In node mode, do not wait for a response from the targets. ++This means that success will be returned if the command is able to ++send the login requests, whether or not they succeed. In this case, it will ++be up to the caller to poll for success (i.e. session creation). ++.TP ++\fB\-m\fR, \fB\-\-mode \fIop\fR + specify the mode. \fIop\fR + must be one of \fIdiscovery\fR, \fIdiscoverydb\fR, \fInode\fR, \fIfw\fR, + \fIhost\fR \fIiface\fR or \fIsession\fR. +diff --git a/usr/idbm.c b/usr/idbm.c +index 6309be07f6a8..42c2699dbcc9 100644 +--- a/usr/idbm.c ++++ b/usr/idbm.c +@@ -169,6 +169,7 @@ static struct idbm *db; + #define __recinfo_int_list(_key,_info,_rec,_name,_show,_tbl,_n,_mod) do { \ + _info[_n].type = TYPE_INT_LIST; \ + strlcpy(_info[_n].name, _key, NAME_MAXVAL); \ ++ _info[_n].value[0] = '\0'; \ + for (unsigned long _i = 0; _i < ARRAY_LEN(_rec->_name); _i++) { \ + if (_rec->_name[_i] != (unsigned)~0) { \ + for (unsigned long _j = 0; _j < ARRAY_LEN(_tbl); _j++) { \ +diff --git a/usr/initiator.c b/usr/initiator.c +index 5f4bdca35dc1..684647c9eca2 100644 +--- a/usr/initiator.c ++++ b/usr/initiator.c +@@ -692,6 +692,7 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask, + int err) + { + struct iscsi_session *session = conn->session; ++ int stop_flag = 0; + + log_debug(3, "iscsi_login_eh"); + /* +@@ -711,7 +712,11 @@ static void iscsi_login_eh(struct iscsi_conn *conn, struct queue_task *qtask, + !iscsi_retry_initial_login(conn)) + session_conn_shutdown(conn, qtask, err); + else { +- session_conn_reopen(conn, qtask, STOP_CONN_TERM); ++ stop_flag = (session->id < INVALID_SESSION_ID) ? STOP_CONN_TERM : 0; ++ log_debug(6, "connection %p socket_fd: %d, " ++ "session id: %d stop_flag: %d\n", ++ conn, conn->socket_fd, session->id, stop_flag); ++ session_conn_reopen(conn, qtask, stop_flag); + } + break; + case R_STAGE_SESSION_REDIRECT: +diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c +index f2bd72171c39..311978eee13f 100644 +--- a/usr/iscsiadm.c ++++ b/usr/iscsiadm.c +@@ -133,9 +133,10 @@ static struct option const long_options[] = + {"interval", required_argument, NULL, 'i'}, + {"index", required_argument, NULL, 'x'}, + {"portal_type", optional_argument, NULL, 'A'}, ++ {"no_wait", no_argument, NULL, 'W'}, + {NULL, 0, NULL, 0}, + }; +-static char *short_options = "RlDVhm:a:b:c:C:p:P:T:H:i:I:U:k:L:d:r:n:v:o:sSt:ux:A:"; ++static char *short_options = "RlDVhm:a:b:c:C:p:P:T:H:i:I:U:k:L:d:r:n:v:o:sSt:ux:A:W"; + + static void usage(int status) + { +@@ -144,15 +145,15 @@ static void usage(int status) + program_name); + else { + printf("\ +-iscsiadm -m discoverydb [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -Dl ] ] | [ [ -p ip:port -t type] \ +-[ -o operation ] [ -n name ] [ -v value ] [ -lD ] ] \n\ +-iscsiadm -m discovery [ -hV ] [ -d debug_level ] [-P printlevel] [ -t type -p ip:port -I ifaceN ... [ -l ] ] | [ [ -p ip:port ] [ -l | -D ] ] \n\ +-iscsiadm -m node [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -L all,manual,automatic ] [ -U all,manual,automatic ] [ -S ] [ [ -T targetname -p ip:port -I ifaceN ] [ -l | -u | -R | -s] ] \ +-[ [ -o operation ] [ -n name ] [ -v value ] ]\n\ +-iscsiadm -m session [ -hV ] [ -d debug_level ] [ -P printlevel] [ -r sessionid | sysfsdir [ -R | -u | -s ] [ -o operation ] [ -n name ] [ -v value ] ]\n\ +-iscsiadm -m iface [ -hV ] [ -d debug_level ] [ -P printlevel ] [ -I ifacename | -H hostno|MAC ] [ [ -o operation ] [ -n name ] [ -v value ] ] [ -C ping [ -a ip ] [ -b packetsize ] [ -c count ] [ -i interval ] ]\n\ +-iscsiadm -m fw [ -d debug_level ] [ -l ]\n\ +-iscsiadm -m host [ -P printlevel ] [ -H hostno|MAC ] [ [ -C chap [ -x chap_tbl_idx ] ] | [ -C flashnode [ -A portal_type ] [ -x flashnode_idx ] ] | [ -C stats ] ] [ [ -o operation ] [ -n name ] [ -v value ] ] \n\ ++iscsiadm -m discoverydb [-hV] [-d debug_level] [-P printlevel] [-t type -p ip:port -I ifaceN ... [-Dl]] | [[-p ip:port -t type] \ ++[-o operation] [-n name] [-v value] [-lD]] \n\ ++iscsiadm -m discovery [-hV] [-d debug_level] [-P printlevel] [-t type -p ip:port -I ifaceN ... [-l]] | [[-p ip:port] [-l | -D]] \n\ ++iscsiadm -m node [-hV] [-d debug_level] [-P printlevel] [-L all,manual,automatic,onboot] [-W] [-U all,manual,automatic,onboot] [-S] [[-T targetname -p ip:port -I ifaceN] [-l | -u | -R | -s]] \ ++[[-o operation ] [-n name] [-v value]]\n\ ++iscsiadm -m session [-hV] [-d debug_level] [-P printlevel] [-r sessionid | sysfsdir [-R | -u | -s] [-o operation] [-n name] [-v value]]\n\ ++iscsiadm -m iface [-hV] [-d debug_level] [-P printlevel] [-I ifacename | -H hostno|MAC] [[-o operation ] [-n name] [-v value]] [-C ping [-a ip] [-b packetsize] [-c count] [-i interval]]\n\ ++iscsiadm -m fw [-d debug_level] [-l]\n\ ++iscsiadm -m host [-P printlevel] [-H hostno|MAC] [[-C chap [-x chap_tbl_idx]] | [-C flashnode [-A portal_type] [-x flashnode_idx]] | [-C stats]] [[-o operation] [-n name] [-v value]] \n\ + iscsiadm -k priority\n"); + } + exit(status); +@@ -452,6 +453,8 @@ __do_leading_login(void *data, struct list_head *list, struct node_rec *rec) + struct iface_rec *pattern_iface = data; + int nr_found; + ++ log_debug(1, "doing leading login using iface: %s", pattern_iface->name); ++ + /* Skip any records that do not match the pattern iface */ + if (!iface_match(pattern_iface, &rec->iface)) + return -1; +@@ -471,7 +474,7 @@ __do_leading_login(void *data, struct list_head *list, struct node_rec *rec) + } + + static int +-login_by_startup(char *mode) ++login_by_startup(char *mode, bool wait) + { + int nr_found = 0, err, rc; + struct startup_data startup; +@@ -512,7 +515,7 @@ login_by_startup(char *mode) + if (!list_empty(&startup.all_logins)) { + log_debug(1, "Logging into normal (non-leading-login) portals"); + /* Login all regular (non-leading-login) portals first */ +- err = iscsi_login_portals(NULL, &nr_found, 1, ++ err = iscsi_login_portals(NULL, &nr_found, wait, + &startup.all_logins, iscsi_login_portal); + if (err) + log_error("Could not log into all portals"); +@@ -657,7 +660,7 @@ static int for_each_matched_rec(struct node_rec *rec, void *data, + } + + +-static int login_portals(struct node_rec *pattern_rec) ++static int login_portals(struct node_rec *pattern_rec, bool wait) + { + LIST_HEAD(rec_list); + int nr_found, rc, err; +@@ -671,7 +674,7 @@ static int login_portals(struct node_rec *pattern_rec) + rc = err; + /* if there is an err but some recs then try to login to what we have */ + +- err = iscsi_login_portals(pattern_rec, &nr_found, 1, &rec_list, ++ err = iscsi_login_portals(pattern_rec, &nr_found, wait ? 1 : 0, &rec_list, + iscsi_login_portal); + if (err) + log_error("Could not log into all portals"); +@@ -2806,7 +2809,7 @@ static int verify_node_params(struct list_head *params, struct node_rec *rec) + /* TODO cleanup arguments */ + static int exec_node_op(struct iscsi_context *ctx, int op, int do_login, + int do_logout, int do_show, int do_rescan, int do_stats, +- int info_level, struct node_rec *rec, ++ bool wait, int info_level, struct node_rec *rec, + struct list_head *params) + { + int rc = 0; +@@ -2853,7 +2856,7 @@ static int exec_node_op(struct iscsi_context *ctx, int op, int do_login, + } + + if (do_login) { +- rc = login_portals(rec); ++ rc = login_portals(rec, wait); + goto out; + } + +@@ -3559,6 +3562,7 @@ main(int argc, char **argv) + struct iscsi_session **ses = NULL; + uint32_t se_count = 0; + struct iscsi_session *se = NULL; ++ bool wait = true; + + ctx = iscsi_context_new(); + if (ctx == NULL) { +@@ -3728,6 +3732,9 @@ main(int argc, char **argv) + case 'A': + portal_type = str_to_portal_type(optarg); + break; ++ case 'W': ++ wait = false; ++ break; + case 'h': + usage(0); + } +@@ -3900,7 +3907,7 @@ main(int argc, char **argv) + do_show); + break; + case MODE_NODE: +- if ((rc = verify_mode_params(argc, argv, "RsPIdmlSonvupTUL", ++ if ((rc = verify_mode_params(argc, argv, "RsPIdmlSonvupTULW", + 0))) { + log_error("node mode: option '-%c' is not " + "allowed/supported", rc); +@@ -3909,7 +3916,7 @@ main(int argc, char **argv) + } + + if (do_login_all) { +- rc = login_by_startup(group_session_mgmt_mode); ++ rc = login_by_startup(group_session_mgmt_mode, wait); + goto out; + } + +@@ -3939,7 +3946,7 @@ main(int argc, char **argv) + } + + rc = exec_node_op(ctx, op, do_login, do_logout, do_show, +- do_rescan, do_stats, info_level, rec, ++ do_rescan, do_stats, wait, info_level, rec, + ¶ms); + break; + case MODE_SESSION: +@@ -4025,7 +4032,7 @@ main(int argc, char **argv) + + /* drop down to node ops */ + rc = exec_node_op(ctx, op, do_login, do_logout, do_show, +- do_rescan, do_stats, info_level, ++ do_rescan, do_stats, wait, info_level, + rec, ¶ms); + free_info: + free(info); +@@ -4040,7 +4047,7 @@ free_info: + if (do_logout || do_rescan || do_stats) { + rc = exec_node_op(ctx, op, do_login, do_logout, + do_show, do_rescan, do_stats, +- info_level, NULL, ¶ms); ++ wait, info_level, NULL, ¶ms); + goto out; + } +