Re: [SCSI] mpt2sas T10 DIF fixes

2012-08-20 Thread Pasi Kärkkäinen
On Mon, Aug 20, 2012 at 08:43:49PM -0400, Martin K. Petersen wrote:
> > "Pasi" == Pasi Kärkkäinen  writes:
> 
> Pasi> .. and I probably need to sg_format the backing devices to enable
> Pasi> PI
> 
> Yes. Unless the drive is already formatted with PI. The latter is
> becoming increasingly common as a PI-drive will work just fine in a
> "legacy" setup. Many current drives provide the same LBA count
> regardless of whether PI is enabled or not. So there isn't much point in
> not enabling it.
> 

Makes sense, thanks!

-- Pasi

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [SCSI] mpt2sas T10 DIF fixes

2012-08-20 Thread Pasi Kärkkäinen
On Mon, Aug 20, 2012 at 08:40:21PM -0400, Martin K. Petersen wrote:
> > "Pasi" == Pasi Kärkkäinen  writes:
> 
> Pasi> Btw do you know the current status of T10 PI support in md/dm
> Pasi> raid?  If I understood correctly there's some support for
> Pasi> raid0/raid1 implemented..
> 
> Yes. The only thing that doesn't work is RAID5/6.
> 

Ok, thanks for confirming that.

> 
> Pasi> Are there any docs how to enable/disable/configure T10 PI for
> Pasi> md/dm raid?  Perhaps the
> Pasi> /integrite/{write_enable|read_verify} work directly for the
> Pasi> md/dm device?
> 
> You don't have to configure anything. If all component devices are
> capable the md/dm device will register a suitable integrity profile.
> 

Oh, nice! I'll have to try it once I get some drives with PI.

-- Pasi

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] iscsi: Don't disable BH on BH context

2012-08-20 Thread Ying Xue
Since we have already in BH context when iscsi_sw_tcp_write_space()
is called, it's unnecessary to disable BH.

Signed-off-by: Ying Xue 
Acked-by: Michael Christie 
---
 drivers/scsi/iscsi_tcp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 9220861..d763857 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -194,7 +194,7 @@ static void iscsi_sw_tcp_write_space(struct sock *sk)
struct iscsi_sw_tcp_conn *tcp_sw_conn;
void (*old_write_space)(struct sock *);
 
-   read_lock_bh(&sk->sk_callback_lock);
+   read_lock(&sk->sk_callback_lock);
conn = sk->sk_user_data;
if (!conn) {
read_unlock_bh(&sk->sk_callback_lock);
@@ -204,7 +204,7 @@ static void iscsi_sw_tcp_write_space(struct sock *sk)
tcp_conn = conn->dd_data;
tcp_sw_conn = tcp_conn->dd_data;
old_write_space = tcp_sw_conn->old_write_space;
-   read_unlock_bh(&sk->sk_callback_lock);
+   read_unlock(&sk->sk_callback_lock);
 
old_write_space(sk);
 
-- 
1.7.11

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [SCSI] mpt2sas T10 DIF fixes

2012-08-20 Thread Martin K. Petersen
> "Pasi" == Pasi Kärkkäinen  writes:

Pasi> .. and I probably need to sg_format the backing devices to enable
Pasi> PI

Yes. Unless the drive is already formatted with PI. The latter is
becoming increasingly common as a PI-drive will work just fine in a
"legacy" setup. Many current drives provide the same LBA count
regardless of whether PI is enabled or not. So there isn't much point in
not enabling it.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [SCSI] mpt2sas T10 DIF fixes

2012-08-20 Thread Martin K. Petersen
> "Pasi" == Pasi Kärkkäinen  writes:

Pasi> Btw do you know the current status of T10 PI support in md/dm
Pasi> raid?  If I understood correctly there's some support for
Pasi> raid0/raid1 implemented..

Yes. The only thing that doesn't work is RAID5/6.


Pasi> Are there any docs how to enable/disable/configure T10 PI for
Pasi> md/dm raid?  Perhaps the
Pasi> /integrite/{write_enable|read_verify} work directly for the
Pasi> md/dm device?

You don't have to configure anything. If all component devices are
capable the md/dm device will register a suitable integrity profile.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] bfa: avoid buffer overrun for 12-byte model name

