tgt: update to 1.0.77
authorMaxim Storchak <redacted>
Mon, 6 May 2019 12:45:19 +0000 (15:45 +0300)
committerMaxim Storchak <redacted>
Mon, 6 May 2019 17:08:39 +0000 (20:08 +0300)
- update to 1.0.77
- apply patches from Rosen Penev for compatibility with uClibc-ng
- add an option for rotation_rate selection

Signed-off-by: Maxim Storchak <redacted>
net/tgt/Makefile
net/tgt/files/tgt.config
net/tgt/files/tgt.init
net/tgt/patches/110-iscsi_tcp-Replace-deprecated-valloc-function.patch [new file with mode: 0644]
net/tgt/patches/111-iscsi_tcp-fix-compile-warning.patch [new file with mode: 0644]

index fa65f3c752a242bc86485be44fe02fddcaa88ee6..1c4c6522d2897739ca819b4788138e07263d7317 100644 (file)
@@ -4,12 +4,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tgt
-PKG_VERSION:=1.0.76
+PKG_VERSION:=1.0.77
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/fujita/tgt/tar.gz/v$(PKG_VERSION)?
-PKG_HASH:=fda84ae0cfc71e2b67ca2d073978f60cb52feea5a697601938ff86656bfdd8f9
+PKG_HASH:=7eab72f47e69102c709be2b48b11228470d7a84c88e64f5c354b83ed84d2d04e
 
 PKG_MAINTAINER:=Maxim Storchak <m.storchak@gmail.com>
 PKG_LICENSE:=GPL-2.0
index de5239d3618fe9566272230a8486cdba8e5a2049..e226f65860f5f7b2066188e2810bca3263140311 100644 (file)
@@ -44,6 +44,8 @@ config target 1
 #      option 'removable' '0'
 #  0 = Classic sense format, 1 = Support descriptor format.
 #      option 'sense_format' '0'
+# Rotaion rate: 0: not reported, 1: non-rotational medium (SSD), 2-1024: reserverd, 1025+: "Nominal rotation rate"
+#      option 'rotation_rate' '0'
 
 #config lun 2_1
 #      option device /mnt/iscsi.img
