Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2018-10-14 15:05:56 -07:00
22 changed files with 174 additions and 155 deletions

View File

@@ -1,5 +1,15 @@
config FCST
tristate "SCST target module for Fibre Channel using libfc"
tristate "SCST FCoE target module"
depends on LIBFC && SCST
---help---
Supports using libfc HBAs as target adapters with SCST
help
The fcst kernel module implements an SCST target driver for the FCoE
protocol. FCoE or Fibre Channel over Ethernet is a protocol that
allows to communicate fibre channel frames over an Ethernet
network. Since the FCoE protocol requires a lossless Ethernet
network, special network adapters and switches are required.
Ethernet network adapters that support FCoE are called Converged
Network Adapters (CNA). The standard that makes lossless Ethernet
communication possible is called DCB or Data Center Bridging. Since
FCoE frames are a kind of Ethernet frames, communication between
FCoE clients and servers is limited to a single Ethernet broadcast
domain.

View File

@@ -342,7 +342,7 @@ static int ibmvstgt_rdma(struct scst_cmd *sc, struct scatterlist *sg, int nsg,
}
#if !defined(CONFIG_SCST_PROC)
/**
/*
* ibmvstgt_enable_target() - Allows to enable a target via sysfs.
*/
static int ibmvstgt_enable_target(struct scst_tgt *scst_tgt, bool enable)
@@ -365,7 +365,7 @@ static int ibmvstgt_enable_target(struct scst_tgt *scst_tgt, bool enable)
return 0;
}
/**
/*
* ibmvstgt_is_target_enabled() - Allows to query a targets status via sysfs.
*/
static bool ibmvstgt_is_target_enabled(struct scst_tgt *scst_tgt)
@@ -391,7 +391,7 @@ static bool ibmvstgt_is_target_enabled(struct scst_tgt *scst_tgt)
}
#endif
/**
/*
* ibmvstgt_release() - Free the resources associated with an SCST target.
*
* Callback function called by the SCST core from scst_unregister_target().
@@ -413,7 +413,7 @@ static int ibmvstgt_release(struct scst_tgt *scst_tgt)
return 0;
}
/**
/*
* ibmvstgt_xmit_response() - Transmits the response to a SCSI command.
*
* Callback function called by the SCST core. Must not block. Must ensure that
@@ -460,7 +460,7 @@ out:
return SCST_TGT_RES_SUCCESS;
}
/**
/*
* ibmvstgt_rdy_to_xfer() - Transfers data from initiator to target.
*
* Called by the SCST core to transfer data from the initiator to the target
@@ -489,7 +489,7 @@ static int ibmvstgt_rdy_to_xfer(struct scst_cmd *sc)
return SCST_TGT_RES_SUCCESS;
}
/**
/*
* ibmvstgt_on_free_cmd() - Free command-private data.
*
* Called by the SCST core. May be called in IRQ context.
@@ -911,8 +911,8 @@ static int crq_queue_create(struct crq_queue *queue, struct srp_target *target)
goto reg_crq_failed;
}
err = request_irq(vport->dma_dev->irq, &ibmvstgt_interrupt,
IRQF_DISABLED, "ibmvstgt", target);
err = request_irq(vport->dma_dev->irq, &ibmvstgt_interrupt, 0,
"ibmvstgt", target);
if (err)
goto req_irq_failed;
@@ -1018,7 +1018,7 @@ static inline struct viosrp_crq *next_crq(struct crq_queue *queue)
return crq;
}
/**
/*
* handle_crq() - Process the command/response queue.
*
* Note: Although this function is not thread-safe because of how it is
@@ -1079,7 +1079,7 @@ static int ibmvstgt_get_serial(const struct scst_tgt_dev *tgt_dev, char *buf,
GETBUS(lun), GETTARGET(lun), GETLUN(lun));
}
/**
/*
* ibmvstgt_get_transportid() - SCST TransportID callback function.
*
* See also SPC-3, section 7.5.4.5, TransportID for initiator ports using SRP.
@@ -1158,10 +1158,7 @@ static ssize_t unit_address_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%x\n", vport->dma_dev->unit_address);
}
static struct class_attribute ibmvstgt_class_attrs[] = {
__ATTR_NULL,
};
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
static struct class_device_attribute ibmvstgt_attrs[] = {
#else
@@ -1172,6 +1169,27 @@ static struct device_attribute ibmvstgt_attrs[] = {
__ATTR(unit_address, S_IRUGO, unit_address_show, NULL),
__ATTR_NULL,
};
#else
static DEVICE_ATTR_RO(system_id);
static DEVICE_ATTR_RO(partition_number);
static DEVICE_ATTR_RO(unit_address);
static struct attribute *ibmvstgt_attrs[] = {
&dev_attr_system_id.attr,
&dev_attr_partition_number.attr,
&dev_attr_unit_address.attr,
NULL,
};
static const struct attribute_group ibmvstgt_attr_group = {
.attrs = ibmvstgt_attrs,
};
static const struct attribute_group *ibmvstgt_groups[] = {
&ibmvstgt_attr_group,
NULL,
};
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
static void ibmvstgt_dev_release(struct class_device *dev)
@@ -1187,11 +1205,12 @@ static struct class ibmvstgt_class = {
#else
.dev_release = ibmvstgt_dev_release,
#endif
.class_attrs = ibmvstgt_class_attrs,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
.class_dev_attrs= ibmvstgt_attrs,
#else
#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
.dev_attrs = ibmvstgt_attrs,
#else
.dev_groups = ibmvstgt_groups,
#endif
};
@@ -1200,10 +1219,11 @@ static struct scst_tgt_template ibmvstgt_template = {
.preferred_addr_method = SCST_LUN_ADDR_METHOD_LUN,
#ifdef RHEL_MAJOR
.sg_tablesize = 1024,
#else
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
.sg_tablesize = SCSI_MAX_SG_SEGMENTS,
#else
.sg_tablesize = SG_CHUNK_SIZE,
#endif
.fake_aca = true,
.get_serial = ibmvstgt_get_serial,
#if defined(CONFIG_SCST_DEBUG) || defined(CONFIG_SCST_TRACING)

View File

@@ -728,9 +728,11 @@ sdev_store_queue_ramp_up_period(struct device *dev,
{
struct scsi_device *sdev = to_scsi_device(dev);
unsigned long period;
int res;
if (strict_strtoul(buf, 10, &period))
return -EINVAL;
res = kstrtoul(buf, 10, &period);
if (res < 0)
return res;
sdev->queue_ramp_up_period = msecs_to_jiffies(period);
return period;

View File

@@ -3,9 +3,10 @@ config SCST_ISCSI
depends on SCST && INET && LIBCRC32C
default SCST
help
ISCSI target driver for SCST framework. The iSCSI protocol has been
defined in RFC 3720. To use it you should download from
http://scst.sourceforge.net the user space part of it.
ISCSI target driver for SCST. The iSCSI protocol has been defined in
RFC 3720. To use this target driver you will not only have to enable
this kernel module but you will also have to download the
corresponding user space daemon from http://scst.sourceforge.net.
config SCST_ISCSI_DEBUG_DIGEST_FAILURES
bool "Simulate iSCSI digest failures"

View File

@@ -196,14 +196,14 @@ static ssize_t iscsi_get_target_ip(struct iscsi_conn *conn,
switch (sk->sk_family) {
case AF_INET:
pos = scnprintf(buf, size,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
"%u.%u.%u.%u", NIPQUAD(inet_sk(sk)->saddr));
#else
"%pI4", &inet_sk(sk)->inet_saddr);
#endif
break;
case AF_INET6:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
pos = scnprintf(buf, size,
"[%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]",
NIP6(inet6_sk(sk)->saddr));

View File

@@ -3,7 +3,9 @@ config SCST_ISER
depends on SCST && SCST_ISCSI && INFINIBAND
default SCST
help
ISER target driver for SCST framework. The iSCSI iSER extension
ISER target driver for SCST framework. iSER is a protocol that
extends iSCSI to use Remote Direct Memory Access (RDMA). RDMA over
InfiniBand, iWARP and RoCE are supported. The iSCSI iSER extension
has been defined in RFC 5046.
If unsure, say "N".

View File

@@ -685,13 +685,9 @@ static ssize_t iscsi_acg_sess_dedicated_threads_store(struct kobject *kobj,
acg = container_of(kobj, struct scst_acg, acg_kobj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buf, 0, &val);
#else
res = strict_strtoul(buf, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strict_strtoul() for %s failed: %d ", buf, res);
PRINT_ERROR("kstrtoul() for %s failed: %d ", buf, res);
goto out;
}

View File

@@ -13,14 +13,14 @@ mail.
INSTALLATION
Place files SCSTTarget and SCSTLun into pacemaker ocf directory (usually
Place files SCSTTarget and SCSTLun into pacemaker ocf directory (usually
/usr/lib/ocf/resource.d or /usr/lib64/ocf/resource.d)
EXAMPLE OF USAGE
Assumptions:
Assumptions:
- you are using DRBD as backing device (/dev/drbd1)
- your target iqn is iqn.2012-02.com.mysuperhasan:vdisk.lun
- your nic reserved for iscsi is eth2 and your iscsi subnet is 192.168.103.x
@@ -36,7 +36,7 @@ primitive ISCSI_IP ocf:heartbeat:IPaddr2 \
op monitor interval="10s"
primitive ISCSI_LUN ocf:scst:SCSTLun \
params target_iqn="iqn.2012-02.com.mysuperhasan:vdisk.lun" lun="0" \
path="/dev/drbd1" handler="vdisk_fileio" device_name="VDISK-LUN10" \
path="/dev/drbd1" handler="vdisk_fileio" device_name="VDISK-LUN10" \
additional_parameters="nv_cache=1" \
op monitor interval="10s" timeout="120s"
primitive ISCSI_TGT ocf:scst:SCSTTarget \
@@ -54,7 +54,7 @@ order OR_DRBD_BEFORE_ISCSI inf: MS_DRBD_VOLUME:promote GR_ISCSI:start
CURRENT LIMITATIONS
Scripts are tested only with straight drbd or lvm over drbd as backing device,
Scripts are tested only with straight drbd or lvm over drbd as backing device,
using vdisk_fileio, with one lun per target.
CHAP authentication is configurable, but not yet tested. My current version of SCST

View File

@@ -7,8 +7,8 @@
# and Linux-HA contributors
#
# Based on ISCSILogicalUnit from Florian Haas, Dejan Muhamedagic,
#
#
#
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
@@ -43,7 +43,7 @@ meta_data() {
<version>1.0</version>
<longdesc lang="en">
Manages SCST iSCSI Logical Unit. An iSCSI Logical unit is a subdivision of
Manages SCST iSCSI Logical Unit. An iSCSI Logical unit is a subdivision of
an SCSI Target, exported via a daemon that speaks the iSCSI protocol.
</longdesc>
<shortdesc lang="en">Manages iSCSI Logical Units (LUs)</shortdesc>
@@ -86,7 +86,7 @@ The handler used (vdisk_blockio, vdisk_fileio, dev_tape ...).</longdesc>
<parameter name="scsi_id" required="0" unique="0">
<longdesc lang="en">
The t10 device ID of LUN. If not specified default SCST value will be used.
Please note that some initiators, like ESXi, are using only some of the first
Please note that some initiators, like ESXi, are using only some of the first
characters to identify LUN, like 4-6 chars.
</longdesc>
<shortdesc lang="en">t10 device id</shortdesc>
@@ -171,7 +171,7 @@ l_check_module () {
}
l_start_handler () {
#Check Handler, then load module
#Check Handler, then load module
l_check_module
l_load_module $l_module
}
@@ -179,21 +179,21 @@ l_start_handler () {
l_stop_handler () {
local HANDLER_NOT_REQUIRED=true;
#Check if handler is used for other devices, then unload module.
for i in $( ls "${SYSFS_ROOTPATH}/handlers/${OCF_RESKEY_handler}" ) ; do
if [ -d ${SYSFS_ROOTPATH}/handlers/${OCF_RESKEY_handler}/${i} ]; then
HANDLER_NOT_REQUIRED=false
break
fi
done
if $HANDLER_NOT_REQUIRED ; then
ocf_log info "Handler ${OCF_RESKEY_handler} not required, unloading kernel module"
l_check_module
l_check_module
rmmod $l_module
return $?
fi
return 0
return 0
}
SCSTLun_usage() {
@@ -210,48 +210,48 @@ SCSTLun_start() {
return $OCF_SUCCESS
fi
local params
local params
if [ ! ${OCF_RESKEY_path} == "" ]; then
params="filename=${OCF_RESKEY_path}"
fi
if [ ! ${OCF_RESKEY_additional_parameters} == "" ]; then
fi
if [ ! ${OCF_RESKEY_additional_parameters} == "" ]; then
params="${params} ${OCF_RESKEY_additional_parameters}"
fi
ocf_log info "Disabling target ${OCF_RESKEY_target_iqn}"
echo 0 > "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/enabled"
echo 0 > "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/enabled"
ocf_log info "Starting lun ${OCF_RESKEY_lun} on target ${OCF_RESKEY_target_iqn}"
# Load Handler Modules
l_start_handler #|| exit $OCF_ERR_GENERIC
# Open Device
ocf_log info "Opening device ${OCF_RESKEY_device_name}, target ${OCF_RESKEY_target_iqn}"
echo "add_device ${OCF_RESKEY_device_name} ${params// /;}" > "${SCST_BASE}/handlers/${OCF_RESKEY_handler}/mgmt"
echo "add_device ${OCF_RESKEY_device_name} ${params// /;}" > "${SCST_BASE}/handlers/${OCF_RESKEY_handler}/mgmt"
if [ $? -ne 0 ]; then
ocf_log err "FAILED to open device ${OCF_RESKEY_device_name}"
return $OCF_ERR_GENERIC
fi
# Set SCSI SN and t10 dev id
if [ ! ${OCF_RESKEY_scsi_sn} == "" ]; then
ocf_log info "Setting SCSI S/N ${OCF_RESKEY_scsi_sn}"
echo "${OCF_RESKEY_scsi_sn}" > "${SCST_BASE}/devices/${OCF_RESKEY_device_name}/usn"
if [ $? -ne 0 ]; then
ocf_log warn "FAILED to set SCSI S/N!"
fi
fi
if [ ! ${OCF_RESKEY_scsi_id} == "" ]; then
ocf_log info "Setting SCSI ID ${OCF_RESKEY_scsi_sn}-${OCF_RESKEY_scsi_id}"
echo "${OCF_RESKEY_scsi_sn}-${OCF_RESKEY_scsi_id}" > "${SCST_BASE}/devices/${OCF_RESKEY_device_name}/t10_dev_id"
if [ $? -ne 0 ]; then
ocf_log warn "FAILED to set SCSI ID!"
fi
fi
fi
fi
fi
# Assign Device to the Target
ocf_log info "Adding LUN ${OCF_RESKEY_lun}, device ${OCF_RESKEY_device_name}, target ${OCF_RESKEY_target_iqn}"
echo "add ${OCF_RESKEY_device_name} ${OCF_RESKEY_lun}" > "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/luns/mgmt"
@@ -259,11 +259,11 @@ SCSTLun_start() {
ocf_log err "FAILED to add lun ${OCF_RESKEY_lun}"
return $OCF_ERR_GENERIC
fi
#Enable target
ocf_log info "Enabling target ${OCF_RESKEY_target_iqn}"
echo 1 > "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/enabled"
ocf_log info "Started lun ${OCF_RESKEY_lun} on target ${OCF_RESKEY_target_iqn}"
#Debugging purpose
@@ -276,23 +276,23 @@ SCSTLun_stop() {
if [ $? = $OCF_SUCCESS ]; then
ocf_log info "Stopping lun ${OCF_RESKEY_lun} on target ${OCF_RESKEY_target_iqn}"
# Disable Target
ocf_log info "Disabling target ${OCF_RESKEY_target_iqn}"
echo 0 > "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/enabled"
# Drop connections, only if session is using lun
for i in $( ls "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/sessions" ) ; do
for i in $( ls "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/sessions" ) ; do
if [ -d "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/sessions/${i}/luns/${OCF_RESKEY_lun}" ]; then
ocf_log warn "Force closing session to initiator ${i}"
echo 1 > "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/sessions/${i}/force_close"
fi
done
ocf_log info "Removing LUN ${OCF_RESKEY_lun}, device ${OCF_RESKEY_device_name}, target ${OCF_RESKEY_target_iqn}"
echo "del ${OCF_RESKEY_lun}" >${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/luns/mgmt
if [ $? -ne 0 ]; then
ocf_log err "FAILED to remove LUN ${OCF_RESKEY_lun} from target ${OCF_RESKEY_target_iqn}"
#return $OCF_ERR_GENERIC
#return $OCF_ERR_GENERIC
#Don't exit, try to remove device anyway.
fi
@@ -302,20 +302,20 @@ SCSTLun_stop() {
if [ $? -ne 0 ]; then
ocf_log err "FAILED to remove device ${OCF_RESKEY_device_name}"
return $OCF_ERR_GENERIC
fi
fi
# Enable Target
ocf_log info "Enabling target ${OCF_RESKEY_target_iqn}"
echo 1 > "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/enabled"
#Debugging purpose
#scstadmin -write_config /tmp/scst.conf.stop
#Stop Handler
l_stop_handler || exit $OCF_ERR_GENERIC
fi
return $OCF_SUCCESS
}
@@ -324,7 +324,7 @@ SCSTLun_monitor() {
if [ -e "${SCST_BASE}/handlers/${OCF_RESKEY_handler}/${OCF_RESKEY_device_name}" ]; then
return $OCF_SUCCESS
fi
# Check if lun is running.
if [ -e "${ISCSI_BASE}/${OCF_RESKEY_target_iqn}/luns/${OCF_RESKEY_lun}" ]; then
return $OCF_SUCCESS
@@ -336,7 +336,7 @@ SCSTLun_monitor() {
SCSTLun_validate() {
# Do we have all required variables?
# TODO: make this check more precise considering handler used!
for var in target_iqn lun device_name handler; do
param="OCF_RESKEY_${var}"
if [ -z "${!param}" ]; then
@@ -348,7 +348,7 @@ SCSTLun_validate() {
if ! ocf_is_probe; then
# Do we have all required binaries?
check_binary scstadmin
# Is the required kernel functionality available?
if [ ! -d ${SCST_BASE} ]; then
ocf_log err "${SCST_BASE} does not exist or is not a directory -- check if required modules are loaded."

View File

@@ -144,21 +144,21 @@ l_load_module () {
}
l_start_service () {
local running
local running
# Handler modules are loaded in LUN resource agent
# Check if modules are loaded
if [ ! -d ${SYSFS_PATH} ]; then
ocf_log info "Loading scst Modules"
l_load_module scst || return 1
l_load_module iscsi_scst || return 1
#Not critical modules, not unloaded on stop.
l_load_module crc32c
#Not critical modules, not unloaded on stop.
l_load_module crc32c
l_load_module crc32c_intel
fi
# Start Daemon
if [ ! "$(pidof ${ISCSI_DAEMON})" ]; then
ocf_run $ISCSI_DAEMON || return 1
@@ -178,7 +178,7 @@ l_stop_service () {
TARGET_NOT_PRESENT=false
fi
done
#Close sessions
for i in `/bin/ls ${ISCSI_BASE}/${OCF_RESKEY_iqn}/sessions`; do
ocf_log warn "Force closing session to initiator ${i}"
@@ -187,8 +187,8 @@ l_stop_service () {
#Stop process and unload modules
if $TARGET_NOT_PRESENT ; then
ocf_log warn "Daemon not required, stopping ..."
pkill -TERM -f $ISCSI_DAEMON
ocf_log warn "Daemon not required, stopping ..."
pkill -TERM -f $ISCSI_DAEMON
rmmod iscsi_scst
rmmod scst
fi
@@ -212,9 +212,9 @@ SCSTTarget_start() {
local name
local value
local initiator
# Start Service
l_start_service
l_start_service
# Set incoming username and password globally
if [ "${OCF_RESKEY_incoming_username}" != "" ]; then
echo "add_attribute IncomingUser ${OCF_RESKEY_incoming_username} ${OCF_RESKEY_incoming_password}" > ${ISCSI_BASE}/mgmt
@@ -222,39 +222,39 @@ SCSTTarget_start() {
ocf_log warn "Unable to set CHAP Authentication!"
fi
fi
ocf_log info "target ${OCF_RESKEY_iqn}: Starting..."
# Create Target
echo "add_target ${OCF_RESKEY_iqn}" > ${ISCSI_BASE}/mgmt || exit $OCF_ERR_GENERIC
# Set Allowed Portals
if [ "${OCF_RESKEY_portals}" != "none" ]; then
if [ "${OCF_RESKEY_portals}" != "none" ]; then
for param in ${OCF_RESKEY_portals}; do
ocf_log info "Adding allowed portal ${param} to target ${OCF_RESKEY_iqn}"
ocf_log info "Adding allowed portal ${param} to target ${OCF_RESKEY_iqn}"
echo "add_target_attribute ${OCF_RESKEY_iqn} allowed_portal ${param}" > ${ISCSI_BASE}/mgmt
if [ $? -ne 0 ]; then
ocf_log warn "Unable to set Allowed Portal!"
fi
done
done
fi
# Set incoming username and password
if [ "${OCF_RESKEY_incoming_username}" != "" ]; then
echo "add_target_attribute ${OCF_RESKEY_iqn} IncomingUser ${OCF_RESKEY_incoming_username} ${OCF_RESKEY_incoming_password}" > ${ISCSI_BASE}/mgmt
if [ "${OCF_RESKEY_incoming_username}" != "" ]; then
echo "add_target_attribute ${OCF_RESKEY_iqn} IncomingUser ${OCF_RESKEY_incoming_username} ${OCF_RESKEY_incoming_password}" > ${ISCSI_BASE}/mgmt
if [ $? -ne 0 ]; then
ocf_log warn "Unable to set CHAP Authentication!"
fi
fi
fi
ocf_log info "Enabling target ${OCF_RESKEY_iqn}"
ocf_log info "Enabling target ${OCF_RESKEY_iqn}"
# Enable iSCSI Target
echo 1 > "${ISCSI_BASE}/enabled" || exit $OCF_ERR_GENERIC
echo 1 > "${ISCSI_BASE}/enabled" || exit $OCF_ERR_GENERIC
ocf_log debug "SCST target ${OCF_RESKEY_iqn}: Started."
#Debugging purpose
#scstadmin -write_config /tmp/scst.conf.start
#scstadmin -write_config /tmp/scst.conf.start
return $OCF_SUCCESS
}
@@ -262,9 +262,9 @@ SCSTTarget_stop() {
SCSTTarget_monitor
if [ $? = $OCF_SUCCESS ]; then
local param
local param
ocf_log info "target ${OCF_RESKEY_iqn}: Stopping..."
# Check if there are connected luns
for i in $( ls "${ISCSI_BASE}/${OCF_RESKEY_iqn}/luns" ) ; do
if [ -d "${ISCSI_BASE}/${OCF_RESKEY_iqn}/luns/${i}" ]; then
@@ -272,11 +272,11 @@ SCSTTarget_stop() {
exit $OCF_ERR_GENERIC
fi
done
# Disable Target
ocf_log info "disabling target ${OCF_RESKEY_iqn}"
echo 0 > ${ISCSI_BASE}/${OCF_RESKEY_iqn}/enabled || exit $OCF_ERR_GENERIC
#Remove Target
ocf_log info "deleting target ${OCF_RESKEY_iqn}"
echo "del_target ${OCF_RESKEY_iqn}" > ${ISCSI_BASE}/mgmt
@@ -285,20 +285,20 @@ SCSTTarget_stop() {
exit $OCF_ERR_GENERIC
fi
#Debugging purpose
#scstadmin -write_config /tmp/scst.conf.stop
#Check if other targets are running, then stop service and unload modules
#scstadmin -write_config /tmp/scst.conf.stop
#Check if other targets are running, then stop service and unload modules
l_stop_service
ocf_log info "target ${OCF_RESKEY_iqn}: Stopped."
fi
return $OCF_SUCCESS
}
SCSTTarget_monitor() {
if [ -d "${SYSFS_PATH}/${OCF_RESKEY_iqn}" ]; then
if [ -d "${SYSFS_PATH}/${OCF_RESKEY_iqn}" ]; then
return $OCF_SUCCESS
else
else
return $OCF_NOT_RUNNING
fi
}
@@ -317,7 +317,7 @@ SCSTTarget_validate() {
if ! ocf_is_probe; then
check_binary scstadmin
fi
fi
return $OCF_SUCCESS
}

View File

@@ -282,7 +282,7 @@ static int chap_decode_string(char *encoded, u8 *decode_buf, int buf_len, int en
if ((strlen(encoded) - 2) > (2 * buf_len)) {
log_error("%s(%d) BUG? "
" buf[%d] !sufficient to decode string[%d]",
__FUNCTION__, __LINE__, buf_len, (int) strlen(encoded));
__func__, __LINE__, buf_len, (int) strlen(encoded));
return CHAP_TARGET_ERROR;
}
decode_hex_string(encoded + 2, decode_buf, buf_len);
@@ -291,7 +291,7 @@ static int chap_decode_string(char *encoded, u8 *decode_buf, int buf_len, int en
if ((strlen(encoded) - 2) > ((buf_len - 1) / 3 + 1) * 4) {
log_error("%s(%d) BUG? "
" buf[%d] !sufficient to decode string[%d]",
__FUNCTION__, __LINE__, buf_len, (int) strlen(encoded));
__func__, __LINE__, buf_len, (int) strlen(encoded));
return CHAP_TARGET_ERROR;
}
decode_base64_string(encoded + 2, decode_buf, buf_len);
@@ -658,7 +658,7 @@ int cmnd_exec_auth_chap(struct connection *conn)
break;
default:
log_error("%s(%d): BUG. unknown conn->auth_state %d",
__FUNCTION__, __LINE__, conn->auth_state);
__func__, __LINE__, conn->auth_state);
res = CHAP_TARGET_ERROR;
}

View File

@@ -1185,7 +1185,7 @@ int nl_open(void)
nl_fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_ISCSI_SCST);
if (nl_fd == -1) {
log_error("%s %s\n", __FUNCTION__, strerror(errno));
log_error("%s %s\n", __func__, strerror(errno));
return -1;
}
@@ -1201,7 +1201,7 @@ int nl_open(void)
res = nl_write(nl_fd, NULL, 0);
if (res < 0) {
log_error("%s %d\n", __FUNCTION__, res);
log_error("%s %d\n", __func__, res);
close(nl_fd);
return res;
}

View File

@@ -705,9 +705,9 @@ static void event_loop(void)
"you can decrease iscsi_scstd.c::INCOMING_MAX "
"constant to a lower value, e.g. 128, then "
"recompile and reinstall the user space part "
"of iSCSI-SCST.", __FUNCTION__);
"of iSCSI-SCST.", __func__);
else
log_error("%s: poll() failed: %s", __FUNCTION__,
log_error("%s: poll() failed: %s", __func__,
strerror(errno));
exit(1);
}

View File

@@ -1,3 +1,3 @@
#!/bin/bash
../linux-kernel/scripts/checkpatch.pl -f --show-types --ignore SPDX_LICENSE_TAG,LINUX_VERSION_CODE $(list-source-files | grep -vE 'fcst/linux-patches|patch$|pdf$|png$|ibmvstgt/') | sed 's/^#[0-9]*: FILE: \(.*\):/\1:1:/'
../linux-kernel/scripts/checkpatch.pl -f --show-types --ignore SPDX_LICENSE_TAG,LINUX_VERSION_CODE,SYMBOLIC_PERMS,CONSTANT_COMPARISON,RETURN_VOID $(list-source-files | grep -vE 'fcst/linux-patches|patch$|pdf$|png$|^ibmvstgt/|^mpt/|^qla_isp/|^mvsas_tgt/') | sed 's/^#[0-9]*: FILE: \(.*\):/\1:1:/'

View File

@@ -20,8 +20,8 @@
# all (the default) : make all
# clean : clean files
# extraclean : clean + clean dependencies
# install : install
# uninstall : uninstall
# install : install
# uninstall : uninstall
#
# Notes :
# - install and uninstall must be made as root

View File

@@ -1,15 +1,15 @@
#
# SCSI target mid-level dev handler's makefile
#
#
# Copyright (C) 2015 - 2018 Vladislav Bolkhovitin <vst@vlnb.net>
# Copyright (C) 2004 - 2005 Leonid Stoljar
# Copyright (C) 2007 - 2018 Western Digital Corporation
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, version 2
# of the License.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -20,8 +20,8 @@
# all (the default) : make all
# clean : clean files
# extraclean : clean + clean dependencies
# install : install
# uninstall : uninstall
# install : install
# uninstall : uninstall
#
# Notes :
# - install and uninstall must be made as root

View File

@@ -3503,13 +3503,9 @@ static ssize_t scst_dev_sysfs_max_tgt_dev_commands_store(struct kobject *kobj,
dev = container_of(kobj, struct scst_device, dev_kobj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(buf, 0, &newtn);
#else
res = strict_strtol(buf, 0, &newtn);
#endif
if (res != 0) {
PRINT_ERROR("strtol() for %s failed: %d ", buf, res);
PRINT_ERROR("kstrtol() for %s failed: %d ", buf, res);
goto out;
}
if (newtn < 0) {
@@ -3566,13 +3562,9 @@ static ssize_t scst_dev_numa_node_id_store(struct kobject *kobj,
dev = container_of(kobj, struct scst_device, dev_kobj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(buf, 0, &newtn);
#else
res = strict_strtol(buf, 0, &newtn);
#endif
if (res != 0) {
PRINT_ERROR("strtol() for %s failed: %d ", buf, res);
PRINT_ERROR("kstrtol() for %s failed: %d ", buf, res);
goto out;
}
BUILD_BUG_ON(NUMA_NO_NODE != -1);
@@ -4343,11 +4335,7 @@ static ssize_t scst_sess_latency_show(struct kobject *kobj,
return -EINVAL;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(attr->attr.name + 1, 0, &sz);
#else
res = strict_strtol(attr->attr.name + 1, 0, &sz);
#endif
if (WARN_ON(res < 0))
goto out;
i = ilog2(sz) - SCST_STATS_LOG2_SZ_OFFSET;
@@ -6931,11 +6919,7 @@ static ssize_t scst_measure_latency_store(struct kobject *kobj,
long val;
int res;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(buf, 0, &val);
#else
res = strict_strtol(buf, 0, &val);
#endif
if (res < 0)
goto out;
@@ -7322,11 +7306,7 @@ static ssize_t scst_force_global_sgv_pool_store(struct kobject *kobj,
TRACE_ENTRY();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buf, 0, &v);
#else
res = strict_strtoul(buf, 0, &v);
#endif
if (res)
goto out;

View File

@@ -1,7 +1,7 @@
config SCST_LOCAL
tristate "SCST Local driver"
depends on SCST && !HIGHMEM4G && !HIGHMEM64G
---help---
help
This module provides a LLD SCSI driver that connects to
the SCST target mode subsystem in a loop-back manner.
It allows you to test target-mode device-handlers locally.

View File

@@ -11,7 +11,7 @@
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
@@ -24,7 +24,15 @@
#include <linux/slab.h>
#include <linux/completion.h>
#include <linux/spinlock.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
#include <linux/blk-mq.h>
#else
#include <linux/blkdev.h>
static inline u32 blk_mq_unique_tag(struct request *rq)
{
return rq->tag;
}
#endif
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>

View File

@@ -97,7 +97,7 @@ HANDLER dev_cdrom {
DEVICE 2:0:0:0
}
Virtual devices are opened through special CREATE attributes. For example, a
Virtual devices are opened through special CREATE attributes. For example, a
virtual disk named "disk1" pointing to a disk partition /dev/hda1 would be look
like:

View File

@@ -29,7 +29,7 @@ The following pertains to the older procfs based SCST.
The scstadmin script is much more functional than scst_db at this point but uses a
standard text-based config file. The original thought behind scst_db was to write
a daemon process which would except network connections and issue SCST commands. A
client app would then connect to that port.
client app would then connect to that port.
Copy scst.conf to /etc and edit it to your liking. if you have an existing configuration
then have scstadmin write it out to a config file for you:

View File

@@ -250,7 +250,7 @@ start_scst() {
options=""
if [ "$(basename "$d")" = "iscsi-scstd" ]; then
options="${ISCSID_OPTIONS}"
fi
fi
if ! start_daemon $d $options; then
echo "Starting $d failed"
unload_scst