2012-08-20 Thread Jim Meyering
Krishna Gudipati wrote:
>> -Original Message-
>> From: Jim Meyering [mailto:j...@meyering.net]
>> Sent: Monday, August 20, 2012 9:55 AM
>> To: linux-ker...@vger.kernel.org
>> Cc: Jim Meyering; Jing Huang; Krishna Gudipati; James E.J. Bottomley; linux-
>> s...@vger.kernel.org
>> Subject: [PATCH] bfa: avoid buffer overrun for 12-byte model name
>>
>> From: Jim Meyering 
>>
>> we use strncpy to copy a model name of length up to 15 (16, if you count the
>> NUL), into a buffer of size 12 (BFA_FCS_PORT_SYMBNAME_MODEL_SZ).
>> However, strncpy does not always NUL-terminate, so whenever the original
>> model string has strlen >= 12, the following strncat reads beyond end of the 
>> -
>> >sym_name buffer as it attempts to find end of string.
>>
>> bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) {
>>  bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
>>  ...
>>  strncpy((char *)&port_cfg->sym_name, model,
>>  BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
>>  strncat((char *)&port_cfg->sym_name,
>> BFA_FCS_PORT_SYMBNAME_SEPARATOR,
>>  sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
>>  ...
>>
>> bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) {
>>  struct bfi_ioc_attr_s   *ioc_attr;
>>
>>  WARN_ON(!model);
>>  memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN);
>>
>> BFA_ADAPTER_MODEL_NAME_LEN = 16
>>
>> Signed-off-by: Jim Meyering 
>> ---
>>  drivers/scsi/bfa/bfa_fcs.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index
>> eaac57e..3329493 100644
>> --- a/drivers/scsi/bfa/bfa_fcs.c
>> +++ b/drivers/scsi/bfa/bfa_fcs.c
>> @@ -713,6 +713,7 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s
>> *fabric)
>>  /* Model name/number */
>>  strncpy((char *)&port_cfg->sym_name, model,
>>  BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
>> +port_cfg->sym_name[BFA_FCS_PORT_SYMBNAME_MODEL_SZ - 1]
>> = 0;
>>  strncat((char *)&port_cfg->sym_name,
>> BFA_FCS_PORT_SYMBNAME_SEPARATOR,
>>  sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
>
> Nacked-by: Krishna Gudipati 
>
> Hi Jim,
>
> This model number is of length 12 bytes and the logic added here will
> reset the model last byte.
> In addition strncat does not need the src to be null terminated, the
> change does not compile even.
> NACK to this change.

Hi Krishna,

Thanks for the quick feedback and sorry the patch wasn't quite right.
However, the log is accurate: there is at least a theoretical problem
when the string in "model" (a buffer of size 16 bytes) has strlen >= 12.
While strncat does not require that its second argument be NUL-terminated,
the first one (the destination) must be.  Otherwise, it has no way to
determine the end of the string to which it must append the source bytes.

Here is a v2 patch to which I've added the requisite (char*) cast.
However, this whole function is rather unreadable due to the
repetition (12 times!) of "(char *)&port_cfg->sym_name".
In case someone prefers to factor out that repetition,
I've appended a larger, v3 patch to do that.

>From 4d1ce4e5caf8a5041e5c4f3ae4deddb79c9e247c Mon Sep 17 00:00:00 2001
From: Jim Meyering 
Date: Sun, 29 Apr 2012 10:41:05 +0200
Subject: [PATCHv2] bfa: avoid buffer overrun for 12-byte model name

we use strncpy to copy a model name of length up to 15 (16, if you count
the NUL), into a buffer of size 12 (BFA_FCS_PORT_SYMBNAME_MODEL_SZ).
However, strncpy does not always NUL-terminate, so whenever the original
model string has strlen >= 12, the following strncat reads beyond end
of the ->sym_name buffer as it attempts to find end of string.

bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
{
bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
...
strncpy((char *)&port_cfg->sym_name, model,
BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
...

bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model)
{
struct bfi_ioc_attr_s   *ioc_attr;

WARN_ON(!model);
memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN);

BFA_ADAPTER_MODEL_NAME_LEN = 16

Signed-off-by: Jim Meyering 
---
 drivers/scsi/bfa/bfa_fcs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index eaac57e..242c37f 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -713,6 +713,7 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
/* Model name/number */
strncpy((char *)&port_cfg->sym_name, model,
BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
+   ((char *)&port_cfg->sym_name)[BFA_FCS_PORT_SYMBNAME_MODEL_SZ - 1] = 0;
strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));

--
1.7.12


>From d7f49

Re: [patch 0/5] st: Clean up and raise max device limit (v4)

2012-08-20 Thread Kai Makisara
On Sat, 18 Aug 2012, Jeff Mahoney wrote:

> This patchset cleans up the SCSI tape device handling code and leverages it
> to lift the limitation of the number of tape drives from the previous
> arbitrary limit of 128 to the maximum supported by a device node that
> creates 8 character devices per physical device. Since minors are 20 bits,
> that means 2^17 tape drives can be supported.
> 
> Changed in this version: A previous revision introduced a regression where
> tape drives would not be shown as tape devices in lsscsi. This was due to
> the missing "tape" symlink in sysfs. That issue has been addressed and
> lsscsi works properly again. Also, it passes checkpatch with no errors.
> 
> Please apply.
> 
The whole series (1-5):

Acked-by: Kai Mäkisara 

Thanks,
Kai

RE: [PATCH] bfa: avoid buffer overrun for 12-byte model name

2012-08-20 Thread Krishna Gudipati
> -Original Message-
> From: Jim Meyering [mailto:j...@meyering.net]
> Sent: Monday, August 20, 2012 9:55 AM
> To: linux-ker...@vger.kernel.org
> Cc: Jim Meyering; Jing Huang; Krishna Gudipati; James E.J. Bottomley; linux-
> s...@vger.kernel.org
> Subject: [PATCH] bfa: avoid buffer overrun for 12-byte model name
> 
> From: Jim Meyering 
> 
> we use strncpy to copy a model name of length up to 15 (16, if you count the
> NUL), into a buffer of size 12 (BFA_FCS_PORT_SYMBNAME_MODEL_SZ).
> However, strncpy does not always NUL-terminate, so whenever the original
> model string has strlen >= 12, the following strncat reads beyond end of the -
> >sym_name buffer as it attempts to find end of string.
> 
> bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) {
>   bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
>   ...
>   strncpy((char *)&port_cfg->sym_name, model,
>   BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
>   strncat((char *)&port_cfg->sym_name,
> BFA_FCS_PORT_SYMBNAME_SEPARATOR,
>   sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
>   ...
> 
> bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) {
>   struct bfi_ioc_attr_s   *ioc_attr;
> 
>   WARN_ON(!model);
>   memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN);
> 
> BFA_ADAPTER_MODEL_NAME_LEN = 16
> 
> Signed-off-by: Jim Meyering 
> ---
>  drivers/scsi/bfa/bfa_fcs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index
> eaac57e..3329493 100644
> --- a/drivers/scsi/bfa/bfa_fcs.c
> +++ b/drivers/scsi/bfa/bfa_fcs.c
> @@ -713,6 +713,7 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s
> *fabric)
>   /* Model name/number */
>   strncpy((char *)&port_cfg->sym_name, model,
>   BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
> + port_cfg->sym_name[BFA_FCS_PORT_SYMBNAME_MODEL_SZ - 1]
> = 0;
>   strncat((char *)&port_cfg->sym_name,
> BFA_FCS_PORT_SYMBNAME_SEPARATOR,
>   sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));

Nacked-by: Krishna Gudipati 

Hi Jim,

This model number is of length 12 bytes and the logic added here will reset the 
model last byte.
In addition strncat does not need the src to be null terminated, the change 
does not compile even.
NACK to this change.

Thanks,
Krishna
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: request size limit in scsi tape driver

2012-08-20 Thread Kai Makisara
On Mon, 20 Aug 2012, Olaf Hering wrote:

> 
> Currently the st driver does not to break up write requests into smaller
> chunks to satisfy the ->max_hw_sectors limit of the underlying host driver.
> 
>  # modprobe -v scsi_debug ptype=1 opts=1 dev_size_mb=123
>  # dd if=/dev/zero of=/dev/st0 bs=$((1024*54321))
> 
> This leads to -EBUSY from this call chain:
> st_write -> st_do_scsi -> st_scsi_execute -> blk_rq_map_user
> 
> What is the reason for this behaviour?
> Should st_write write in smaller chunks, or would that break real
> hardware because they expect certain block sizes?
> 
In variable block mode the write() byte count determines the size of the 
tape block. Exactly one SCSI command is used to write one block. This is 
why the writes can't be split in variable block mode. In fixed block mode 
the writes are split but this results in several tape blocks for each 
write().

Kai
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/7] drivers/s390/scsi/zfcp_cfdc.c: remove invalid reference to list iterator variable

2012-08-20 Thread Steffen Maier
Hi Julia,

sorry for the long delay until I finally responded.
Thanks a lot for your report and patch.
I'll queue this and send it for v3.6rcX hopefully soon.

On 07/08/2012 01:37 PM, Julia Lawall wrote:
> From: Julia Lawall 
>
> If list_for_each_entry, etc complete a traversal of the list, the iterator
> variable ends up pointing to an address at an offset from the list head,
> and not a meaningful structure.  Thus this value should not be used after
> the end of the iterator.  Replace port->adapter->scsi_host by
> adapter->scsi_host.
>
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
>
> Signed-off-by: Julia Lawall 
>
> ---
> This is not tested, an I am not sure that this is the right change.
> Indeed, I'm not at all sure how the original code could have worked, since
> port->adapter->scsi_host should be a completely random value.

This is most probably a copy & paste oversight in
commit a1ca48319a9aa1c5b57ce142f538e76050bb8972
"[SCSI] zfcp: Move ACL/CFDC code to zfcp_cfdc.c"
v2.6.37
where the content of

static void zfcp_erp_port_access_changed(struct zfcp_port *port, char *id,
void *ref)
{
   struct scsi_device *sdev;
   int status = atomic_read(&port->status);

   if (!(status & (ZFCP_STATUS_COMMON_ACCESS_DENIED |
   ZFCP_STATUS_COMMON_ACCESS_BOXED))) {
   shost_for_each_device(sdev, port->adapter->scsi_host)
   

was merged into
zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *adapter)

Since this code is for older hardware and users not using NPIV
and this is only executed on dynamic access changes,
nobody has noticed this so far I guess.

>   drivers/s390/scsi/zfcp_cfdc.c |2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
> index fab2c25..8ed63aa 100644
> --- a/drivers/s390/scsi/zfcp_cfdc.c
> +++ b/drivers/s390/scsi/zfcp_cfdc.c
> @@ -293,7 +293,7 @@ void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter 
> *adapter)
>   }
>   read_unlock_irqrestore(&adapter->port_list_lock, flags);
>
> - shost_for_each_device(sdev, port->adapter->scsi_host) {
> + shost_for_each_device(sdev, adapter->scsi_host) {
>   zfcp_sdev = sdev_to_zfcp(sdev);
>   status = atomic_read(&zfcp_sdev->status);
>   if ((status & ZFCP_STATUS_COMMON_ACCESS_DENIED) ||
>

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 7/7] be2iscsi: Bump the driver version.

2012-08-20 Thread John Soni Jose
Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 084386c..b891226 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -36,7 +36,7 @@
 
 #include "be.h"
 #define DRV_NAME   "be2iscsi"
-#define BUILD_STR  "4.2.162.0"
+#define BUILD_STR  "4.4.58.0"
 #define BE_NAME"Emulex OneConnect" \
"Open-iSCSI Driver version" BUILD_STR
 #define DRV_DESC   BE_NAME " " "Driver"
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 6/7] be2iscsi: Fix a kernel panic because of TCP RST/FIN received.

2012-08-20 Thread John Soni Jose
 A TCP RST/FIN can be received even before the connection specific
 structures are initialized.This fix checks for the conn structure
 is intialized or not  when RST/FIN is received.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_iscsi.c |   30 +++-
 drivers/scsi/be2iscsi/be_main.c  |   45 +++--
 drivers/scsi/be2iscsi/be_mgmt.h  |1 +
 3 files changed, 33 insertions(+), 43 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index ebb6c1f..aedb0d9 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1254,6 +1254,7 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
struct beiscsi_endpoint *beiscsi_ep;
struct beiscsi_hba *phba;
unsigned int tag;
+   uint8_t mgmt_invalidate_flag, tcp_upload_flag;
unsigned short savecfg_flag = CMD_ISCSI_SESSION_SAVE_CFG_ON_FLASH;
 
beiscsi_ep = ep->dd_data;
@@ -1262,26 +1263,23 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
"BS_%d : In beiscsi_ep_disconnect for ep_cid = %d\n",
beiscsi_ep->ep_cid);
 
-   if (!beiscsi_ep->conn) {
-   beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
-   "BS_%d : In beiscsi_ep_disconnect, no "
-   "beiscsi_ep\n");
-   return;
+   if (beiscsi_ep->conn) {
+   beiscsi_conn = beiscsi_ep->conn;
+   iscsi_suspend_queue(beiscsi_conn->conn);
+   mgmt_invalidate_flag = ~BEISCSI_NO_RST_ISSUE;
+   tcp_upload_flag = CONNECTION_UPLOAD_GRACEFUL;
+   } else {
+   mgmt_invalidate_flag = BEISCSI_NO_RST_ISSUE;
+   tcp_upload_flag = CONNECTION_UPLOAD_ABORT;
}
-   beiscsi_conn = beiscsi_ep->conn;
-   iscsi_suspend_queue(beiscsi_conn->conn);
-
-   beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
-   "BS_%d : In beiscsi_ep_disconnect ep_cid = %d\n",
-   beiscsi_ep->ep_cid);
 
