Package: iscsitarget
Version: 1.4.20.2-10.1
Severity: important
Tags: upstream

Under heavy load the iscsitarget services fails to stop on module removal.

# service iscsitarget stop
[ ok ] Removing iSCSI enterprise target devices: :.
[ ok ] Stopping iSCSI enterprise target service: :.
[....] Removing iSCSI enterprise target modules: :FATAL: Module iscsi_trgt is 
in use.

Changing etc/init/init.debian to use `rmmod --wait` instead of `modprobe -r` 
corrects this issue.

This problem causes pacemaker to halt on failover to a secondary node when 
using the lsb resouce agent
to control iscsitarget.


-- System Information:
Debian Release: 7.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages iscsitarget depends on:
ii  libc6     2.13-38+deb7u1
ii  lsb-base  4.1+Debian8+deb7u1
ii  procps    1:3.3.3-3

Versions of packages iscsitarget recommends:
pn  iscsitarget-module  <none>

Versions of packages iscsitarget suggests:
ii  iscsitarget-dkms  1.4.20.2-10.1

-- Configuration Files:
/etc/default/iscsitarget changed:
ISCSITARGET_ENABLE=true
ISCSITARGET_OPTIONS=""

/etc/iet/ietd.conf changed:
        # CHAP Users
        #
        # The same rules as for discovery users apply here.
        #
        # Don't set them if you don't want to use CHAP authentication.
        #
        #IncomingUser joe secret
        #OutgoingUser jim 12charpasswd
        #
        # Logical Unit definition
        #
        # Block devices, regular files (fileio only), LVM, and RAID
        # can be offered to the initiators as a block device.
        #
        # Lun numbers MUST start with zero (each target needs a Lun 0)
        #
        #Lun 0 Path=/dev/sdc,Type=fileio,ScsiId=xyz,ScsiSN=xyz
        #
        # Alias name for this target (Not Used)
        #
        #Alias Test
        #
        # Various iSCSI parameters
        # (not all are used right now, see also iSCSI spec for details)
        #
        # Outgoing SCSI data (initiator to target user data or command
        # parameters) is sent as either solicited data or unsolicited data.
        # Solicited data is sent in response to R2T PDUs.  Unsolicited data
        # can be sent as part of an iSCSI command PDU sequence
        # ("Immediate Data") or as a separate iSCSI data PDU sequence.
        #
        #MaxConnections         1               # Number of connections/session
                                                # We only support 1
        #MaxSessions            0               # Number of sessions/target
                                                # 0 = no explicit limit
        #InitialR2T             Yes             # Wait first for R2T
                                                # Yes = no unsolicited data
        #ImmediateData          Yes             # Data can accompany command
                                                # Yes = cmnd/data in same PDU
        #MaxRecvDataSegmentLength 8192          # Max data per PDU to receive
        #MaxXmitDataSegmentLength 8192          # Max data per PDU to transmit
        #MaxBurstLength         262144          # Max data per sequence (R2T)
        #FirstBurstLength       65536           # Max unsolicited data sequence
        #DefaultTime2Wait       2               # Secs to wait for ini to logout
                                                # also secs for ini to wait
                                                # before logging back in
                                                # Not implemented, but settable
        #DefaultTime2Retain     0               # Secs keep session after logout
                                                # We only support 0
        #MaxOutstandingR2T      1               # Max outstanding R2Ts per cmnd
        #DataPDUInOrder         Yes             # Data in PDUs is ordered
                                                # We only support ordered
        #DataSequenceInOrder    Yes             # PDUs in sequence are ordered
                                                # We only support ordered
        #ErrorRecoveryLevel     0               # We only support level 0
        #HeaderDigest           None,CRC32C     # PDU header checksum algo list
                                                # None or CRC32C
                                                # If only one is set then the
                                                # initiator must agree to it
                                                # or the connection will fail
        #DataDigest             None,CRC32C     # PDU data checksum algo list
                                                # Same as above
        #MaxSessions            0               # Maximum number of sessions to
                                                # this target - 0 = unlimited
        #NOPInterval            0               # Send a NOP-In ping each after
                                                # that many seconds if the conn
                                                # is otherwise idle - 0 = off
        #NOPTimeout             0               # Wait that many seconds for a
                                                # response on a NOP-In ping
                                                # If 0 or > NOPInterval, 
