<p dir="ltr">Thanks for the detailed analysis. I'll look into it very soon.</p>
<p dir="ltr">s3nt fr0m a $martph0ne, excuse typ0s</p>
<div class="gmail_quote">On Oct 20, 2014 9:03 AM, "dmitry" <<a href="mailto:dmitry@bti.secna.ru">dmitry@bti.secna.ru</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello !<br>
17.10.2014 00:44, Ritesh Raj Sarraf пишет:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thursday 16 October 2014 09:10 AM, Dmitry Danilov wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
    Yes, as I see, BLOCK_FILE variable should serves that.<br>
</blockquote>
<br>
Sorry. But I'm not understanding this correct. Are  you saying we don't need the<br>
patch ?<br>
<br>
--<br>
Ritesh Raj Sarraf<br>
RESEARCHUT -<a href="http://www.researchut.com" target="_blank">http://www.researchut.com</a><br>
"Necessity is the mother of invention."<br>
<br>
</blockquote>
I think we need a patch.<br>
<br>
Let's look at problem again:<br>
<br>
What we have:<br>
<br>
system:<br>
<br>
root@archive:~# uname -a<br>
Linux archive 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux<br>
<br>
root@archive:~# lsb_release -a<br>
No LSB modules are available.<br>
Distributor ID: Debian<br>
Description:    Debian GNU/Linux 7.6 (wheezy)<br>
Release:        7.6<br>
Codename:       wheezy<br>
<br>
mounted partitions:<br>
<br>
root@archive:~# mount<br>
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,<u></u>relatime)<br>
proc on /proc type proc (rw,nosuid,nodev,noexec,<u></u>relatime)<br>
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_<u></u>inodes=62130,mode=755)<br>
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,<u></u>gid=5,mode=620,ptmxmode=000)<br>
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,<u></u>size=50896k,mode=755)<br>
/dev/disk/by-uuid/51c02def-<u></u>2358-4270-a76d-3161633a1b22 on / type ext4 (rw,relatime,errors=remount-<u></u>ro,user_xattr,barrier=1,data=<u></u>ordered)<br>
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,<u></u>relatime,size=5120k)<br>
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,<u></u>relatime,size=296960k)<br>
/dev/sdb1 on /mnt/sites_backup type ext4 (rw,relatime,user_xattr,acl,<u></u>barrier=1,data=ordered,_<u></u>netdev)<br>
/dev/sda1 on /mnt/sites_backup#2 type ext4 (rw,relatime,user_xattr,<u></u>barrier=1,stripe=128,data=<u></u>ordered,_netdev)<br>
<br>
<br>
Trying to restart|stop open-iscsi as if we have a new configured target:<br>
<br>
root@archive:~# /etc/init.d/open-iscsi restart<br>
[....] Unmounting iscsi-backed filesystems: Unmounting all devices marked _netdevumount: /: device is busy.<br>
        (In some cases useful info about processes that use<br>
         the device is found by lsof(8) or fuser(1))<br>
[warn] Could not unmount / ... (warning).<br>
 failed!<br>
invoke-rc.d: initscript umountiscsi.sh, action "stop" failed.<br>
[FAIL] Couldn't unmount all iSCSI devices. Cannot stop iSCSI service ... failed!<br>
root@archive:~#<br>
<br>
>From initscript errors : umountiscsi trying to unmount "/" partition -- Why?<br>
<br>
Inspect the situation:<br>
<br>
Adding -x parameter to umountiscsi.sh<br>
<br>
And try to restart service:<br>
root@archive:~# /etc/init.d/open-iscsi restart<br>
<br>
Look on exerpt output(full report in attached file):<br>
<br>
Here (the cause of problem):<br>
+ [ -d /sys/devices/platform/host4/<u></u>iscsi_host ]<br>
+ [ -d /sys/devices/platform/host4/<u></u>session1/target4:0:0 ]<br>
+ sed s/.*block\///<br>
+ echo /sys/devices/platform/host4/<u></u>session1/target*/*:*/block/*<br>
+ BLOCK_DEV=*<br>
+ awk /^\/dev\/*/ { print $2; }<br>
+ DOS_PARTITIONS=/<br>
+ umount /<br>
umount: /: device is busy.<br>
        (In some cases useful info about processes that use<br>
         the device is found by lsof(8) or fuser(1))<br>
+ exit_status=1<br>
<br>
I think, shell expansion leds to that, so that is why I suggest code to test BLOCK_DEV<br>
variable as empty 'directory' in sysfs i.e. :<br>
<br>
+                       if  ! [ -d $BLOCK_FILE ]; then<br>
+                               continue<br>
+                       fi<br>
<br>
<br>
<br>
And another view to the same problem:<br>
<br>
Code snippet for debug purposes (taken from 'umountiscsi.sh' file) contains only traverse sysfs section:<br>
<br>
root@archive:~# cat traverse.sh<br>
<br>
#!/bin/sh -x<br>
<br>
    for HOST_DIR in /sys/devices/platform/host*; do<br>