tag = mgmt_invalidate_connection(phba, beiscsi_ep,
-   beiscsi_ep->ep_cid, 1,
-   savecfg_flag);
+ beiscsi_ep->ep_cid,
+ mgmt_invalidate_flag,
+ savecfg_flag);
if (!tag) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
-   "BS_%d : mgmt_invalidate_connection"
-   " Failed for cid=%d\n",
+   "BS_%d : mgmt_invalidate_connection Failed for 
cid=%d\n",
beiscsi_ep->ep_cid);
} else {
wait_event_interruptible(phba->ctrl.mcc_wait[tag],
@@ -1289,7 +1287,7 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep)
free_mcc_tag(&phba->ctrl, tag);
}
 
-   beiscsi_close_conn(beiscsi_ep, CONNECTION_UPLOAD_GRACEFUL);
+   beiscsi_close_conn(beiscsi_ep, tcp_upload_flag);
beiscsi_free_ep(beiscsi_ep);
beiscsi_unbind_conn_to_cid(phba, beiscsi_ep->ep_cid);
iscsi_destroy_endpoint(beiscsi_ep->openiscsi_ep);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 5637058..ff73f95 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -42,6 +42,7 @@
 #include "be_main.h"
 #include "be_iscsi.h"
 #include "be_mgmt.h"
