Re: [PATCH] iscsi-target: Fix initial login PDU asynchronous socket close OOPs

2017-05-26 Thread Mike Christie
Thanks for the patch.

On 05/26/2017 12:32 AM, Nicholas A. Bellinger wrote:
>  
> - state = iscsi_target_sk_state_check(sk);
> - write_unlock_bh(&sk->sk_callback_lock);
> -
> - pr_debug("iscsi_target_sk_state_change: state: %d\n", state);
> + orig_state_change(sk);
>  
> - if (!state) {
> - pr_debug("iscsi_target_sk_state_change got failed state\n");
> - schedule_delayed_work(&conn->login_cleanup_work, 0);

I think login_cleanup_work is no longer used so you can also remove it
and its code.

The patch fixes the crash for me. However, is there a possible
regression where if the initiator attempts new relogins we could run out
of memory? With the old code, we would free the login attempts resources
at this time, but with the new code the initiator will send more login
attempts and so we just keep allocating more memory for each attempt
until we run out or the login is finally able to complete.


Re: [PATCH] scsi: sd: Use sysfs_match_string()

2017-05-26 Thread Bart Van Assche
On Fri, 2017-05-26 at 13:02 -0400, Martin K. Petersen wrote:
> Avoid unnecessary snprintf() when formatting variables for display in
> sysfs and switch to sysfs_match_string() for validating user input.

Hello Martin,

Would it be worth it to split this patch into two patches - one for the
snprintf() conversion and another patch for the sysfs_match_string()
conversion?

> @@ -155,7 +155,7 @@ static ssize_t
>  cache_type_store(struct device *dev, struct device_attribute *attr,
>const char *buf, size_t count)
>  {
> - int i, ct = -1, rcd, wce, sp;
> + int ct = -1, rcd, wce, sp;

Is it still necessary to initialize ct in this function?

> + mode = sysfs_match_string(lbp_mode, buf);
> + if (mode < 0)
>   return -EINVAL;
> [ ... ]
> + mode = sysfs_match_string(zeroing_mode, buf);
> + if (mode < 0)
>   return -EINVAL; 

sysfs_match_string() only supports dense arrays. Maybe it's worth to add a
comment above lbp_mode[] and zeroing_mode[] that these must be dense arrays
or that the above calls to sysfs_match_string() will break?

Otherwise this patch looks fine to me.

Bart.

[no subject]

2017-05-26 Thread Anderson McEnany
lis...@veco.ru

>
Subject: Gegenseitiger Partnervorschlag
Date: Fri, 26 May 2017 18:15:45 +0200
MIME-Version: 1.0
Content-Type: text/plain;
charset="Windows-1251"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.

Lieber Freund,

Vielen Dank, dass Sie sich die Zeit genommen haben, meinen gegenseitigen 
Geschäftsvorschlag zu Ihnen zu lesen. Mein Name ist Herr Anderson McEnany, 
Investment Manager bei der City Bank New York, USA.

Mein Ziel, Ihnen den Vorschlag zu schreiben, ist, weil ich einen europäischen 
Klienten habe, dass ich geholfen habe, eine Reihe von seinen Investitionen im 
Mittleren Osten mit einer Einlagensumme von USD21 Millionen Dollar zu 
verwalten, bis vor etwa fünf Jahren, als er plötzlich verstarb und seit fast 4 
Jahren Ich habe nach seinen Verwandten gesucht und schließlich entdeckte ich, 
dass er keine lebenden Verwandten hatte.

Mein Vorschlag an Sie ist, mit Ihnen in der Deal zu arbeiten, ich beabsichtige, 
Sie als die nächste Angehörige zu präsentieren, die es legal für Sie machen 
wird, die Ablagerung für eine der folgenden Angehörigen zu erhalten.

Beide von uns werden gleichberechtigte Partner in diesem Deal sein und ich 
werde von Ihnen abhängen, um den Gesamtbetrag in Ihrem Konto zu erhalten. 
Weitere Informationen, die ich Ihnen geben werde, um meinen Anteil an den 
Mitteln zu überweisen.

Schließlich, wenn du es interessierst, könntest du doch so freundlich sein, mir 
deine vollen Namen zu schicken, Adresse und direkte Telefonnummern und auch 
könntest du mir von dir erzählen und was du für das Leben tust, weil das eine 
riesige finanzielle Transaktion ist und ich will sicher sein Dass du diese 
Transaktion bearbeiten kannst. An der Bank, wo die Gelder hinterlegt sind.

Ihre dringende Antwort wird geschätzt, bitte senden Sie Ihre Antwort Nachricht 
an diese vertrauliche E-Mail Adresse: anderson_mcen...@gmx.com.

Freundliche Grüße,
Herr Anderson McEnany


[PATCH] scsi: sd: Use sysfs_match_string()

2017-05-26 Thread Martin K. Petersen
Avoid unnecessary snprintf() when formatting variables for display in
sysfs and switch to sysfs_match_string() for validating user input.

Signed-off-by: Martin K. Petersen 
---
 drivers/scsi/sd.c | 71 ---
 1 file changed, 26 insertions(+), 45 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index f9d1432d7cc5..aaf5cd7e4e6f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -155,7 +155,7 @@ static ssize_t
 cache_type_store(struct device *dev, struct device_attribute *attr,
 const char *buf, size_t count)
 {
-   int i, ct = -1, rcd, wce, sp;
+   int ct = -1, rcd, wce, sp;
struct scsi_disk *sdkp = to_scsi_disk(dev);
struct scsi_device *sdp = sdkp->device;
char buffer[64];
@@ -178,16 +178,10 @@ cache_type_store(struct device *dev, struct 
device_attribute *attr,
sdkp->cache_override = 0;
}
 
-   for (i = 0; i < ARRAY_SIZE(sd_cache_types); i++) {
-   len = strlen(sd_cache_types[i]);
-   if (strncmp(sd_cache_types[i], buf, len) == 0 &&
-   buf[len] == '\n') {
-   ct = i;
-   break;
-   }
-   }
+   ct = sysfs_match_string(sd_cache_types, buf);
if (ct < 0)
return -EINVAL;
+
rcd = ct & 0x01 ? 1 : 0;
wce = (ct & 0x02) && !sdkp->write_prot ? 1 : 0;
 
@@ -227,7 +221,7 @@ manage_start_stop_show(struct device *dev, struct 
device_attribute *attr,
struct scsi_disk *sdkp = to_scsi_disk(dev);
struct scsi_device *sdp = sdkp->device;
 
-   return snprintf(buf, 20, "%u\n", sdp->manage_start_stop);
+   return sprintf(buf, "%u\n", sdp->manage_start_stop);
 }
 
 static ssize_t
@@ -251,7 +245,7 @@ allow_restart_show(struct device *dev, struct 
device_attribute *attr, char *buf)
 {
struct scsi_disk *sdkp = to_scsi_disk(dev);
 
-   return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart);
+   return sprintf(buf, "%u\n", sdkp->device->allow_restart);
 }
 
 static ssize_t
@@ -279,7 +273,7 @@ cache_type_show(struct device *dev, struct device_attribute 
*attr, char *buf)
struct scsi_disk *sdkp = to_scsi_disk(dev);
int ct = sdkp->RCD + 2*sdkp->WCE;
 
-   return snprintf(buf, 40, "%s\n", sd_cache_types[ct]);
+   return sprintf(buf, "%s\n", sd_cache_types[ct]);
 }
 static DEVICE_ATTR_RW(cache_type);
 
@@ -288,7 +282,7 @@ FUA_show(struct device *dev, struct device_attribute *attr, 
char *buf)
 {
struct scsi_disk *sdkp = to_scsi_disk(dev);
 
-   return snprintf(buf, 20, "%u\n", sdkp->DPOFUA);
+   return sprintf(buf, "%u\n", sdkp->DPOFUA);
 }
 static DEVICE_ATTR_RO(FUA);
 
@@ -298,7 +292,7 @@ protection_type_show(struct device *dev, struct 
device_attribute *attr,
 {
struct scsi_disk *sdkp = to_scsi_disk(dev);
 
-   return snprintf(buf, 20, "%u\n", sdkp->protection_type);
+   return sprintf(buf, "%u\n", sdkp->protection_type);
 }
 
 static ssize_t
@@ -341,9 +335,9 @@ protection_mode_show(struct device *dev, struct 
device_attribute *attr,
}
 
if (!dif && !dix)
-   return snprintf(buf, 20, "none\n");
+   return sprintf(buf, "none\n");
 
-   return snprintf(buf, 20, "%s%u\n", dix ? "dix" : "dif", dif);
+   return sprintf(buf, "%s%u\n", dix ? "dix" : "dif", dif);
 }
 static DEVICE_ATTR_RO(protection_mode);
 
@@ -352,7 +346,7 @@ app_tag_own_show(struct device *dev, struct 
device_attribute *attr, char *buf)
 {
struct scsi_disk *sdkp = to_scsi_disk(dev);
 
-   return snprintf(buf, 20, "%u\n", sdkp->ATO);
+   return sprintf(buf, "%u\n", sdkp->ATO);
 }
 static DEVICE_ATTR_RO(app_tag_own);
 
@@ -362,7 +356,7 @@ thin_provisioning_show(struct device *dev, struct 
device_attribute *attr,
 {
struct scsi_disk *sdkp = to_scsi_disk(dev);
 
-   return snprintf(buf, 20, "%u\n", sdkp->lbpme);
+   return sprintf(buf, "%u\n", sdkp->lbpme);
 }
 static DEVICE_ATTR_RO(thin_provisioning);
 
@@ -381,7 +375,7 @@ provisioning_mode_show(struct device *dev, struct 
device_attribute *attr,
 {
struct scsi_disk *sdkp = to_scsi_disk(dev);
 
-   return snprintf(buf, 20, "%s\n", lbp_mode[sdkp->provisioning_mode]);
+   return sprintf(buf, "%s\n", lbp_mode[sdkp->provisioning_mode]);
 }
 
 static ssize_t
@@ -389,7 +383,7 @@ provisioning_mode_store(struct device *dev, struct 
device_attribute *attr,
const char *buf, size_t count)
 {
struct scsi_disk *sdkp = to_scsi_disk(dev);
-   struct scsi_device *sdp = sdkp->device;
+   int mode;
 
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
@@ -399,21 +393,11 @@ provisioning_mode_store(struct device *dev, struct 
device_attribute *attr,
return count;
}
 
-   if (sdp->type != TYPE_DISK)
+   mode = sysfs_match_string(lbp_mode, buf);
+   if (mode < 0)
   

[PATCH 1/1] scsi: scsi_debug: Avoid PI being disabled when TGPS is enabled

2017-05-26 Thread Martin K. Petersen
It was not possible to enable both T10 PI and TGPS because they share
the same byte in the INQUIRY response. Logically OR the TPGS value
instead of using assignment.

Reported-by: Ritika Srivastava 
Signed-off-by: Martin K. Petersen 
---
 drivers/scsi/scsi_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 17249c3650fe..b945d187873f 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1404,7 +1404,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct 
sdebug_dev_info *devip)
arr[4] = SDEBUG_LONG_INQ_SZ - 5;
arr[5] = (int)have_dif_prot;/* PROTECT bit */
if (sdebug_vpd_use_hostno == 0)
-   arr[5] = 0x10; /* claim: implicit TGPS */
+   arr[5] |= 0x10; /* claim: implicit TGPS */
arr[6] = 0x10; /* claim: MultiP */
/* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */
arr[7] = 0xa; /* claim: LINKED + CMDQUE */
-- 
2.13.0



[PATCH v1 4/4] tcmu: Make dev_config configurable

2017-05-26 Thread Bryant G. Ly
This allows for userspace to change the device path after
it has been created. Thus giving the user the ability to change
the path. The use case for this is to allow for virtual optical
to have media change.

Signed-off-by: Bryant G. Ly 
---
 drivers/target/target_core_user.c | 40 +++
 1 file changed, 40 insertions(+)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index c8c84b7..3036a57 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1548,6 +1548,45 @@ static ssize_t tcmu_cmd_time_out_store(struct 
config_item *item, const char *pag
 }
 CONFIGFS_ATTR(tcmu_, cmd_time_out);
 
+static ssize_t tcmu_dev_path_show(struct config_item *item, char *page)
+{
+   struct se_dev_attrib *da = container_of(to_config_group(item),
+   struct se_dev_attrib, da_group);
+   struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+
+   return snprintf(page, PAGE_SIZE, "%s\n", udev->dev_config);
+}
+
+static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
+  size_t count)
+{
+   struct se_dev_attrib *da = container_of(to_config_group(item),
+   struct se_dev_attrib, da_group);
+   struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+   char *copy = NULL;
+
+   copy = kstrdup(page, GFP_KERNEL);
+
+   if (!copy)
+   return -EINVAL;
+
+   strcpy(udev->dev_config, copy);
+
+   /* Check if device has been configured before */
+   if (tcmu_dev_configured(udev)) {
+   ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
+udev->uio_info.name,
+udev->uio_info.uio_dev->minor);
+   if (ret) {
+   pr_err("Unable to reconfigure device\n");
+   return ret;
+   }
+   }
+
+   return count;
+}
+CONFIGFS_ATTR(tcmu_, dev_path);
+
 static ssize_t tcmu_dev_size_show(struct config_item *item, char *page)
 {
struct se_dev_attrib *da = container_of(to_config_group(item),
@@ -1626,6 +1665,7 @@ CONFIGFS_ATTR(tcmu_, emulate_write_cache);
 
 struct configfs_attribute *tcmu_attrib_attrs[] = {
&tcmu_attr_cmd_time_out,
+   &tcmu_attr_dev_path,
&tcmu_attr_dev_size,
&tcmu_attr_emulate_write_cache,
NULL,
-- 
2.5.4 (Apple Git-61)



[PATCH v1 1/4] tcmu: Support emulate_write_cache

2017-05-26 Thread Bryant G. Ly
This will enable the toggling of write_cache in tcmu through targetcli-fb

Signed-off-by: Bryant G. Ly 
Reviewed-By: Mike Christie 
---
 drivers/target/target_core_user.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index beb5f09..0c797cc 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1290,6 +1290,8 @@ static int tcmu_configure_device(struct se_device *dev)
/* Other attributes can be configured in userspace */
if (!dev->dev_attrib.hw_max_sectors)
dev->dev_attrib.hw_max_sectors = 128;
+   if (!dev->dev_attrib.emulate_write_cache)
+   dev->dev_attrib.emulate_write_cache = 0;
dev->dev_attrib.hw_queue_depth = 128;
 
/*
@@ -1546,6 +1548,32 @@ static ssize_t tcmu_cmd_time_out_store(struct 
config_item *item, const char *pag
 }
 CONFIGFS_ATTR(tcmu_, cmd_time_out);
 
+static ssize_t tcmu_emulate_write_cache_show(struct config_item *item,
+char *page)
+{
+   struct se_dev_attrib *da = container_of(to_config_group(item),
+   struct se_dev_attrib, da_group);
+
+   return snprintf(page, PAGE_SIZE, "%i\n", da->emulate_write_cache);
+}
+
+static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
+ const char *page, size_t count)
+{
+   struct se_dev_attrib *da = container_of(to_config_group(item),
+   struct se_dev_attrib, da_group);
+   int val;
+   int ret;
+
+   ret = kstrtouint(page, 0, &val);
+   if (ret < 0)
+   return ret;
+
+   da->emulate_write_cache = val;
+   return count;
+}
+CONFIGFS_ATTR(tcmu_, emulate_write_cache);
+
 static struct configfs_attribute **tcmu_attrs;
 
 static struct target_backend_ops tcmu_ops = {
@@ -1682,6 +1710,8 @@ static int __init tcmu_module_init(void)
tcmu_attrs[i] = passthrough_attrib_attrs[i];
}
tcmu_attrs[i] = &tcmu_attr_cmd_time_out;
+   i++;
+   tcmu_attrs[i] = &tcmu_attr_emulate_write_cache;
tcmu_ops.tb_dev_attrib_attrs = tcmu_attrs;
 
ret = transport_backend_register(&tcmu_ops);
-- 
2.5.4 (Apple Git-61)



[PATCH v1 3/4] tcmu: Make dev_size configurable via userspace

2017-05-26 Thread Bryant G. Ly
Allow tcmu backstores to be able to set the device size
after it has been configured via set attribute.

Part of support in userspace to support certain backstores
changing device size.

Signed-off-by: Bryant G. Ly 
---
 drivers/target/target_core_user.c | 59 +++
 1 file changed, 54 insertions(+), 5 deletions(-)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index ae91822..c8c84b7 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1548,6 +1548,44 @@ static ssize_t tcmu_cmd_time_out_store(struct 
config_item *item, const char *pag
 }
 CONFIGFS_ATTR(tcmu_, cmd_time_out);
 
+static ssize_t tcmu_dev_size_show(struct config_item *item, char *page)
+{
+   struct se_dev_attrib *da = container_of(to_config_group(item),
+   struct se_dev_attrib, da_group);
+   struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+
+   return snprintf(page, PAGE_SIZE, "%zu\n", udev->dev_size);
+}
+
+static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
+  size_t count)
+{
+   struct se_dev_attrib *da = container_of(to_config_group(item),
+   struct se_dev_attrib, da_group);
+   struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
+   unsigned long val;
+   int ret;
+
+   ret = kstrtoul(page, 0, &val);
+   if (ret < 0)
+   return ret;
+   udev->dev_size = val;
+
+   /* Check if device has been configured before */
+   if (tcmu_dev_configured(udev)) {
+   ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
+udev->uio_info.name,
+udev->uio_info.uio_dev->minor);
+   if (ret) {
+   pr_err("Unable to reconfigure device\n");
+   return ret;
+   }
+   }
+
+   return count;
+}
+CONFIGFS_ATTR(tcmu_, dev_size);
+
 static ssize_t tcmu_emulate_write_cache_show(struct config_item *item,
 char *page)
 {
@@ -1586,6 +1624,13 @@ static ssize_t tcmu_emulate_write_cache_store(struct 
config_item *item,
 }
 CONFIGFS_ATTR(tcmu_, emulate_write_cache);
 
+struct configfs_attribute *tcmu_attrib_attrs[] = {
+   &tcmu_attr_cmd_time_out,
+   &tcmu_attr_dev_size,
+   &tcmu_attr_emulate_write_cache,
+   NULL,
+};
+
 static struct configfs_attribute **tcmu_attrs;
 
 static struct target_backend_ops tcmu_ops = {
@@ -1685,7 +1730,7 @@ static int unmap_thread_fn(void *data)
 
 static int __init tcmu_module_init(void)
 {
-   int ret, i, len = 0;
+   int ret, i, k, len = 0;
 
BUILD_BUG_ON((sizeof(struct tcmu_cmd_entry) % TCMU_OP_ALIGN_SIZE) != 0);
 
@@ -1710,7 +1755,10 @@ static int __init tcmu_module_init(void)
for (i = 0; passthrough_attrib_attrs[i] != NULL; i++) {
len += sizeof(struct configfs_attribute *);
}
-   len += sizeof(struct configfs_attribute *) * 2;
+   for (i = 0; tcmu_attrib_attrs[i] != NULL; i++) {
+   len += sizeof(struct configfs_attribute *);
+   }
+   len += sizeof(struct configfs_attribute *);
 
tcmu_attrs = kzalloc(len, GFP_KERNEL);
if (!tcmu_attrs) {
@@ -1721,9 +1769,10 @@ static int __init tcmu_module_init(void)
for (i = 0; passthrough_attrib_attrs[i] != NULL; i++) {
tcmu_attrs[i] = passthrough_attrib_attrs[i];
}
-   tcmu_attrs[i] = &tcmu_attr_cmd_time_out;
-   i++;
-   tcmu_attrs[i] = &tcmu_attr_emulate_write_cache;
+   for (k = 0; tcmu_attrib_attrs[k] != NULL; k++) {
+   tcmu_attrs[i] = tcmu_attrib_attrs[k];
+   i++;
+   }
tcmu_ops.tb_dev_attrib_attrs = tcmu_attrs;
 
ret = transport_backend_register(&tcmu_ops);
-- 
2.5.4 (Apple Git-61)



[PATCH v1 0/4] TCMU Enable Reconfiguration Patches

2017-05-26 Thread Bryant G. Ly
This patch consists of adding a netlink to allow for reconfiguration
of a device in tcmu.

It also changes and adds some attributes that are reconfigurable:
write_cache, device size, and device path.

Bryant G. Ly (4):
  tcmu: Support emulate_write_cache
  tcmu: Add netlink for device reconfiguration
  tcmu: Make dev_size configurable via userspace
  tcmu: Make dev_config configurable

 drivers/target/target_core_user.c | 137 +-
 include/uapi/linux/target_core_user.h |   1 +
 2 files changed, 135 insertions(+), 3 deletions(-)

-- 
2.5.4 (Apple Git-61)



[PATCH v1 2/4] tcmu: Add netlink for device reconfiguration

2017-05-26 Thread Bryant G. Ly
This gives tcmu the ability to handle events that can cause
reconfiguration, such as resize, path changes, write_cache, etc...

Signed-off-by: Bryant G. Ly 
Reviewed-By: Mike Christie 
---
 drivers/target/target_core_user.c | 12 
 include/uapi/linux/target_core_user.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index 0c797cc..ae91822 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1562,6 +1562,7 @@ static ssize_t tcmu_emulate_write_cache_store(struct 
config_item *item,
 {
struct se_dev_attrib *da = container_of(to_config_group(item),
struct se_dev_attrib, da_group);
+   struct tcmu_dev *udev = TCMU_DEV(da->da_dev);
int val;
int ret;
 
@@ -1570,6 +1571,17 @@ static ssize_t tcmu_emulate_write_cache_store(struct 
config_item *item,
return ret;
 
da->emulate_write_cache = val;
+
+   /* Check if device has been configured before */
+   if (tcmu_dev_configured(udev)) {
+   ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
+udev->uio_info.name,
+udev->uio_info.uio_dev->minor);
+   if (ret) {
+   pr_err("Unable to reconfigure device\n");
+   return ret;
+   }
+   }
return count;
 }
 CONFIGFS_ATTR(tcmu_, emulate_write_cache);
diff --git a/include/uapi/linux/target_core_user.h 
b/include/uapi/linux/target_core_user.h
index af17b41..403a61f 100644
--- a/include/uapi/linux/target_core_user.h
+++ b/include/uapi/linux/target_core_user.h
@@ -130,6 +130,7 @@ enum tcmu_genl_cmd {
TCMU_CMD_UNSPEC,
TCMU_CMD_ADDED_DEVICE,
TCMU_CMD_REMOVED_DEVICE,
+   TCMU_CMD_RECONFIG_DEVICE,
__TCMU_CMD_MAX,
 };
 #define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
-- 
2.5.4 (Apple Git-61)



[PATCH] scsi: lpfc: fix spelling mistake "entrys" -> "entries"

2017-05-26 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in debugfs message

Signed-off-by: Colin Ian King 
---
 drivers/scsi/lpfc/lpfc_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 4bcb92c844ca..efd8a17ac2e5 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -323,7 +323,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, 
int size)
raw_index = phba->hbq_get[i];
getidx = le32_to_cpu(raw_index);
len +=  snprintf(buf+len, size-len,
-   "entrys:%d bufcnt:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
+   "entries:%d bufcnt:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
hbqs->entry_count, hbqs->buffer_count, hbqs->hbqPutIdx,
hbqs->next_hbqPutIdx, hbqs->local_hbqGetIdx, getidx);
 
-- 
2.11.0



Re: [PATCH v2 02/22] scsi: hisi_sas: optimise the usage of hisi_hba.lock

2017-05-26 Thread Arnd Bergmann
On Fri, May 26, 2017 at 2:23 AM, kbuild test robot  wrote:
> Hi Xiang,
>
> [auto build test ERROR on mkp-scsi/for-next]
> [also build test ERROR on v4.12-rc2 next-20170525]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
>
> url:
> https://github.com/0day-ci/linux/commits/John-Garry/hisi_sas-hip08-support/20170526-011153
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
> config: i386-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> All errors (new ones prefixed by >>):
>
>>> ERROR: "__umoddi3" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined!

I think it must come from this line:

+   int queue_id = sas_dev->device_id % hisi_hba->queue_count;

Doing a 64-bit division seems like a rather inefficient way to
pick a queue, especially if you do it on each request. Can you
store the queue_id in sas_dev itself, or use a mask to generate
it instead?

  Arnd


Re: [PATCH 2/6] blk-mq: use the introduced blk_mq_unquiesce_queue()

2017-05-26 Thread Ming Lei
On Fri, May 26, 2017 at 03:46:51PM +0800, kbuild test robot wrote:
> Hi Ming,
> 
> [auto build test ERROR on block/for-next]
> [also build test ERROR on v4.12-rc2 next-20170525]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Ming-Lei/blk-mq-introduce-blk_mq_unquiesce_queue/20170526-140138
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
> for-next
> config: x86_64-randconfig-x019-201721 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64 
> 
> Note: the 
> linux-review/Ming-Lei/blk-mq-introduce-blk_mq_unquiesce_queue/20170526-140138 
> HEAD 470e70e5203ed8f76bb7c1a86db58023098bfc21 builds fine.
>   It only hurts bisectibility.
> 
> All errors (new ones prefixed by >>):
> 
>drivers/scsi/scsi_lib.c: In function 'scsi_internal_device_unblock':
> >> drivers/scsi/scsi_lib.c:3033:7: error: implicit declaration of function 
> >> 'blk_queue_quiesced' [-Werror=implicit-function-declaration]
>   if (blk_queue_quiesced(q))
>   ^~
>Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
>Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
>Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:test_and_clear_bit
>Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
>Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:variable_test_bit
>Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
>Cyclomatic Complexity 1 include/uapi/linux/swab.h:__swab16p
>Cyclomatic Complexity 1 
> include/uapi/linux/byteorder/little_endian.h:__be16_to_cpup
>Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
>Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
>Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
>Cyclomatic Complexity 1 include/linux/list.h:__list_del_entry_valid
>Cyclomatic Complexity 2 include/linux/list.h:__list_add
>Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
>Cyclomatic Complexity 1 include/linux/list.h:__list_del
>Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
>Cyclomatic Complexity 1 include/linux/list.h:list_del
>Cyclomatic Complexity 1 include/linux/list.h:list_del_init
>Cyclomatic Complexity 1 include/linux/list.h:list_move_tail
>Cyclomatic Complexity 1 include/linux/list.h:list_empty
>Cyclomatic Complexity 1 include/linux/list.h:__list_splice
>Cyclomatic Complexity 2 include/linux/list.h:list_splice
>Cyclomatic Complexity 2 include/linux/list.h:list_splice_init
>Cyclomatic Complexity 1 arch/x86/include/asm/current.h:get_current
>Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
>Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_read
>Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_set
>Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_inc
>Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_dec
>Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_add_return
>Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_sub_return
>Cyclomatic Complexity 1 include/linux/jump_label.h:static_key_count
>Cyclomatic Complexity 2 include/linux/jump_label.h:static_key_false
>Cyclomatic Complexity 1 
> arch/x86/include/asm/paravirt.h:arch_local_save_flags
>Cyclomatic Complexity 1 
> arch/x86/include/asm/irqflags.h:arch_irqs_disabled_flags
>Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_add
>Cyclomatic Complexity 1 
> arch/x86/include/asm/preempt.h:__preempt_count_dec_and_test
>Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
>Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock_irq
>Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irq
>Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irqrestore
>Cyclomatic Complexity 1 
> include/linux/rcupdate.h:rcu_read_lock_sched_notrace
>Cyclomatic Complexity 1 include/linux/mm.h:lowmem_page_address
>Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disabled_inc
>Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disabled_dec
>Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disable
>Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_enable
>Cyclomatic Complexity 1 include/linux/highmem.h:kmap_atomic
>Cyclomatic Complexity 1 include/linux/blk_t

Re: [PATCH 2/6] blk-mq: use the introduced blk_mq_unquiesce_queue()

2017-05-26 Thread kbuild test robot
Hi Ming,

[auto build test ERROR on block/for-next]
[also build test ERROR on v4.12-rc2 next-20170525]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ming-Lei/blk-mq-introduce-blk_mq_unquiesce_queue/20170526-140138
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-next
config: x86_64-randconfig-x019-201721 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

Note: the 
linux-review/Ming-Lei/blk-mq-introduce-blk_mq_unquiesce_queue/20170526-140138 
HEAD 470e70e5203ed8f76bb7c1a86db58023098bfc21 builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/scsi/scsi_lib.c: In function 'scsi_internal_device_unblock':
>> drivers/scsi/scsi_lib.c:3033:7: error: implicit declaration of function 
>> 'blk_queue_quiesced' [-Werror=implicit-function-declaration]
  if (blk_queue_quiesced(q))
  ^~
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:test_and_clear_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:variable_test_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
   Cyclomatic Complexity 1 include/uapi/linux/swab.h:__swab16p
   Cyclomatic Complexity 1 
include/uapi/linux/byteorder/little_endian.h:__be16_to_cpup
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
   Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
   Cyclomatic Complexity 1 include/linux/list.h:__list_add_valid
   Cyclomatic Complexity 1 include/linux/list.h:__list_del_entry_valid
   Cyclomatic Complexity 2 include/linux/list.h:__list_add
   Cyclomatic Complexity 1 include/linux/list.h:list_add_tail
   Cyclomatic Complexity 1 include/linux/list.h:__list_del
   Cyclomatic Complexity 2 include/linux/list.h:__list_del_entry
   Cyclomatic Complexity 1 include/linux/list.h:list_del
   Cyclomatic Complexity 1 include/linux/list.h:list_del_init
   Cyclomatic Complexity 1 include/linux/list.h:list_move_tail
   Cyclomatic Complexity 1 include/linux/list.h:list_empty
   Cyclomatic Complexity 1 include/linux/list.h:__list_splice
   Cyclomatic Complexity 2 include/linux/list.h:list_splice
   Cyclomatic Complexity 2 include/linux/list.h:list_splice_init
   Cyclomatic Complexity 1 arch/x86/include/asm/current.h:get_current
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_read
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_set
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_inc
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_dec
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_add_return
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_sub_return
   Cyclomatic Complexity 1 include/linux/jump_label.h:static_key_count
   Cyclomatic Complexity 2 include/linux/jump_label.h:static_key_false
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:arch_local_save_flags
   Cyclomatic Complexity 1 
arch/x86/include/asm/irqflags.h:arch_irqs_disabled_flags
   Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_add
   Cyclomatic Complexity 1 
arch/x86/include/asm/preempt.h:__preempt_count_dec_and_test
   Cyclomatic Complexity 1 include/linux/spinlock.h:spinlock_check
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock_irq
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irq
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock_irqrestore
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_read_lock_sched_notrace
   Cyclomatic Complexity 1 include/linux/mm.h:lowmem_page_address
   Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disabled_inc
   Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disabled_dec
   Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_disable
   Cyclomatic Complexity 1 include/linux/uaccess.h:pagefault_enable
   Cyclomatic Complexity 1 include/linux/highmem.h:kmap_atomic
   Cyclomatic Complexity 1 include/linux/blk_types.h:op_is_write
   Cyclomatic Complexity 1 include/linux/slab.h:kmem_cache_alloc_node
   Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 3 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/blkdev.h:blk_rq_is_scsi
   Cyclomatic Complexity 1 include/linux/blkdev.h:blk_rq_is_private
   Cyclomatic Complexity 3 include/linux/blkdev.h:blk_rq_is_passthrough