index b627d5dbd44e02b7fc050d7f1fedc4669149343c..c10057d6502a58701a66ea7e10e0ff708956d8f5 100755 (executable)
@@ -28,7 +28,8 @@ validate_lun_section() {
                'scsi_id:string' \
                'scsi_sn:string' \
                'sense_format:range(0, 1)' \
-               'vendor_id:string'
+               'vendor_id:string' \
+               'rotation_rate:uinteger'
 }
 
 handle_lun() {
@@ -36,7 +37,7 @@ handle_lun() {
        local my_tgtid=${tgt_lun%_*}
        local lun=${tgt_lun#*_}
 
-       [ $my_tgtid -eq $tgtid ] || return 0
+       [ "$my_tgtid" -eq "$tgtid" ] || return 0
 
        [ "$2" = 0 ] || {
                $logger "Validation failed for LUN $tgt_lun"
@@ -47,22 +48,22 @@ handle_lun() {
                return 1
        }
 
-       if [ $sync -ne 0 -o $direct -ne 0 ]; then
+       if [ "$sync" -ne 0 ] || [ "$direct" -ne 0 ]; then
                local bsoflags
-               [ $sync -ne 0 ] && bsoflags="sync"
-               [ $direct -ne 0 ] && bsoflags="direct"
-               [ $sync -ne 0 -a $direct -ne 0 ] && bsoflags="sync:direct"
+               [ "$sync" -ne 0 ] && bsoflags="sync"
+               [ "$direct" -ne 0 ] && bsoflags="direct"
+               [ "$sync" -ne 0 ] && [ "$direct" -ne 0 ] && bsoflags="sync:direct"
                bsoflags="--bsoflags $bsoflags"
        fi
 
        blocksize=${blocksize+--blocksize=$blocksize}
        local params='' i
-       for i in mode_page product_id product_rev readonly removable scsi_id scsi_sn sense_format vendor_id; do
+       for i in mode_page product_id product_rev readonly removable scsi_id scsi_sn sense_format vendor_id rotation_rate; do
                eval params=\${$i+$i=\$$i,}\$params
        done
 
        local _tgtadm="$tgtadm --mode logicalunit --tid $tgtid --lun $lun"
-       $_tgtadm --op new --backing-store $device --device-type $type --bstype $bstype $bsoflags $blocksize || {
+       $_tgtadm --op new --backing-store "$device" --device-type "$type" --bstype "$bstype" $bsoflags $blocksize || {
                $logger "Failed to create lun $tgt_lun"
                return 1
        }
@@ -117,7 +118,7 @@ bind_account_to_target() {
        local t
        for t in $target; do
                [ "$t" -eq "$tgtid" ] && {
-                       $_tgtadm --op bind --tid $tgtid --user "$user" $outgoing || {
+                       $_tgtadm --op bind --tid "$tgtid" --user "$user" $outgoing || {
                                $logger "Failed to bind user $username to target $tgtid"
                                return 1
                        }
@@ -137,24 +138,24 @@ handle_target() {
        local tgtid=$1
        local _tgtadm="$tgtadm --mode target"
 
-       [ $tgtid -ge 0 ] || return 1
+       [ "$tgtid" -ge 0 ] || return 1
        [ "$2" = 0 ] || {
                $logger "Validation failed for target $tgtid"
                return 1
        }
-       $_tgtadm --op new --tid $tgtid --targetname $name || {
+       $_tgtadm --op new --tid "$tgtid" --targetname "$name" || {
                $logger "Failed to create target $tgtid"
                return 1
        }
        local i
        for i in $allow_address; do
-               $_tgtadm --op bind --tid $tgtid --initiator-address $i || {
+               $_tgtadm --op bind --tid "$tgtid" --initiator-address "$i" || {
                        $logger "Failed to set allow $i to connect to target $tgtid"
                        return 1
                }
        done
        for i in $allow_name; do
-               $_tgtadm --op bind --tid $tgtid --initiator-name $i || {
+               $_tgtadm --op bind --tid "$tgtid" --initiator-name "$i" || {
                        $logger "Failed to set allow $i to connect to target $tgtid"
                        return 1
                }
@@ -193,7 +194,7 @@ start_tgt_instance() {
        }
        procd_open_instance
        procd_set_param command $PROG -f
-       [ "$iothreads" ] && procd_append_param command -t $iothreads
+       [ "$iothreads" ] && procd_append_param command -t "$iothreads"
        [ "$portal$nop_interval$nop_count" ] && {
                local iscsi="" i
                for i in nop_interval nop_count; do
@@ -202,11 +203,11 @@ start_tgt_instance() {
                for i in $portal; do
                        iscsi="portal=$i,$iscsi"
                done
-               procd_append_param command --iscsi $iscsi
+               procd_append_param command --iscsi "$iscsi"
        }
        procd_set_param respawn
        procd_close_instance
-       logger -p daemon.info -t $NAME -s "Configuration will be loaded in seconds"
+       logger -p daemon.info -t "$NAME" -s "Configuration will be loaded in seconds"
        ( sleep 5; configure || { stop_service; exit 1; } ) &
 }
 
diff --git a/net/tgt/patches/110-iscsi_tcp-Replace-deprecated-valloc-function.patch b/net/tgt/patches/110-iscsi_tcp-Replace-deprecated-valloc-function.patch
new file mode 100644 (file)
index 0000000..0c7c461
--- /dev/null
@@ -0,0 +1,31 @@
+From ced49c99ef0b120d32bcbb3bb6985ff90833052e Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Tue, 30 Apr 2019 22:34:45 -0700
+Subject: [PATCH 1/2] iscsi_tcp: Replace deprecated valloc function
+
+Replaced with posix_memalign as valloc is not available on uClibc.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ usr/iscsi/iscsi_tcp.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
+index 536f22e..5762c23 100644
+--- a/usr/iscsi/iscsi_tcp.c
++++ b/usr/iscsi/iscsi_tcp.c
+@@ -578,7 +578,10 @@ static void iscsi_tcp_free_task(struct iscsi_task *task)
+ static void *iscsi_tcp_alloc_data_buf(struct iscsi_connection *conn, size_t sz)
+ {
+-      return valloc(sz);
++      void *addr = NULL;
++
++      posix_memalign(&addr, sysconf(_SC_PAGESIZE), sz);
++      return addr;
+ }
+ static void iscsi_tcp_free_data_buf(struct iscsi_connection *conn, void *buf)
+-- 
+2.21.0
+
diff --git a/net/tgt/patches/111-iscsi_tcp-fix-compile-warning.patch b/net/tgt/patches/111-iscsi_tcp-fix-compile-warning.patch
new file mode 100644 (file)
index 0000000..8555cc2
--- /dev/null
@@ -0,0 +1,36 @@
+From 23f3bb1ab8311601db03757a6d4538e747364454 Mon Sep 17 00:00:00 2001
+From: FUJITA Tomonori <fujita.tomonori@gmail.com>
+Date: Fri, 3 May 2019 19:30:07 +0900
+Subject: [PATCH 2/2] iscsi_tcp: fix compile warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+iscsi/iscsi_tcp.c: In function ‘iscsi_tcp_alloc_data_buf’:
+iscsi/iscsi_tcp.c:583:2: error: ignoring return value of ‘posix_memalign’, declared with attribute warn_unused_result [-Werror=unused-result]
+  posix_memalign(&addr, sysconf(_SC_PAGESIZE), sz);
+    ^
+
+Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
+---
+ usr/iscsi/iscsi_tcp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
+index 5762c23..0a076b0 100644
+--- a/usr/iscsi/iscsi_tcp.c
++++ b/usr/iscsi/iscsi_tcp.c
+@@ -579,8 +579,8 @@ static void iscsi_tcp_free_task(struct iscsi_task *task)
+ static void *iscsi_tcp_alloc_data_buf(struct iscsi_connection *conn, size_t sz)
+ {
+       void *addr = NULL;
+-
+-      posix_memalign(&addr, sysconf(_SC_PAGESIZE), sz);
++      if (posix_memalign(&addr, sysconf(_SC_PAGESIZE), sz) != 0)
++              return addr;
+       return addr;
+ }
+-- 
+2.21.0
+
git clone https://git.99rst.org/PROJECT