+#include "be_cmds.h"
 
 static unsigned int be_iopoll_budget = 10;
 static unsigned int be_max_phys_size = 64;
@@ -1920,6 +1921,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj 
*pbe_eq)
struct dmsg_cqe *dmsg;
unsigned int num_processed = 0;
unsigned int tot_nump = 0;
+   unsigned short code = 0, cid = 0;
struct beiscsi_conn *beiscsi_conn;
struct beiscsi_endpoint *beiscsi_ep;
struct iscsi_endpoint *ep;
@@ -1933,10 +1935,11 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj 
*pbe_eq)
   CQE_VALID_MASK) {
be_dws_le_to_cpu(sol, sizeof(struct sol_cqe));
 
-   ep = phba->ep_array[(u32) ((sol->
-  dw[offsetof(struct amap_sol_cqe, cid) / 32] &
-  SOL_CID_MASK) >> 6) -
-  phba->fw_config.iscsi_cid_start];
+   cid = ((sol->dw[offsetof(struct amap_sol_cqe, cid)/32] &
+ CQE_CID_MASK) >> 6);
+   code = (sol->dw[offsetof(struct amap_sol_cqe, code)/32] &
+  CQE_CODE_MASK);
+   ep = phba->ep_array[cid - phba->fw_config.iscsi_cid_start];
 
beiscsi_ep = ep->dd_data;
beiscsi_conn = beiscsi_ep->conn;
@@ -1948,8 +1951,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_o

[PATCH v2 5/7] be2iscsi: Add support for configuring the VLAN on the adapter.

2012-08-20 Thread John Soni Jose
 Add support for configuring the VLAN parameters on the adapter
 using the iscsiadm interface.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c  |   42 +
 drivers/scsi/be2iscsi/be_cmds.h  |9 
 drivers/scsi/be2iscsi/be_iscsi.c |   76 ++
 drivers/scsi/be2iscsi/be_mgmt.c  |   46 +++
 drivers/scsi/be2iscsi/be_mgmt.h  |4 ++
 5 files changed, 177 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index d0058e3..07d2cb1 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -934,3 +934,45 @@ int beiscsi_cmd_reset_function(struct beiscsi_hba  *phba)
spin_unlock(&ctrl->mbox_lock);
return status;
 }
+
+/**
+ * be_cmd_set_vlan()- Configure VLAN paramters on the adapter
+ * @phba: device priv structure instance
+ * @vlan_tag: TAG to be set
+ *
+ * Set the VLAN_TAG for the adapter or Disable VLAN on adapter
+ *
+ * returns
+ * TAG for the MBX Cmd
+ * **/
+int be_cmd_set_vlan(struct beiscsi_hba *phba,
+uint16_t vlan_tag)
+{
+   unsigned int tag = 0;
+   struct be_mcc_wrb *wrb;
+   struct be_cmd_set_vlan_req *req;
+   struct be_ctrl_info *ctrl = &phba->ctrl;
+
+   spin_lock(&ctrl->mbox_lock);
+   tag = alloc_mcc_tag(phba);
+   if (!tag) {
+   spin_unlock(&ctrl->mbox_lock);
+   return tag;
+   }
+
+   wrb = wrb_from_mccq(phba);
+   req = embedded_payload(wrb);
+   wrb->tag0 |= tag;
+   be_wrb_hdr_prepare(wrb, sizeof(*wrb), true, 0);
+   be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
+  OPCODE_COMMON_ISCSI_NTWK_SET_VLAN,
+  sizeof(*req));
+
+   req->interface_hndl = phba->interface_handle;
+   req->vlan_priority = vlan_tag;
+
+   be_mcc_notify(phba);
+   spin_unlock(&ctrl->mbox_lock);
+
+   return tag;
+}
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 953c354..2c8f98d 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -449,6 +449,12 @@ struct be_cmd_get_def_gateway_resp {
struct ip_addr_format ip_addr;
 } __packed;
 