if ! [ -d $HOST_DIR/iscsi_host* ]; then<br>
    continue<br>
fi<br>
        for SESSION_DIR in $HOST_DIR/session*; do<br>
        if ! [ -d $SESSION_DIR/target* ]; then<br>
                continue<br>
        fi<br>
        for BLOCK_FILE in $SESSION_DIR/target*/*\:*/<u></u>block/*; do<br>
                BLOCK_DEV=`echo "$BLOCK_FILE" | sed 's/.*block\///'`<br>
                DOS_PARTITIONS="`awk "/^\/dev\/$BLOCK_DEV/ { print \\$2; }" < /proc/mounts`"<br>
                echo DEBUG:${BLOCK_FILE}<br>
                echo DEBUG:${DOS_PARTITIONS}<br>
                for DEVICE in $DOS_PARTITIONS; do<br>
                        #log_progress_msg $DEVICE<br>
                        #echo $DEVICE<br>
                        echo umount ${DEVICE}<br>
                        exit_status=$?<br>
                        if ! [ $exit_status -eq 0 ]; then<br>
                                umount_fail=1<br>
                                log_warning_msg "Could not unmount $DEVICE"<br>
                        fi<br>
                done<br>
        done<br>
done<br>
    done<br>
<br>
Output with trace mode i.e. bin/sh -x:<br>
<br>
root@archive:~# ./traverse.sh<br>
+ [ -d /sys/devices/platform/host4/<u></u>iscsi_host ]<br>
+ [ -d /sys/devices/platform/host4/<u></u>session1/target4:0:0 ]<br>
+ sed s/.*block\///<br>
+ echo /sys/devices/platform/host4/<u></u>session1/target*/*:*/block/*<br>
+ BLOCK_DEV=*<br>
+ awk /^\/dev\/*/ { print $2; }<br>
+ DOS_PARTITIONS=/<br>
+ echo DEBUG:/sys/devices/platform/<u></u>host4/session1/target*/*:*/<u></u>block/*<br>
DEBUG:/sys/devices/platform/<u></u>host4/session1/target*/*:*/<u></u>block/*<br>
+ echo DEBUG:/<br>
DEBUG:/<br>
+ echo umount /<br>
umount /<br>
+ exit_status=0<br>
+ [ 0 -eq 0 ]<br>
+ [ -d /sys/devices/platform/host5/<u></u>iscsi_host ]<br>
+ [ -d /sys/devices/platform/host5/<u></u>session2/target5:0:0 ]<br>
+ sed s/.*block\///<br>
+ echo /sys/devices/platform/host5/<u></u>session2/target5:0:0/5:0:0:0/<u></u>block/sdb<br>
+ BLOCK_DEV=sdb<br>
+ awk /^\/dev\/sdb/ { print $2; }<br>
+ DOS_PARTITIONS=<br>
+ echo DEBUG:/sys/devices/platform/<u></u>host5/session2/target5:0:0/5:<u></u>0:0:0/block/sdb<br>
DEBUG:/sys/devices/platform/<u></u>host5/session2/target5:0:0/5:<u></u>0:0:0/block/sdb<br>
+ echo DEBUG:<br>
DEBUG:<br>
+ [ -d /sys/devices/platform/host6/<u></u>iscsi_host ]<br>
+ [ -d /sys/devices/platform/host6/<u></u>session3/target6:0:0 ]<br>
+ sed s/.*block\///<br>
+ echo /sys/devices/platform/host6/<u></u>session3/target6:0:0/6:0:0:0/<u></u>block/sda<br>
+ BLOCK_DEV=sda<br>
+ awk /^\/dev\/sda/ { print $2; }<br>
+ DOS_PARTITIONS=<br>
+ echo DEBUG:/sys/devices/platform/<u></u>host6/session3/target6:0:0/6:<u></u>0:0:0/block/sda<br>
DEBUG:/sys/devices/platform/<u></u>host6/session3/target6:0:0/6:<u></u>0:0:0/block/sda<br>
+ echo DEBUG:<br>
DEBUG:<br>
root@archive:~#<br>
<br>
<br>
Output without dash trace mode:<br>
<br>
root@archive:~# ./traverse.sh<br>
DEBUG:/sys/devices/platform/<u></u>host4/session1/target*/*:*/<u></u>block/*<br>
DEBUG:/<br>
umount /<br>
DEBUG:/sys/devices/platform/<u></u>host5/session2/target5:0:0/5:<u></u>0:0:0/block/sdb<br>
DEBUG:<br>
DEBUG:/sys/devices/platform/<u></u>host6/session3/target6:0:0/6:<u></u>0:0:0/block/sda<br>
DEBUG:<br>
root@archive:~#<br>
<br>
--<br>
Dmitry Danilov.<br>
</blockquote></div>