Hello !
17.10.2014 00:44, Ritesh Raj Sarraf пишет:
On Thursday 16 October 2014 09:10 AM, Dmitry Danilov wrote:
Yes, as I see, BLOCK_FILE variable should serves that.
Sorry. But I'm not understanding this correct. Are you saying we
don't need the
patch ?
--
Ritesh Raj Sarraf
RESEARCHUT -http://www.researchut.com
"Necessity is the mother of invention."
I think we need a patch.
Let's look at problem again:
What we have:
system:
root@archive:~# uname -a
Linux archive 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64
GNU/Linux
root@archive:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.6 (wheezy)
Release: 7.6
Codename: wheezy
mounted partitions:
root@archive:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs
(rw,relatime,size=10240k,nr_inodes=62130,mode=755)
devpts on /dev/pts type devpts
(rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs
(rw,nosuid,noexec,relatime,size=50896k,mode=755)
/dev/disk/by-uuid/51c02def-2358-4270-a76d-3161633a1b22 on / type ext4
(rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs
(rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs
(rw,nosuid,nodev,noexec,relatime,size=296960k)
/dev/sdb1 on /mnt/sites_backup type ext4
(rw,relatime,user_xattr,acl,barrier=1,data=ordered,_netdev)
/dev/sda1 on /mnt/sites_backup#2 type ext4
(rw,relatime,user_xattr,barrier=1,stripe=128,data=ordered,_netdev)
Trying to restart|stop open-iscsi as if we have a new configured
target:
root@archive:~# /etc/init.d/open-iscsi restart
[....] Unmounting iscsi-backed filesystems: Unmounting all devices
marked _netdevumount: /: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[warn] Could not unmount / ... (warning).
failed!
invoke-rc.d: initscript umountiscsi.sh, action "stop" failed.
[FAIL] Couldn't unmount all iSCSI devices. Cannot stop iSCSI service
... failed!
root@archive:~#
From initscript errors : umountiscsi trying to unmount "/" partition --
Why?
Inspect the situation:
Adding -x parameter to umountiscsi.sh
And try to restart service:
root@archive:~# /etc/init.d/open-iscsi restart
Look on exerpt output(full report in attached file):
Here (the cause of problem):
+ [ -d /sys/devices/platform/host4/iscsi_host ]
+ [ -d /sys/devices/platform/host4/session1/target4:0:0 ]
+ sed s/.*block\///
+ echo /sys/devices/platform/host4/session1/target*/*:*/block/*
+ BLOCK_DEV=*
+ awk /^\/dev\/*/ { print $2; }
+ DOS_PARTITIONS=/
+ umount /
umount: /: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
+ exit_status=1
I think, shell expansion leds to that, so that is why I suggest code to
test BLOCK_DEV
variable as empty 'directory' in sysfs i.e. :
+ if ! [ -d $BLOCK_FILE ]; then
+ continue
+ fi
And another view to the same problem:
Code snippet for debug purposes (taken from 'umountiscsi.sh' file)
contains only traverse sysfs section:
root@archive:~# cat traverse.sh
#!/bin/sh -x
for HOST_DIR in /sys/devices/platform/host*; do
if ! [ -d $HOST_DIR/iscsi_host* ]; then
continue
fi
for SESSION_DIR in $HOST_DIR/session*; do
if ! [ -d $SESSION_DIR/target* ]; then
continue
fi
for BLOCK_FILE in $SESSION_DIR/target*/*\:*/block/*; do
BLOCK_DEV=`echo "$BLOCK_FILE" | sed 's/.*block\///'`
DOS_PARTITIONS="`awk "/^\/dev\/$BLOCK_DEV/ { print \\$2; }" <
/proc/mounts`"
echo DEBUG:${BLOCK_FILE}
echo DEBUG:${DOS_PARTITIONS}
for DEVICE in $DOS_PARTITIONS; do
#log_progress_msg $DEVICE
#echo $DEVICE
echo umount ${DEVICE}
exit_status=$?
if ! [ $exit_status -eq 0 ]; then
umount_fail=1
log_warning_msg "Could not unmount $DEVICE"
fi
done
done
done
done
Output with trace mode i.e. bin/sh -x:
root@archive:~# ./traverse.sh
+ [ -d /sys/devices/platform/host4/iscsi_host ]
+ [ -d /sys/devices/platform/host4/session1/target4:0:0 ]
+ sed s/.*block\///
+ echo /sys/devices/platform/host4/session1/target*/*:*/block/*
+ BLOCK_DEV=*
+ awk /^\/dev\/*/ { print $2; }
+ DOS_PARTITIONS=/
+ echo DEBUG:/sys/devices/platform/host4/session1/target*/*:*/block/*
DEBUG:/sys/devices/platform/host4/session1/target*/*:*/block/*
+ echo DEBUG:/
DEBUG:/
+ echo umount /
umount /
+ exit_status=0
+ [ 0 -eq 0 ]
+ [ -d /sys/devices/platform/host5/iscsi_host ]
+ [ -d /sys/devices/platform/host5/session2/target5:0:0 ]
+ sed s/.*block\///
+ echo
/sys/devices/platform/host5/session2/target5:0:0/5:0:0:0/block/sdb
+ BLOCK_DEV=sdb
+ awk /^\/dev\/sdb/ { print $2; }
+ DOS_PARTITIONS=
+ echo
DEBUG:/sys/devices/platform/host5/session2/target5:0:0/5:0:0:0/block/sdb
DEBUG:/sys/devices/platform/host5/session2/target5:0:0/5:0:0:0/block/sdb
+ echo DEBUG:
DEBUG:
+ [ -d /sys/devices/platform/host6/iscsi_host ]
+ [ -d /sys/devices/platform/host6/session3/target6:0:0 ]
+ sed s/.*block\///
+ echo
/sys/devices/platform/host6/session3/target6:0:0/6:0:0:0/block/sda
+ BLOCK_DEV=sda
+ awk /^\/dev\/sda/ { print $2; }
+ DOS_PARTITIONS=
+ echo
DEBUG:/sys/devices/platform/host6/session3/target6:0:0/6:0:0:0/block/sda
DEBUG:/sys/devices/platform/host6/session3/target6:0:0/6:0:0:0/block/sda
+ echo DEBUG:
DEBUG:
root@archive:~#
Output without dash trace mode:
root@archive:~# ./traverse.sh
DEBUG:/sys/devices/platform/host4/session1/target*/*:*/block/*
DEBUG:/
umount /
DEBUG:/sys/devices/platform/host5/session2/target5:0:0/5:0:0:0/block/sdb
DEBUG:
DEBUG:/sys/devices/platform/host6/session3/target6:0:0/6:0:0:0/block/sda
DEBUG:
root@archive:~#
--
Dmitry Danilov.
root@archive:~# /etc/init.d/open-iscsi restart
+ . /lib/init/vars.sh
+ TMPTIME=0
+ SULOGIN=no
+ DELAYLOGIN=no
+ UTC=yes
+ VERBOSE=no
+ FSCKFIX=no
+ [ -f /etc/default/rcS ]
+ . /etc/default/rcS
+ unset EDITMOTD
+ unset RAMRUN
+ unset RAMLOCK
+ [ -r /proc/cmdline ]
+ cat /proc/cmdline
+ [ ]
+ break
+ [ ]
+ . /lib/lsb/init-functions
+ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
+ [ -r /lib/lsb/init-functions.d/20-left-info-blocks ]
+ . /lib/lsb/init-functions.d/20-left-info-blocks
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ true
+ [ -f /etc/default/open-iscsi ]
+ . /etc/default/open-iscsi
+ LVMGROUPS=
+ HANDLE_NETDEV=1
+ do_stop
+ log_daemon_msg Unmounting iscsi-backed filesystems
+ [ -z Unmounting iscsi-backed filesystems ]
+ log_daemon_msg_pre Unmounting iscsi-backed filesystems
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z ]
+ FANCYTTY=1
+ true
+ /bin/echo -n [....]
[....] + [ -z ]
+ /bin/echo -n Unmounting iscsi-backed filesystems:
Unmounting iscsi-backed filesystems:+ return
+ umount_fail=0
+ [ 1 -eq 1 ]
+ log_progress_msg Unmounting all devices marked _netdev
+ [ -z Unmounting all devices marked _netdev ]
+ /bin/echo -n Unmounting all devices marked _netdev
Unmounting all devices marked _netdev+ umount -a -O _netdev
+ [ -n ]
+ [ -d /sys/devices/platform/host4/iscsi_host ]
+ [ -d /sys/devices/platform/host4/session1/target4:0:0 ]
+ sed s/.*block\///
+ echo /sys/devices/platform/host4/session1/target*/*:*/block/*
+ BLOCK_DEV=*
+ awk /^\/dev\/*/ { print $2; }
+ DOS_PARTITIONS=/
+ umount /
umount: /: device is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
+ exit_status=1
+ [ 1 -eq 0 ]
+ umount_fail=1
+ log_warning_msg Could not unmount /
+ [ -n Could not unmount / ]
+ log_begin_msg Could not unmount / ...
+ log_begin_msg_pre Could not unmount / ...
+ log_daemon_msg_pre Could not unmount / ...
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z 1 ]
+ true
+ true
+ /bin/echo -n [....]
[....] + [ -z Could ]
+ /bin/echo -n Could not unmount / ...
Could not unmount / ...+ log_begin_msg_post Could not unmount / ...
+ :
+ log_end_msg 255
+ [ -z 255 ]
+ local retval
+ retval=255
+ log_end_msg_pre 255
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z 1 ]
+ true
+ true
+ /usr/bin/tput setaf 1
+ RED=
+ /usr/bin/tput setaf 2
+ GREEN=
+ /usr/bin/tput setaf 3
+ YELLOW=
+ /usr/bin/tput op
+ NORMAL=
+ /usr/bin/tput civis
+ /usr/bin/tput sc
+ /usr/bin/tput hpa 0
+ [ 255 -eq 0 ]
+ [ 255 -eq 255 ]
+ /bin/echo -ne [warn
[warn+ /usr/bin/tput rc
+ /usr/bin/tput cnorm
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z 1 ]
+ true
+ true
+ /usr/bin/tput setaf 1
+ RED=
+ /usr/bin/tput setaf 3
+ YELLOW=
+ /usr/bin/tput op
+ NORMAL=
+ [ 255 -eq 0 ]
+ [ 255 -eq 255 ]
+ /bin/echo -e (warning).
(warning).
+ log_end_msg_post 255
+ :
+ return 255
+ true
+ [ -d /sys/devices/platform/host5/iscsi_host ]
+ [ -d /sys/devices/platform/host5/session2/target5:0:0 ]
+ sed s/.*block\///
+ echo /sys/devices/platform/host5/session2/target5:0:0/5:0:0:0/block/sdb
+ BLOCK_DEV=sdb
+ awk /^\/dev\/sdb/ { print $2; }
+ DOS_PARTITIONS=
+ [ -d /sys/devices/platform/host6/iscsi_host ]
+ [ -d /sys/devices/platform/host6/session3/target6:0:0 ]
+ sed s/.*block\///
+ echo /sys/devices/platform/host6/session3/target6:0:0/6:0:0:0/block/sda
+ BLOCK_DEV=sda
+ awk /^\/dev\/sda/ { print $2; }
+ DOS_PARTITIONS=
+ [ 1 -ne 0 ]
+ log_end_msg 1
+ [ -z 1 ]
+ local retval
+ retval=1
+ log_end_msg_pre 1
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z 1 ]
+ true
+ true
+ /usr/bin/tput setaf 1
+ RED=
+ /usr/bin/tput setaf 2
+ GREEN=
+ /usr/bin/tput setaf 3
+ YELLOW=
+ /usr/bin/tput op
+ NORMAL=
+ /usr/bin/tput civis
+ /usr/bin/tput sc
+ /usr/bin/tput hpa 0
+ [ 1 -eq 0 ]
+ [ 1 -eq 255 ]
+ /bin/echo -ne [FAIL
[FAIL+ /usr/bin/tput rc
+ /usr/bin/tput cnorm
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm != x ]
+ [ xxterm != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z 1 ]
+ true
+ true
+ /usr/bin/tput setaf 1
+ RED=
+ /usr/bin/tput setaf 3
+ YELLOW=
+ /usr/bin/tput op
+ NORMAL=
+ [ 1 -eq 0 ]
+ [ 1 -eq 255 ]
+ /bin/echo -e failed!
failed!
+ log_end_msg_post 1
+ :
+ return 1
+ exit 1
invoke-rc.d: initscript umountiscsi.sh, action "stop" failed.
[FAIL] Couldn't unmount all iSCSI devices. Cannot stop iSCSI service ... failed!
root@archive:~#