+#define BEISCSI_VLAN_DISABLE   0x
+struct be_cmd_set_vlan_req {
+   struct be_cmd_req_hdr hdr;
+   u32 interface_hndl;
+   u32 vlan_priority;
+} __packed;
 / Create CQ ***/
 /**
  * Pseudo amap definition in which each bit of the actual structure is defined
@@ -688,6 +694,9 @@ int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct 
be_dma_mem *q_mem,
 
 bool is_link_state_evt(u32 trailer);
 
+/* Configuration Functions */
+int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
+
 struct be_default_pdu_context {
u32 dw[4];
 } __packed;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 8efdd8e..ebb6c1f 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -332,6 +332,51 @@ beiscsi_set_static_ip(struct Scsi_Host *shost,
return ret;
 }
 
+/**
+ * beiscsi_set_vlan_tag()- Set the VLAN TAG
+ * @shost: Scsi Host for the driver instance
+ * @iface_param: Interface paramters
+ *
+ * Set the VLAN TAG for the adapter or disable
+ * the VLAN config
+ *
+ * returns
+ * Success: 0
+ * Failure: Non-Zero Value
+ **/
+static int
+beiscsi_set_vlan_tag(struct Scsi_Host *shost,
+ struct iscsi_iface_param_info *iface_param)
+{
+   struct beiscsi_hba *phba = iscsi_host_priv(shost);
+   int ret = 0;
+
+   /* Get the Interface Handle */
+   if (mgmt_get_all_if_id(phba)) {
+   beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
+   "BS_%d : Getting Interface Handle Failed\n");
+   return -EIO;
+   }
+
+   switch (iface_param->param) {
+   case ISCSI_NET_PARAM_VLAN_ENABLED:
+   if (iface_param->value[0] != ISCSI_VLAN_ENABLE)
+   ret = mgmt_set_vlan(phba, BEISCSI_VLAN_DISABLE);
+   break;
+   case ISCSI_NET_PARAM_VLAN_TAG:
+   ret = mgmt_set_vlan(phba,
+   *((uint16_t *)iface_param->value));
+   break;
+   default:
+   beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
+   "BS_%d : Unkown Param Type : %d\n",
+   iface_param->param);
+   return -ENOSYS;
+   }
+   return ret;
+}
+
+
 static int
 beiscsi_set_ipv4(struct Scsi_Host *shost,
struct iscsi_iface_param_info *iface_param,
@@ -368,6 +413,10 @@ beiscsi_set_ipv4(struct Scsi_Host *shost,
ret = beiscsi_set_static_ip(shost, iface_param,
data, dt_len);
break;
+   

[PATCH v2 4/7] be2iscsi: Format the MAC_ADDR with sysfs_format_mac.

2012-08-20 Thread John Soni Jose
 The MAC_ADDR stored in driver private structure is of
 unsigned char data type but strlcpy parameters is of
 signed char data type. This conversion of data types
 lead to change in the value.This changed value is passed
 to the upper layer and junk characters were displayed
 when "iscsiadm -m iface" command was run.

 In case of iSCSI boot, since the the MAC_ADDR was coming
 junk the boot was also not working

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_iscsi.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 41b1fb7..8efdd8e 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -792,7 +792,7 @@ int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba)
int rc;
 
if (strlen(phba->mac_address))
-   return strlcpy(buf, phba->mac_address, PAGE_SIZE);
+   return sysfs_format_mac(buf, phba->mac_address, ETH_ALEN);
 
memset(&resp, 0, sizeof(resp));
rc = mgmt_get_nic_conf(phba, &resp);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/7] be2iscsi: Issue MBX Cmd for login to boot target in crashdump mode

2012-08-20 Thread John Soni Jose
 When the driver comes up in crashdump mode, it has to explicitly
 issue command to FW for logging to the boot target. This fix issues
 MBX Cmd to login to boot target in crashdump mode.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.h |   18 +
 drivers/scsi/be2iscsi/be_main.c |   45 +
 drivers/scsi/be2iscsi/be_main.h |1 +
 drivers/scsi/be2iscsi/be_mgmt.c |  133 +++
 drivers/scsi/be2iscsi/be_mgmt.h |6 ++
 5 files changed, 175 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index b0b36c6..953c354 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -348,6 +348,23 @@ struct be_cmd_get_boot_target_resp {
int  boot_session_handle;
 };
 
+struct be_cmd_reopen_session_req {
+   struct be_cmd_req_hdr hdr;
+#define BE_REOPEN_ALL_SESSIONS  0x00
+#define BE_REOPEN_BOOT_SESSIONS 0x01
+#define BE_REOPEN_A_SESSION 0x02
+   u16 reopen_type;
+   u16 rsvd;
+   u32 session_handle;
+} __packed;
+
+struct be_cmd_reopen_session_resp {
+   struct be_cmd_resp_hdr hdr;
+   u32 rsvd;
+   u32 session_handle;
+} __packed;
+
+
 struct be_cmd_mac_query_req {
struct be_cmd_req_hdr hdr;
u8 type;
@@ -911,6 +928,7 @@ struct be_cmd_get_all_if_id_req {
 #define OPCODE_ISCSI_INI_CFG_GET_HBA_NAME  6
 #define OPCODE_ISCSI_INI_CFG_SET_HBA_NAME  7
 #define OPCODE_ISCSI_INI_SESSION_GET_A_SESSION  14
+#define OPCODE_ISCSI_INI_DRIVER_REOPEN_ALL_SESSIONS 36
 #define OPCODE_ISCSI_INI_DRIVER_OFFLOAD_SESSION 41
 #define OPCODE_ISCSI_INI_DRIVER_INVALIDATE_CONNECTION 42
 #define OPCODE_ISCSI_INI_BOOT_GET_BOOT_TARGET  52
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 2cdae08..4b283a2 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3466,44 +3466,33 @@ static void hwi_disable_intr(struct beiscsi_hba *phba)
 "In hwi_disable_intr, Already Disabled\n");
 }
 
