diff -Nru tgt-1.0.57/debian/bash-completion tgt-1.0.61/debian/bash-completion --- tgt-1.0.57/debian/bash-completion 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/bash-completion 1969-12-31 18:00:00.000000000 -0600 @@ -1 +0,0 @@ -scripts/tgt.bashcomp.sh tgt diff -Nru tgt-1.0.57/debian/changelog tgt-1.0.61/debian/changelog --- tgt-1.0.57/debian/changelog 2015-07-06 20:22:00.000000000 -0500 +++ tgt-1.0.61/debian/changelog 2015-11-03 01:42:11.000000000 -0600 @@ -1,22 +1,45 @@ -tgt (1:1.0.57-1ubuntu2) wily; urgency=medium +tgt (1:1.0.61-1) unstable; urgency=medium - * debian/tgt.service: remove spaces between key, = and value for WantedBy, - since it appears to confuse deb-systemd-helper. + * New upstream version: + + Fix crash when looking up removed targets + * Fix the `modules' DEP-8 test + * Allow stderr output in DEP-8 tests + + -- Apollon Oikonomopoulos Tue, 03 Nov 2015 09:12:10 +0200 + +tgt (1:1.0.60-1) unstable; urgency=medium + + * New upstream version: + + Changes in 1.0.59: + + iser: Clear tasks free list when closing the connection + + iser: Fix wrong access to the session discovery mode + + sheepdog: fix to update data_vdi_id after writing data object + + Changes in 1.0.60: + + usr/libssc: Include fcntl.h for loff_t + + Correct the location of checkarch.sh in Makefile + + * tgt.service: strip whitespace around equals signs. - -- Mathieu Trudel-Lapierre Mon, 06 Jul 2015 21:21:58 -0400 + -- Apollon Oikonomopoulos Fri, 10 Jul 2015 14:14:49 +0300 -tgt (1:1.0.57-1ubuntu1) wily; urgency=low +tgt (1:1.0.58-1) unstable; urgency=medium - * Merge from Debian unstable. Remaining changes: - - Drop glusterfs support, since it is not in main. - - debian/patches/fix-config-regression.patch: Dropped no longer - needed. - - debian/patches/fix_delayed_management_request.patch: Dropped - no longer needed. - - debian/patches/fix_leak_of_task_in_scsi_flag.patch: Dropped - no longer needed. + * New upstream version: + + bs_aio: fix failure handling + + sheepdog: fine grained locking in write path + + mgmt: Create ipc socket parent dir if does not exists + + iser: Fix memory leak of addrinfo struct + + tgtd.c: allow oom adjust failures for non-root users + + mgmt: change ipc socket address + + mgmt.c: check that the connecting user is the same as the user tgtd + runs as + + Allow overriding the IPC socket path via TGT_IPC_SOCKET + * d/control: remove XS-Testsuite and rely on dpkg (>= 1.17.11) to fill it in + automatically - -- Chuck Short Thu, 07 May 2015 09:29:12 -0400 + -- Apollon Oikonomopoulos Tue, 26 May 2015 12:35:44 +0300 tgt (1:1.0.57-1) unstable; urgency=medium @@ -143,78 +166,6 @@ -- Apollon Oikonomopoulos Mon, 19 May 2014 15:41:46 +0300 -tgt (1:1.0.43-0ubuntu4) trusty; urgency=medium - - * debian/patches/fix_delayed_management_request.patch: Adjust patch to fix - a FTBFS. - * debian/patches/fix_leak_of_task_in_scsi_flag.patch: Adjust patch to fix - a FTBFS. - - -- Chuck Short Fri, 11 Apr 2014 09:14:03 -0400 - -tgt (1:1.0.43-0ubuntu3) trusty; urgency=medium - - * Fix tgt connection issues under heavy load (LP: #1305343) - - debian/patches/fix_delayed_management_request.patch: Fix a crash - of tgtd which occured when removing a target with the --force option - (https://github.com/fujita/tgt/commit/e6e8d0fd3b83208278fb7ed765c3665ae7c5ab49) - - debian/patches/fix_leak_of_task_in_scsi_flag.patch: Clear task_in_scsi flag - when exiting iscsi_tm_execute() and iser_tm_exec() functions. - (https://github.com/fujita/tgt/commit/05fc2cb424863fbf2f3c60a8b617308ef1e370c5) - - -- Chuck Short Wed, 09 Apr 2014 19:35:20 -0400 - -tgt (1:1.0.43-0ubuntu2) trusty; urgency=medium - - * d/p/fix-config-regression.patch: Cherry picked fix from upstream VCS - to resolve regression on configuration of control port. - - -- James Page Tue, 14 Jan 2014 15:11:35 +0000 - -tgt (1:1.0.43-0ubuntu1) trusty; urgency=medium - - * New upstream release. - - -- James Page Tue, 14 Jan 2014 12:05:08 +0000 - -tgt (1:1.0.41-0ubuntu1) trusty; urgency=low - - * New upstream release: - - debian/patches/fix-tgt-admin-bashism: Dropped, included upstream. - * d/control,rules,bash-completion: Enable bash completion support - for tgt commands. - - -- James Page Mon, 11 Nov 2013 15:00:10 +0000 - -tgt (1:1.0.38-0ubuntu1) saucy; urgency=low - - * New upstream release: - - d/p/include-rbd-docs.patch,example-config-use-conf-dot-dee: - Dropped, included upstream. - - Refreshed other patches. - * d/watch: Really update to track github repository for releases. - - -- James Page Tue, 06 Aug 2013 17:38:27 +0100 - -tgt (1:1.0.37-0ubuntu1) saucy; urgency=low - - * Merge from Debian unstable: - - d/control: Drop depends on lsb-base; handled by debhelper. - * d/watch: Updated to track github upstream repository. - * New upstream release (LP: #1191180): - - d/control: Add xsltproc and docbook-xsl to BD's. - - d/p: Refreshed and tidied patches. - * Enable support for Ceph RBD backend: - - d/rules: Add CEPH_RBD=1 to options. - - d/control: Add BD on librbd-dev. - - d/p/include-rbd-docs.patch: Include README.rbd docs. - * Switch to debhelper compat level 8: - - d/rules: Rewrite to use debhelper overrides. - - d/compat,control: Bump compat level and minimum version - requirement for debhelper. - - -- James Page Tue, 18 Jun 2013 13:08:34 +0100 - tgt (1:1.0.17-1.1) unstable; urgency=low * Non-maintainer upload. @@ -225,36 +176,6 @@ -- Thomas Goirand Thu, 11 Apr 2013 23:25:08 +0800 -tgt (1:1.0.17-1ubuntu4) saucy; urgency=low - - * d/tests: added dep-8-tests - - -- Yolanda Tue, 21 May 2013 10:41:18 +0200 - -tgt (1:1.0.17-1ubuntu3) quantal; urgency=low - - * Rebuild for new armel compiler default of ARMv5t. - - -- Colin Watson Mon, 08 Oct 2012 23:02:42 +0100 - -tgt (1:1.0.17-1ubuntu2) precise; urgency=low - - * change /etc/tgt/tgt.conf to support adding config.d format - snippets in /etc/tgt/conf.d (LP: #978507) - * start tgt on installation (LP: #977621) - * stop tgt on shutdown (LP: #820699) - - -- Scott Moser Tue, 10 Apr 2012 23:11:00 -0400 - -tgt (1:1.0.17-1ubuntu1) oneiric; urgency=low - - * Merge from debian remaining changes: - - debian/usptart: Add upstart job. - - Dropped: - - debian/patches/CVE-2011-0001.patch: No longer needed, use debian instead. - - -- Chuck Short Mon, 08 Aug 2011 04:45:03 -0400 - tgt (1:1.0.17-1) unstable; urgency=low * New upstream release. @@ -267,70 +188,12 @@ -- Ben Hutchings Mon, 21 Mar 2011 03:32:59 +0000 -tgt (1:1.0.13-0ubuntu3) oneiric; urgency=low - - * SECURITY UPDATE: denial of service and possible code execution via - double free in iscsi_rx_handler function - - debian/patches/CVE-2011-0001.patch: make sure the received data isn't - larger than INCOMING_BUFSIZE in usr/iscsi/iscsid.c. - - CVE-2011-0001 - - -- Marc Deslauriers Tue, 21 Jun 2011 09:01:03 -0400 - -tgt (1:1.0.13-0ubuntu2) natty; urgency=low - - * debian/upstart: Add respawn to upstart job. (LP: #715686) - - -- Chuck Short Mon, 14 Feb 2011 10:31:26 -0500 - -tgt (1:1.0.13-0ubuntu1) natty; urgency=low - - * New upstream release. - * debian/patches/make-tgt-setup-lun-executable: Dropped no longer needed. - - -- Chuck Short Tue, 08 Feb 2011 10:31:04 -0500 - -tgt (1:1.0.4-2ubuntu1) natty; urgency=low - - * Merge from debian unstable. Remaining changes: - - debian/upstart: Add upstart job. - - Dropped: - + debian/patches/scripts-tgt-admin: Use debian's instead. - - -- Chuck Short Fri, 10 Sep 2010 16:19:59 +0100 - tgt (1:1.0.4-2) unstable; urgency=low * Fix bashism in tgt-admin, thanks to Chris Cheney (Closes: #589716) -- Ben Hutchings Sun, 05 Sep 2010 22:13:52 +0100 -tgt (1:1.0.4-1ubuntu4) maverick; urgency=low - - * debian/upstart: Corrected typo with post-start command; Resolving - "unknown job" error. (LP: #574554) - - -- Dave Walker (Daviey) Mon, 09 Aug 2010 23:49:42 +0100 - -tgt (1:1.0.4-1ubuntu3) maverick; urgency=low - - * tgtd target will not start unless it's configured with "allow-in-use yes" - (LP: 605721) - - -- Chris Cheney Tue, 20 Jul 2010 04:29:56 -0500 - -tgt (1:1.0.4-1ubuntu2) maverick; urgency=low - - * debian/usptart: Add post-start exec to upstart script. (LP: #574554) - - -- Chuck Short Fri, 16 Jul 2010 10:47:33 -0400 - -tgt (1:1.0.4-1ubuntu1) maverick; urgency=low - - * debian/rules, debian/tgt.tgtd.upstart: Add upstart script. (LP: #574554) - - -- Chuck Short Thu, 17 Jun 2010 10:22:39 -0400 - tgt (1:1.0.4-1) unstable; urgency=low * New upstream release. diff -Nru tgt-1.0.57/debian/control tgt-1.0.61/debian/control --- tgt-1.0.57/debian/control 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/control 2015-05-26 04:44:14.000000000 -0500 @@ -1,21 +1,19 @@ Source: tgt Section: net Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Apollon Oikonomopoulos +Maintainer: Apollon Oikonomopoulos Build-Depends: debhelper (>= 9), libibverbs-dev, librdmacm-dev (>= 1.0.16), xsltproc, docbook-xsl, dh-systemd (>= 1.5), librbd-dev, - bash-completion, libsystemd-dev + glusterfs-common, bash-completion, libsystemd-dev Vcs-Git: git://anonscm.debian.org/collab-maint/tgt.git Vcs-Browser: http://anonscm.debian.org/gitweb?p=collab-maint/tgt.git;a=summary Standards-Version: 3.9.6 Homepage: http://stgt.sourceforge.net/ -XS-Testsuite: autopkgtest Package: tgt Architecture: linux-any Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base, libconfig-general-perl, sg3-utils -Suggests: tgt-rbd +Suggests: tgt-glusterfs, tgt-rbd Description: Linux SCSI target user-space daemon and tools The Linux target framework (tgt) allows a Linux system to provide SCSI devices (targets) over networked SCSI transports. @@ -58,6 +56,29 @@ This package enables tgt to use Ceph/RADOS block devices (RBD) as backing store for SCSI Logical Units. +Package: tgt-glusterfs +Architecture: linux-any +Depends: tgt (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Linux SCSI target user-space daemon and tools - GlusterFS support + The Linux target framework (tgt) allows a Linux system to provide SCSI + devices (targets) over networked SCSI transports. + . + tgt consists of a user-space daemon and user-space tools currently + supporting the following transports: + . + - iSCSI (SCSI over IP) + - iSER (iSCSI over RDMA, using Infiniband) + . + tgt also supports different storage types for use as backing stores for SCSI + Logical Units: + . + - Plain files and block devices + - Ceph/RADOS RBD volumes + - GlusterFS volumes + . + This package enables tgt to use GlusterFS volumes as backing store for SCSI + Logical Units. + Package: tgt-dbg Architecture: linux-any Section: debug diff -Nru tgt-1.0.57/debian/rules tgt-1.0.61/debian/rules --- tgt-1.0.57/debian/rules 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/rules 2014-11-22 12:12:33.000000000 -0600 @@ -1,7 +1,7 @@ #!/usr/bin/make -f #export DH_VERBOSE=1 -FEATURES = ISCSI_RDMA=1 CEPH_RBD=1 SD_NOTIFY=1 +FEATURES = ISCSI_RDMA=1 CEPH_RBD=1 GLFS_BD=1 SD_NOTIFY=1 %: dh $@ --parallel --with systemd,bash-completion diff -Nru tgt-1.0.57/debian/tests/admin tgt-1.0.61/debian/tests/admin --- tgt-1.0.57/debian/tests/admin 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/tests/admin 2014-05-20 04:24:24.000000000 -0500 @@ -1,13 +1,14 @@ -#!/bin/bash +#!/bin/sh #--------------- # Testing tgtadm #--------------- -set -e -ADMIN=tgtadm -$ADMIN --help > /dev/null 2>&1 -RET=$? -if [[ $RET != 0 ]]; then - echo "ERROR, ${ADMIN} is not running" - exit $RET -fi +for cmd in tgtadm tgt-admin tgtimg; do + /usr/sbin/$cmd --help > /dev/null 2>&1 + RET=$? + + if [ $RET -ne 0 ]; then + echo "ERROR, failed to run ${cmd}" >&2 + exit $RET + fi +done diff -Nru tgt-1.0.57/debian/tests/control tgt-1.0.61/debian/tests/control --- tgt-1.0.57/debian/tests/control 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/tests/control 2015-11-03 01:41:54.000000000 -0600 @@ -1,3 +1,6 @@ Tests: daemon admin -Depends: @ -Restrictions: needs-root +Depends: tgt + +Tests: modules +Depends: tgt, tgt-rbd, tgt-glusterfs +Restrictions: needs-root isolation-container allow-stderr diff -Nru tgt-1.0.57/debian/tests/daemon tgt-1.0.61/debian/tests/daemon --- tgt-1.0.57/debian/tests/daemon 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/tests/daemon 2014-05-20 04:24:24.000000000 -0500 @@ -1,8 +1,7 @@ -#!/bin/bash +#!/bin/sh #------------ # Testing tgt #------------ -set -e DAEMON=tgtd if pidof -x $DAEMON > /dev/null; then diff -Nru tgt-1.0.57/debian/tests/modules tgt-1.0.61/debian/tests/modules --- tgt-1.0.57/debian/tests/modules 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/tests/modules 2015-11-03 01:34:42.000000000 -0600 @@ -5,13 +5,12 @@ # Test tgtd module usability loaded_modules=$(tgtadm --mode sys --op show | \ - awk 'BEGIN { RS="(\n|^)[a-zA-Z]"; FS="\n +" }; - /^acking stores/ { - gsub("^acking stores:\n +", ""); - gsub("\n +", "\n"); - print - }') - + awk ' + BEGIN { p = 0 }; + /^[a-zA-Z]/ { p = 0 }; + /^Backing stores/ { p = 1; getline; }; + { if (p) { gsub("^ +", ""); print }; + }') ret=0 for mod in glfs rbd; do diff -Nru tgt-1.0.57/debian/tgt-glusterfs.install tgt-1.0.61/debian/tgt-glusterfs.install --- tgt-1.0.57/debian/tgt-glusterfs.install 1969-12-31 18:00:00.000000000 -0600 +++ tgt-1.0.61/debian/tgt-glusterfs.install 2014-11-22 12:12:33.000000000 -0600 @@ -0,0 +1 @@ +debian/tgt/usr/lib/tgt/backing-store/bs_glfs.so usr/lib/tgt/backing-store diff -Nru tgt-1.0.57/debian/tgt.service tgt-1.0.61/debian/tgt.service --- tgt-1.0.57/debian/tgt.service 2015-07-06 20:21:07.000000000 -0500 +++ tgt-1.0.61/debian/tgt.service 2015-07-10 06:21:53.000000000 -0500 @@ -1,22 +1,22 @@ [Unit] -Description = (i)SCSI target daemon -Documentation = man:tgtd(8) -After = network.target +Description=(i)SCSI target daemon +Documentation=man:tgtd(8) +After=network.target [Service] -Type = notify -ExecStart = /usr/sbin/tgtd -f -ExecStartPost = /usr/sbin/tgtadm --op update --mode sys --name State -v offline -ExecStartPost = /usr/sbin/tgt-admin -e -c /etc/tgt/targets.conf -ExecStartPost = /usr/sbin/tgtadm --op update --mode sys --name State -v ready +Type=notify +ExecStart=/usr/sbin/tgtd -f +ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline +ExecStartPost=/usr/sbin/tgt-admin -e -c /etc/tgt/targets.conf +ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready -ExecStop = /usr/sbin/tgtadm --op update --mode sys --name State -v offline -ExecStop = /usr/sbin/tgt-admin --offline ALL -ExecStop = /usr/sbin/tgt-admin --update ALL -c /dev/null -f -ExecStop = /usr/sbin/tgtadm --op delete --mode system +ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline +ExecStop=/usr/sbin/tgt-admin --offline ALL +ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null -f +ExecStop=/usr/sbin/tgtadm --op delete --mode system -ExecReload = /usr/sbin/tgt-admin --update ALL -c /etc/tgt/targets.conf -Restart = on-failure +ExecReload=/usr/sbin/tgt-admin --update ALL -c /etc/tgt/targets.conf +Restart=on-failure [Install] WantedBy=multi-user.target diff -Nru tgt-1.0.57/debian/upstart tgt-1.0.61/debian/upstart --- tgt-1.0.57/debian/upstart 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/upstart 1969-12-31 18:00:00.000000000 -0600 @@ -1,11 +0,0 @@ -description "tgt daemon" - -start on runlevel [2345] -stop on runlevel [!2345] - -expect fork -respawn - -exec tgtd - -post-start exec /usr/sbin/tgt-admin -e diff -Nru tgt-1.0.57/debian/watch tgt-1.0.61/debian/watch --- tgt-1.0.57/debian/watch 2015-07-06 17:43:01.000000000 -0500 +++ tgt-1.0.61/debian/watch 2014-05-20 04:24:24.000000000 -0500 @@ -1,6 +1,2 @@ version=3 -<<<<<<< tgt-1:1.0.43-0ubuntu4 (ubuntu) -https://github.com/fujita/tgt/tags .*/v(.*).tar.gz -======= https://github.com/fujita/tgt/tags .*/archive/v([\d.]+)\.tar\.gz ->>>>>>> tgt-1:1.0.57-1 (debian) diff -Nru tgt-1.0.57/doc/tgtd.8.xml tgt-1.0.61/doc/tgtd.8.xml --- tgt-1.0.57/doc/tgtd.8.xml 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/doc/tgtd.8.xml 2015-11-02 21:58:36.000000000 -0600 @@ -162,6 +162,15 @@ + ENVIRONMENT VARIABLES + TGT_IPC_SOCKET=<path> + + When set tgtd and tgtadm will use the specified path as the + IPC socket instead of the default '/var/run/tgtd/socket.0' + + + + SEE ALSO tgtadm(8), tgt-admin(8), tgtimg(8), tgt-setup-lun(8). diff -Nru tgt-1.0.57/Makefile tgt-1.0.61/Makefile --- tgt-1.0.57/Makefile 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/Makefile 2015-11-02 21:58:36.000000000 -0600 @@ -1,4 +1,4 @@ -VERSION ?= 1.0.57 +VERSION ?= 1.0.61 CHECK_CC = cgcc CHECK_CC_FLAGS = '$(CHECK_CC) -Wbitwise -Wno-return-void -no-compile $(ARCH)' @@ -82,7 +82,7 @@ clean: clean-programs clean-doc clean-conf clean-scripts clean-pkg .PHONY:check -check: ARCH=$(shell sh script/checkarch.sh) +check: ARCH=$(shell sh scripts/checkarch.sh) check: CC=$(CHECK_CC_FLAGS) $(MAKE) all diff -Nru tgt-1.0.57/usr/bs_aio.c tgt-1.0.61/usr/bs_aio.c --- tgt-1.0.57/usr/bs_aio.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/bs_aio.c 2015-11-02 21:58:36.000000000 -0600 @@ -152,6 +152,13 @@ ", err: %d\n", nsubmit, info->lu->tgt->tid, info->lu->lun, -nsuccess); + for (i = nsubmit - 1; i >= 0; i--) { + cmd = info->iocb_arr[i].data; + clear_cmd_async(cmd); + info->nwaiting--; + if (!info->nwaiting) + list_del(&info->dev_list_entry); + } return nsuccess; } } diff -Nru tgt-1.0.57/usr/bs_sheepdog.c tgt-1.0.61/usr/bs_sheepdog.c --- tgt-1.0.57/usr/bs_sheepdog.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/bs_sheepdog.c 2015-11-02 21:58:36.000000000 -0600 @@ -876,6 +876,7 @@ uint16_t flags = 0; int need_update_inode = 0, need_reload_inode; int nr_copies = ai->inode.nr_copies; + int need_write_lock, check_idx; goto do_req; @@ -891,7 +892,18 @@ pthread_rwlock_unlock(&ai->inode_lock); do_req: - if (write) + need_write_lock = 0; + vid = ai->inode.vdi_id; + + for (check_idx = idx; check_idx < max; check_idx++) { + if (ai->inode.data_vdi_id[check_idx] == vid) + continue; + + need_write_lock = 1; + break; + } + + if (need_write_lock) pthread_rwlock_wrlock(&ai->inode_lock); else pthread_rwlock_rdlock(&ai->inode_lock); @@ -925,14 +937,6 @@ oid = vid_to_data_oid(ai->inode.vdi_id, idx); - ai->min_dirty_data_idx = - min_t(uint32_t, - idx, ai->min_dirty_data_idx); - ai->max_dirty_data_idx = - max_t(uint32_t, - idx, ai->max_dirty_data_idx); - - ai->inode.data_vdi_id[idx] = vid; } need_reload_inode = 0; @@ -954,6 +958,14 @@ } if (create) { + ai->min_dirty_data_idx = + min_t(uint32_t, idx, + ai->min_dirty_data_idx); + ai->max_dirty_data_idx = + max_t(uint32_t, idx, + ai->max_dirty_data_idx); + ai->inode.data_vdi_id[idx] = vid; + need_update_inode = 1; create = 0; } diff -Nru tgt-1.0.57/usr/iscsi/iser.c tgt-1.0.61/usr/iscsi/iser.c --- tgt-1.0.57/usr/iscsi/iser.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/iscsi/iser.c 2015-11-02 21:58:36.000000000 -0600 @@ -1279,6 +1279,7 @@ if (err) eprintf("conn:%p rdma_disconnect failed, %m\n", &conn->h); + iser_ib_clear_tx_list(conn); list_del(&conn->conn_list); tgt_remove_sched_event(&conn->sched_buf_alloc); @@ -1746,7 +1747,6 @@ static int iser_logout_exec(struct iser_task *task) { struct iser_conn *conn = task->conn; - struct iscsi_session *session = conn->h.session; struct iscsi_logout_rsp *rsp_bhs = (struct iscsi_logout_rsp *) task->pdu.bhs; @@ -1756,10 +1756,8 @@ rsp_bhs->response = ISCSI_LOGOUT_SUCCESS; rsp_bhs->itt = task->tag; rsp_bhs->statsn = cpu_to_be32(conn->h.stat_sn++); - - if (session->exp_cmd_sn == task->cmd_sn && !task->is_immediate) - session->exp_cmd_sn++; - iser_set_rsp_stat_sn(session, task->pdu.bhs); + rsp_bhs->exp_cmdsn = cpu_to_be32(conn->h.exp_cmd_sn); + rsp_bhs->max_cmdsn = cpu_to_be32(conn->h.max_cmd_sn); task->pdu.ahssize = 0; task->pdu.membuf.size = 0; @@ -3452,10 +3450,14 @@ for (res = res0; res; res = res->ai_next) { err = iser_add_portal(res, port); - if (err) + if (err) { + freeaddrinfo(res0); return err; + } } + freeaddrinfo(res0); + dprintf("listening for iser connections on port %d\n", port); err = tgt_event_add(rdma_evt_channel->fd, EPOLLIN, iser_handle_rdmacm, NULL); diff -Nru tgt-1.0.57/usr/iscsi/target.c tgt-1.0.61/usr/iscsi/target.c --- tgt-1.0.57/usr/iscsi/target.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/iscsi/target.c 2015-11-02 21:58:36.000000000 -0600 @@ -369,9 +369,11 @@ struct iscsi_target *target_find_by_name(const char *name) { struct iscsi_target *target; + char *tname; list_for_each_entry(target, &iscsi_targets_list, tlist) { - if (!strcmp(tgt_targetname(target->tid), name)) + tname = tgt_targetname(target->tid); + if (tname && !strcmp(tname, name)) return target; } diff -Nru tgt-1.0.57/usr/libssc.c tgt-1.0.61/usr/libssc.c --- tgt-1.0.57/usr/libssc.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/libssc.c 2015-11-02 21:58:36.000000000 -0600 @@ -19,6 +19,7 @@ * 02110-1301 USA */ +#include #include #include #include diff -Nru tgt-1.0.57/usr/mgmt.c tgt-1.0.61/usr/mgmt.c --- tgt-1.0.57/usr/mgmt.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/mgmt.c 2015-11-02 21:58:36.000000000 -0600 @@ -569,7 +569,7 @@ return -1; } - if (cred.uid || cred.gid) + if (cred.uid != getuid() || cred.gid != getgid()) return -EPERM; return 0; @@ -765,8 +765,16 @@ extern short control_port; int fd = 0, err; struct sockaddr_un addr; + struct stat st = {0}; + char *path; - sprintf(mgmt_lock_path, "%s.%d.lock", TGT_IPC_NAMESPACE, control_port); + if ((path = getenv("TGT_IPC_SOCKET")) == NULL) { + path = TGT_IPC_NAMESPACE; + if (stat(TGT_IPC_DIR, &st) == -1) + mkdir(TGT_IPC_DIR, 0755); + } + + sprintf(mgmt_lock_path, "%s.%d.lock", path, control_port); ipc_lock_fd = open(mgmt_lock_path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (ipc_lock_fd < 0) { @@ -789,7 +797,7 @@ goto close_lock_fd; } - sprintf(mgmt_path, "%s.%d", TGT_IPC_NAMESPACE, control_port); + snprintf(mgmt_path, sizeof(mgmt_path), "%s.%d", path, control_port); unlink(mgmt_path); memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_LOCAL; diff -Nru tgt-1.0.57/usr/tgtadm.c tgt-1.0.61/usr/tgtadm.c --- tgt-1.0.57/usr/tgtadm.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/tgtadm.c 2015-11-02 21:58:36.000000000 -0600 @@ -211,7 +211,7 @@ { int err; struct sockaddr_un addr; - char mgmt_path[256]; + char mgmt_path[256], *path; *fd = socket(AF_LOCAL, SOCK_STREAM, 0); if (*fd < 0) { @@ -221,7 +221,11 @@ memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_LOCAL; - sprintf(mgmt_path, "%s.%d", TGT_IPC_NAMESPACE, control_port); + if ((path = getenv("TGT_IPC_SOCKET")) == NULL) + path = TGT_IPC_NAMESPACE; + snprintf(mgmt_path, sizeof(mgmt_path), "%s.%d", + path, control_port); + strncpy(addr.sun_path, mgmt_path, sizeof(addr.sun_path)); err = connect(*fd, (struct sockaddr *) &addr, sizeof(addr)); diff -Nru tgt-1.0.57/usr/tgtadm.h tgt-1.0.61/usr/tgtadm.h --- tgt-1.0.57/usr/tgtadm.h 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/tgtadm.h 2015-11-02 21:58:36.000000000 -0600 @@ -1,7 +1,8 @@ #ifndef TGTADM_H #define TGTADM_H -#define TGT_IPC_NAMESPACE "/var/run/tgtd.ipc_abstract_namespace" +#define TGT_IPC_DIR "/var/run/tgtd" +#define TGT_IPC_NAMESPACE TGT_IPC_DIR"/socket" #define TGT_LLD_NAME_LEN 64 #define GLOBAL_TID (~0U) diff -Nru tgt-1.0.57/usr/tgtd.c tgt-1.0.61/usr/tgtd.c --- tgt-1.0.57/usr/tgtd.c 2015-04-03 07:43:49.000000000 -0500 +++ tgt-1.0.61/usr/tgtd.c 2015-11-02 21:58:36.000000000 -0600 @@ -604,7 +604,7 @@ } err = oom_adjust(); - if (err) + if (err && getuid() == 0) exit(1); err = nr_file_adjust();