NOPInterval
                                                # is used!
        #
        # Various target parameters
        #
        #Wthreads               8               # Number of IO threads
        #QueuedCommands         32              # Number of queued commands
Target iqn.test:mydisk1
        ImmediateData=Yes
        Lun 0 Path=/dev/images/test

/etc/init.d/iscsitarget changed:
PID_FILE=/var/run/ietd.pid
CONFIG_FILE=/etc/iet/ietd.conf
DAEMON=/usr/sbin/ietd
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions # log_{warn,failure}_msg
ISCSITARGET_ENABLE=false
ISCSITARGET_DEFAULTS_FILE=/etc/default/iscsitarget
if [ -s "$ISCSITARGET_DEFAULTS_FILE" ]; then
    . "$ISCSITARGET_DEFAULTS_FILE"
    case "x$ISCSITARGET_ENABLE" in
        xtrue|xfalse) ;;
        *)
            log_failure_msg "value of ISCSITARGET_ENABLE must be either 'true' 
or 'false';"
            log_failure_msg "not starting iscsitarget."
            exit 1
            ;;
    esac
fi
RETVAL=0
ietd_start()
{
        log_daemon_msg "Starting iSCSI enterprise target service"
        modprobe -q crc32c
        modprobe iscsi_trgt
        RETVAL=$?
        if [ $RETVAL != "0" ] ;  then 
                log_end_msg 1
                exit $RETVAL
        fi
        start-stop-daemon --start --exec $DAEMON --quiet --oknodo -- 
$ISCSITARGET_OPTIONS
        RETVAL=$?
        if [ $RETVAL = "0" ]; then
                log_end_msg 0
        else
                log_end_msg 1
                exit $RETVAL
        fi          
        log_end_msg 0
        exit 0
}
        
ietd_stop()
{
        log_daemon_msg "Removing iSCSI enterprise target devices: "
        pidof ietd >/dev/null 2>&1 
        RETVAL=$?
        if [ $RETVAL = "0" ] ; then
                # ugly, but ietadm does not allways provides correct exit values
                RETURN=`ietadm --op delete 2>&1`
                RETVAL=$?
                if [ $RETVAL = "0" ] && [ "$RETURN" != "something wrong" ] ; 
then
                        log_end_msg 0
                else
                        log_end_msg 1
                        log_failure_msg "failed with reason :$RETURN"
                        exit $RETVAL
                fi
                log_daemon_msg "Stopping iSCSI enterprise target service: "
                start-stop-daemon --stop --quiet --exec $DAEMON --pidfile 
$PID_FILE --oknodo
                RETVAL=$?
                if [ $RETVAL = "0" ]; then
                        log_end_msg 0
                else
                        log_end_msg 1
                fi
        else
                log_end_msg 0
        fi
        # ugly, but pid file is not removed by ietd
        rm -f $PID_FILE
        
        # check if the module is loaded at all
        lsmod | grep -q iscsi_trgt
        RETVAL=$?
        if [ $RETVAL = "0" ] ; then
                
                log_daemon_msg "Removing iSCSI enterprise target modules: "
                rmmod --wait iscsi_trgt
                RETVAL=$?
                modprobe -r crc32c 2>/dev/null
                if [ $RETVAL = "0" ]; then
                        log_end_msg 0
                else
                        log_end_msg 1
                        exit $RETVAL
                fi
        fi
}
case "$1" in
  start)
        if [ "$ISCSITARGET_ENABLE" = "true" ]; then
            ietd_start
        else
            log_warning_msg "iscsitarget not enabled in 
\"$ISCSITARGET_DEFAULTS_FILE\", not starting..."
        fi
        ;;
  stop)
        ietd_stop
        ;;
  restart|force-reload)
        ietd_stop
        sleep 1
        if [ "$ISCSITARGET_ENABLE" = "true" ]; then
            ietd_start
        else
            log_warning_msg "iscsitarget not enabled in 
\"$ISCSITARGET_DEFAULTS_FILE\", not starting..."
        fi
        ;;
  status)
        status_of_proc -p $PID_FILE $DAEMON "iSCSI enterprise target" && exit 0 
|| exit $?
        ;;
  *)
        log_action_msg "Usage: $0 {start|stop|restart|status}"
        exit 1
esac
exit 0


-- no debconf information


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to