+/**
+ * beiscsi_get_boot_info()- Get the boot session info
+ * @phba: The device priv structure instance
+ *
+ * Get the boot target info and store in driver priv structure
+ *
+ * return values
+ * Success: 0
+ * Failure: Non-Zero Value
+ **/
 static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
 {
-   struct be_cmd_get_boot_target_resp *boot_resp;
struct be_cmd_get_session_resp *session_resp;
struct be_mcc_wrb *wrb;
struct be_dma_mem nonemb_cmd;
unsigned int tag, wrb_num;
unsigned short status, extd_status;
+   unsigned int s_handle;
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
int ret = -ENOMEM;
 
-   tag = mgmt_get_boot_target(phba);
-   if (!tag) {
-   SE_DEBUG(DBG_LVL_1, "beiscsi_get_boot_info Failed\n");
-   return -EAGAIN;
-   } else
-   wait_event_interruptible(phba->ctrl.mcc_wait[tag],
-phba->ctrl.mcc_numtag[tag]);
-
-   wrb_num = (phba->ctrl.mcc_numtag[tag] & 0x00FF) >> 16;
-   extd_status = (phba->ctrl.mcc_numtag[tag] & 0xFF00) >> 8;
-   status = phba->ctrl.mcc_numtag[tag] & 0x00FF;
-   if (status || extd_status) {
-   SE_DEBUG(DBG_LVL_1, "beiscsi_get_boot_info Failed"
-   " status = %d extd_status = %d\n",
-   status, extd_status);
-   free_mcc_tag(&phba->ctrl, tag);
-   return -EBUSY;
-   }
-   wrb = queue_get_wrb(mccq, wrb_num);
-   free_mcc_tag(&phba->ctrl, tag);
-   boot_resp = embedded_payload(wrb);
-
-   if (boot_resp->boot_session_handle < 0) {
-   shost_printk(KERN_INFO, phba->shost, "No Boot Session.\n");
-   return -ENXIO;
+   /* Get the session handle of the boot target */
+   ret = be_mgmt_get_boot_shandle(phba, &s_handle);
+   if (ret) {
+   SE_DEBUG(DBG_LVL_1, "No boot session\n");
+   return ret;
}
-
nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
sizeof(*session_resp),
&nonemb_cmd.dma);
@@ -3515,7 +3504,7 @@ static int beiscsi_get_boot_info(struct beiscsi_hba *phba)
}
 
memset(nonemb_cmd.va, 0, sizeof(*session_resp));
-   tag = mgmt_get_session_info(phba, boot_resp->boot_session_handle,
+   tag = mgmt_get_session_info(phba, s_handle,
&nonemb_cmd);
if (!tag) {
SE_DEBUG(DBG_LVL_1, "beiscsi_get_session_info"
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 40fea6e..8b2ce61 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -84,6 +84,7 @@
 #define MAX_CMD_SZ 65536
 #define IIO

[PATCH v2 1/7] be2iscsi: Removing the iscsi_data_pdu setting.

2012-08-20 Thread John Soni Jose
 The setting of iscsi_data_pdu is not required anymore,
 as this was required for BE1 adapters only. The BE1 adapter
 were not supported in any previous versions of the kernel.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.c |   12 
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 0b1d99c..2cdae08 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3981,15 +3981,6 @@ static int beiscsi_iotask(struct iscsi_task *task, 
struct scatterlist *sg,
io_task->bhs_len = sizeof(struct be_cmd_bhs);
 
if (writedir) {
-   memset(&io_task->cmd_bhs->iscsi_data_pdu, 0, 48);
-   AMAP_SET_BITS(struct amap_pdu_data_out, itt,
- &io_task->cmd_bhs->iscsi_data_pdu,
- (unsigned int)io_task->cmd_bhs->iscsi_hdr.itt);
-   AMAP_SET_BITS(struct amap_pdu_data_out, opcode,
- &io_task->cmd_bhs->iscsi_data_pdu,
- ISCSI_OPCODE_SCSI_DATA_OUT);
-   AMAP_SET_BITS(struct amap_pdu_data_out, final_bit,
- &io_task->cmd_bhs->iscsi_data_pdu, 1);
AMAP_SET_BITS(struct amap_iscsi_wrb, type, pwrb,
  INI_WR_CMD);
AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 1);
@@ -3998,9 +3989,6 @@ static int beiscsi_iotask(struct iscsi_task *task, struct 
scatterlist *sg,
  INI_RD_CMD);
AMAP_SET_BITS(struct amap_iscsi_wrb, dsp, pwrb, 0);
}
-   memcpy(&io_task->cmd_bhs->iscsi_data_pdu.
-  dw[offsetof(struct amap_pdu_data_out, lun) / 32],
-  &io_task->cmd_bhs->iscsi_hdr.lun, sizeof(struct scsi_lun));
 
AMAP_SET_BITS(struct amap_iscsi_wrb, lun, pwrb,
  cpu_to_be16(*(unsigned short *)
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/7] be2iscsi: Updates for be2iscsi driver

2012-08-20 Thread John Soni Jose
 Fixes done based on the review comments on previous submission.
 These patches were generated against the scsi tree "scsi-misc" 
 branch.

  be2iscsi: Removing the iscsi_data_pdu setting.
  be2iscsi: Issue MBX Cmd for login to boot target in crashdump mode
  be2iscsi: Added Logging mechanism for the driver.
  be2iscsi: Format the MAC_ADDR with sysfs_format_mac.
  be2iscsi: Add support for configuring the VLAN on the adapter.
  be2iscsi: Fix a kernel panic because of TCP RST/FIN received.
  be2iscsi: Bump the driver version.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] bfa: avoid buffer overrun for 12-byte model name

2012-08-20 Thread Jim Meyering
From: Jim Meyering 

we use strncpy to copy a model name of length up to 15 (16, if you count
the NUL), into a buffer of size 12 (BFA_FCS_PORT_SYMBNAME_MODEL_SZ).
However, strncpy does not always NUL-terminate, so whenever the original
model string has strlen >= 12, the following strncat reads beyond end
of the ->sym_name buffer as it attempts to find end of string.

bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
{
bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
...
strncpy((char *)&port_cfg->sym_name, model,
BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
...

bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model)
{
struct bfi_ioc_attr_s   *ioc_attr;

WARN_ON(!model);
memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN);

BFA_ADAPTER_MODEL_NAME_LEN = 16

Signed-off-by: Jim Meyering 
---
 drivers/scsi/bfa/bfa_fcs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index eaac57e..3329493 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -713,6 +713,7 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
/* Model name/number */
strncpy((char *)&port_cfg->sym_name, model,
BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
+   port_cfg->sym_name[BFA_FCS_PORT_SYMBNAME_MODEL_SZ - 1] = 0;
strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));

-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


request size limit in scsi tape driver

2012-08-20 Thread Olaf Hering

Currently the st driver does not to break up write requests into smaller
chunks to satisfy the ->max_hw_sectors limit of the underlying host driver.

 # modprobe -v scsi_debug ptype=1 opts=1 dev_size_mb=123
 # dd if=/dev/zero of=/dev/st0 bs=$((1024*54321))

This leads to -EBUSY from this call chain:
st_write -> st_do_scsi -> st_scsi_execute -> blk_rq_map_user

What is the reason for this behaviour?
Should st_write write in smaller chunks, or would that break real
hardware because they expect certain block sizes?

The specific issue at hand I have is that the (out-of-tree) Xen pvscsi
has a ->max_hw_sectors limit of 200, which limits the block size in a
guest to 100K.


Olaf
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 31192] ioctl SG_GET_REQUEST_TABLE returns 64-bit structure to 32-bit app.

2012-08-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=31192


Alan  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||a...@lxorguk.ukuu.org.uk
 Resolution||INVALID




-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 1/2]block: handle merged discard request

2012-08-20 Thread Christoph Hellwig
On Mon, Aug 20, 2012 at 10:12:29AM -0400, Mike Snitzer wrote:
> Thought we pushed that down?  Hence sd_setup_discard_cmnd's
> alloc_page + blk_add_request_payload hack.

Yeah, but we still need the bio_vec from early on, as it's allocated as
part of the bio.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 1/2]block: handle merged discard request

2012-08-20 Thread Mike Snitzer
On Mon, Aug 20 2012 at  9:58am -0400,
Christoph Hellwig  wrote:

> On Mon, Aug 20, 2012 at 09:57:39AM -0400, Mike Snitzer wrote:
> > But I haven't put my finger on _why_ a discard bio has bio->bi_io_vec
> > (but given my use of DM, bio comes from bio_alloc_bioset, and DM passes
> > original bio->bi_max_vecs for nr_iovecs).
> 
> TRIM has a payload and we cheay by preallocation a data page for it.

Thought we pushed that down?  Hence sd_setup_discard_cmnd's
alloc_page + blk_add_request_payload hack.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [SCSI] virtio-scsi: Initialize scatterlist structure.

2012-08-20 Thread Paolo Bonzini
Il 20/08/2012 16:04, Richard W.M. Jones ha scritto:
> From: "Richard W.M. Jones" 
> 
> The sg struct is used without being initialized.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=847548
> 
> Signed-off-by: Richard W.M. Jones 
> ---
>  drivers/scsi/virtio_scsi.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
> index c7030fb..8a66f83 100644
> --- a/drivers/scsi/virtio_scsi.c
> +++ b/drivers/scsi/virtio_scsi.c
> @@ -219,7 +219,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi,
>   struct scatterlist sg;
>   unsigned long flags;
>  
> - sg_set_buf(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
> + sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
>  
>   spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags);
>  
> 

Acked-by: Paolo Bonzini 

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [SCSI] virtio-scsi: Initialize scatterlist structure.

2012-08-20 Thread Richard W.M. Jones
From: "Richard W.M. Jones" 

The sg struct is used without being initialized.

https://bugzilla.redhat.com/show_bug.cgi?id=847548

Signed-off-by: Richard W.M. Jones 
---
 drivers/scsi/virtio_scsi.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index c7030fb..8a66f83 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -219,7 +219,7 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi,
struct scatterlist sg;
unsigned long flags;
 
-   sg_set_buf(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
+   sg_init_one(&sg, &event_node->event, sizeof(struct virtio_scsi_event));
 
spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags);
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 1/2]block: handle merged discard request

2012-08-20 Thread Christoph Hellwig
On Mon, Aug 20, 2012 at 09:57:39AM -0400, Mike Snitzer wrote:
> But I haven't put my finger on _why_ a discard bio has bio->bi_io_vec
> (but given my use of DM, bio comes from bio_alloc_bioset, and DM passes
> original bio->bi_max_vecs for nr_iovecs).

TRIM has a payload and we cheay by preallocation a data page for it.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 1/2]block: handle merged discard request

2012-08-20 Thread Mike Snitzer
On Fri, Aug 17 2012 at 11:47pm -0400,
Martin K. Petersen  wrote:

> > "Mike" == Mike Snitzer  writes:
> 
> Mike> Could be I've wasted a few hours by rebasing these patches...
> Mike> regardless, it would be great if you could share what your plans
> Mike> are.
> 
> Heh, I worked on syncing my patch queue up to Jens' and James' trees
> this afternoon. But I didn't quite finish the block stuff, mainly due to
> some conflicts with a few topology changes I also have pending.
> 
> I'll take a look at your series. Maybe I'll swap things around and put
> the topology changes on top instead of below. Leverage some of the work
> you did...

OK, just FYI, I had to change bio_has_data() to test bio->bi_vcnt
(rather than bio->bi_io_vec != NULL) because a discard bio has a
non-NULL bio->bi_io_vec (likely points to the bio->bi_inline_vecs but I
didn't check yet).

But I haven't put my finger on _why_ a discard bio has bio->bi_io_vec
(but given my use of DM, bio comes from bio_alloc_bioset, and DM passes
original bio->bi_max_vecs for nr_iovecs).

Anyway, this bio_has_data() change seemed reasonable considering
bio_data() checks bio->bi_vcnt.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Using SCSI timeouts in place of ERC

2012-08-20 Thread joystick

Hello lists
I am wondering what kind of support I can get from linux for 
"inexpensive" (SATA over SAS HBA in my case) disks on RAID ...
Inexpensive non-raid-edition disks haven't got settable ERC timeout 
(scterc) and can take very long time to respond in case of unreadable sector

However I see an /dev/sdX/device/timeout tunable
Supposing that I accept one disk being dropped from the array at the 
first unreadable sector, can I set that tunable low such as 10sec and 
live happy?


Unfortunately I have read that the expiration of the SCSI timeout can 
trigger a "Host" reset in case the drive does not respond to a reset message

https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Online_Storage_Reconfiguration_Guide/task_controlling-scsi-command-timer-onlining-devices.html
would that drop all my drives from the array? That would be a major problem.

Firstly, in "reset the bus": isn't the bus just an electrical wire? How 
can it be "reset" and what does that do? I can understand in the case of 
iSCSI the bus is maybe the TCP socket, I can somehow understand that it 
can be reset, but what about physically attached disks?

I suppose "device" is the disk.. ok for that one, suppose it's doomed
I suppose "host" is the HBA card... so what does a reset of the HBA do? 
Does it drop all the drives and rescan? MD wouldn't react well *at all* 
to this


Thank you
J
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [SCSI] mpt2sas T10 DIF fixes

2012-08-20 Thread Pasi Kärkkäinen
On Mon, Aug 20, 2012 at 01:48:19PM +0300, Pasi Kärkkäinen wrote:
> On Sun, Aug 19, 2012 at 12:38:43PM -0400, Martin K. Petersen wrote:
> > > "Pasi" == Pasi Kärkkäinen  writes:
> > 
> > Pasi> So physically the disk is using 520 bytes/sector (and needs to
> > Pasi> support that), but logically the HBA presents 512 bytes/sector +
> > Pasi> PI.. is that correct?
> > 
> > Yep. The beauty of PI is that we can store the extra stuff without
> > having to deal with weird block sizes.
> > 
> > 
> > Pasi> I guess what I'm asking is: Can I use sg_format to enable
> > Pasi> checksums/protection on any disk that physically supports 520
> > Pasi> bytes/sector, or does the disk need to have special T10 data
> > Pasi> protection support aswell?
> > 
> > The disk needs to support T10 PI (PROTECT=1 in the Standard Inquiry VPD
> > page). We don't support driving the HBA in PI mode with a non-PI target.
> > 
> 
> Btw do you know the current status of T10 PI support in md/dm raid? 
> If I understood correctly there's some support for raid0/raid1 implemented..
> 
> Are there any docs how to enable/disable/configure T10 PI for md/dm raid?
> Perhaps the /integrite/{write_enable|read_verify} work directly for the 
> md/dm device? 
> 

.. and I probably need to sg_format the backing devices to enable PI before 
enabling PI for the md/dm device? 

-- Pasi

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [SCSI] mpt2sas T10 DIF fixes

2012-08-20 Thread Pasi Kärkkäinen
On Sun, Aug 19, 2012 at 12:38:43PM -0400, Martin K. Petersen wrote:
> > "Pasi" == Pasi Kärkkäinen  writes:
> 
> Pasi> So physically the disk is using 520 bytes/sector (and needs to
> Pasi> support that), but logically the HBA presents 512 bytes/sector +
> Pasi> PI.. is that correct?
> 
> Yep. The beauty of PI is that we can store the extra stuff without
> having to deal with weird block sizes.
> 
> 
> Pasi> I guess what I'm asking is: Can I use sg_format to enable
> Pasi> checksums/protection on any disk that physically supports 520
> Pasi> bytes/sector, or does the disk need to have special T10 data
> Pasi> protection support aswell?
> 
> The disk needs to support T10 PI (PROTECT=1 in the Standard Inquiry VPD
> page). We don't support driving the HBA in PI mode with a non-PI target.
> 

Btw do you know the current status of T10 PI support in md/dm raid? 
If I understood correctly there's some support for raid0/raid1 implemented..

Are there any docs how to enable/disable/configure T10 PI for md/dm raid?
Perhaps the /integrite/{write_enable|read_verify} work directly for the 
md/dm device? 

Thanks a lot!

-- Pasi

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html