[PATCH 0/2, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-08-02 Thread Bart Van Assche
Hello Martin, This patch series avoids that SCSI device removal through sysfs triggers a deadlock. Please consider this patch series for the v4.19 kernel. Thanks, Bart. Bart Van Assche (2): sysfs: Introduce sysfs_{un,}break_active_protection() Avoid that SCSI device removal through sysfs

Re: [PATCH 2/2] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-08-02 Thread Bart Van Assche
On Wed, 2018-08-01 at 22:58 +, Bart Van Assche wrote: > On Wed, 2018-08-01 at 21:16 +0000, Bart Van Assche wrote: > > During my kernel tests of today I noticed that this patch makes booting > > significantly slower: boot time for a VM increases from 6s to 157s. Martin,

[PATCH] sr: Avoid that opening a CD-ROM hangs with runtime power management enabled

2018-08-02 Thread Bart Van Assche
do_filp_open+0x11c/0x1c0 do_sys_open+0x208/0x2d0 __x64_sys_openat+0x59/0x70 do_syscall_64+0x77/0x230 entry_SYSCALL_64_after_hwframe+0x49/0xbe Signed-off-by: Bart Van Assche Cc: Maurizio Lombardi Cc: Johannes Thumshirn Cc: Alan Stern Cc: --- drivers/scsi/sr.c | 29 +---

Re: [PATCH 4/6] scsi: ufs: Add API to execute raw upiu commands

2018-08-02 Thread Bart Van Assche
On Thu, 2018-08-02 at 11:05 +, Avri Altman wrote: > -Original Message- > > From: Bart Van Assche > > Sent: Wednesday, August 01, 2018 6:28 PM > > [ ... ] > > > + spin_unlock_irqrestore(host->host_lock, flags); > > > + > > > + /*

Re: [PATCH 2/2] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-08-01 Thread Bart Van Assche
On Wed, 2018-08-01 at 21:16 +, Bart Van Assche wrote: > During my kernel tests of today I noticed that this patch makes booting > significantly slower: boot time for a VM increases from 6s to 157s. Martin, > please drop this patch series. Please ignore my previous message - these tw

Re: [PATCH 2/2] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-08-01 Thread Bart Van Assche
On Mon, 2018-07-30 at 11:40 -0700, Bart Van Assche wrote: > A long time ago the unfortunate decision was taken to add a self- > deletion attribute to the sysfs SCSI device directory. That decision > was unfortunate because self-deletion is really tricky. We can't drop > that attri

Re: [RFC 0/6] scsi: scsi transport for ufs devices

2018-08-01 Thread Bart Van Assche
On Mon, 2018-07-30 at 14:52 -0400, Douglas Gilbert wrote: > I designed 'struct sg_io_v4' found in include/uapi/linux/bsg.h to handle > storage > related protocols, not just the SCSI command set. After the guard, the next > two fields in that structure are: > __u32 protocol; /*

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-08-01 Thread Bart Van Assche
On Wed, 2018-08-01 at 11:44 -0500, Mike Christie wrote: > I agree knowing the acl info is useful, so how about the following: > > 1. Create a file named "acl" in the session's dir. > 2. For dynamic_node_acl=0 the acl file will return a empty string or > "generate_node_acls=1" or "demo mode

Re: [PATCH 6/6] scsi: ufs-bsg: Add support for uic commands in ufs_bsg_request()

2018-08-01 Thread Bart Van Assche
On Wed, 2018-08-01 at 11:04 +0300, Avri Altman wrote: > + struct uic_command uc = {0}; Please use "{ }" or "{}" for structure initialization as is done elsewhere in the kernel instead of "{0}". > +#define UIC_CMD_SIZE (sizeof(u32) * 4) Please add a comment above this definition that

Re: [PATCH 5/6] scsi: ufs-bsg: Add support for raw upiu in ufs_bsg_request()

2018-08-01 Thread Bart Van Assche
On Wed, 2018-08-01 at 11:04 +0300, Avri Altman wrote: > + if (qr->opcode != UPIU_QUERY_OPCODE_WRITE_DESC || > + desc_size <= 0) > + return -EINVAL; Please use the full line length and don't split lines if that is not necessary. > + ret =

Re: [PATCH 4/6] scsi: ufs: Add API to execute raw upiu commands

2018-08-01 Thread Bart Van Assche
On Wed, 2018-08-01 at 11:04 +0300, Avri Altman wrote: > +/** > + * ufshcd_exec_raw_upiu_cmd - API function for sending raw upiu commands > + * @hba: per-adapter instance > + * @req_upiu:upiu request - 8 dwards > + * @rsp_upiu:upiu reply - 8 dwards > + * @msgcode: message code,

Re: [PATCH 4/6] scsi: ufs: Add API to execute raw upiu commands

2018-08-01 Thread Bart Van Assche
On Wed, 2018-08-01 at 11:04 +0300, Avri Altman wrote: > + wait_event(hba->tm_tag_wq, ufshcd_get_tm_free_slot(hba, _slot)); The above is the weirdest API I have seen so far for tag allocation. Why does ufshcd_get_tm_free_slot() does a linear search through a bitmap instead of using the sbitmap

Re: [PATCH 2/6] scsi: ufs: Add ufs-bsg module

2018-08-01 Thread Bart Van Assche
On Wed, 2018-08-01 at 11:04 +0300, Avri Altman wrote: > +++ b/drivers/scsi/ufs/ufs_bsg.c > @@ -0,0 +1,127 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * SSCSI transport companion for UFS HBA What is "SSCSI"? > diff --git a/drivers/scsi/ufs/ufs_bsg.h b/drivers/scsi/ufs/ufs_bsg.h > new file

[PATCH 2/2] libiscsi: Annotate fall-through

2018-07-30 Thread Bart Van Assche
This patch avoids that building with W=1 causes the compiler to complain about fall-through. Signed-off-by: Bart Van Assche Cc: Lee Duncan Cc: Chris Leech --- drivers/scsi/libiscsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index

[PATCH 1/2] libiscsi: Annotate locking assumptions

2018-07-30 Thread Bart Van Assche
This patch avoids that sparse reports the following: drivers/scsi/libiscsi.c:1844:23: warning: context imbalance in 'iscsi_exec_task_mgmt_fn' - unexpected unlock Signed-off-by: Bart Van Assche Signed-off-by: Lee Duncan Signed-off-by: Chris Leech --- drivers/scsi/libiscsi.c | 1 + 1 file

[PATCH 0/2] Improve libiscsi source code annotations

2018-07-30 Thread Bart Van Assche
-archive.com/open-iscsi@googlegroups.com/msg10136.html. Thanks, Bart. Bart Van Assche (2): libiscsi: Annotate locking assumptions libiscsi: Annotate fall-through drivers/scsi/libiscsi.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.18.0

[PATCH 2/2] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread Bart Van Assche
sg54525.html. Fixes: ac0ece9174ac ("scsi: use device_remove_file_self() instead of device_schedule_callback()") Signed-off-by: Bart Van Assche Cc: Greg Kroah-Hartman Cc: Tejun Heo Cc: Johannes Thumshirn Cc: --- drivers/scsi/scsi_sysfs.c | 20 ++-- 1 file changed, 18 insertions(+)

[PATCH 0/2] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread Bart Van Assche
Hello Martin, This patch series avoids that SCSI device removal through sysfs triggers a deadlock. Please consider this patch series for the v4.19 kernel. Thanks, Bart. Bart Van Assche (2): sysfs: Introduce sysfs_{un,}break_active_protection() Avoid that SCSI device removal through sysfs

[PATCH 1/2] sysfs: Introduce sysfs_{un,}break_active_protection()

2018-07-30 Thread Bart Van Assche
Introduce these two functions and export them such that the next patch can add calls to these functions from the SCSI core. Signed-off-by: Bart Van Assche Cc: Greg Kroah-Hartman Cc: Tejun Heo Cc: --- fs/sysfs/file.c | 44 +++ include/linux

Re: [RFC 0/6] scsi: scsi transport for ufs devices

2018-07-30 Thread Bart Van Assche
On Sun, 2018-07-29 at 16:33 +0300, Avri Altman wrote: > Here is a proposal to use the scsi transport subsystem to manage > ufs devices. > > scsi transport is a framework that allow to send scsi commands to > a non-scsi devices. Still, it is flexible enough to allow > sending non-scsi commands as

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread Bart Van Assche
On Mon, 2018-07-30 at 10:31 -0700, t...@kernel.org wrote: > On Mon, Jul 30, 2018 at 05:28:11PM +0000, Bart Van Assche wrote: > > It's not clear to me how the sysfs_break_active_protection() should obtain > > the struct kernfs_node pointer to the attribute. Calling that funct

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-30 Thread Bart Van Assche
On Mon, 2018-07-30 at 07:13 -0700, t...@kernel.org wrote: > Also, wouldn't it be better to just expose sysfs_break/unbreak and > then do sth like the following from scsi? > > kobject_get(); > sysfs_break_active_protection(); > do normal sysfs removal; >

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-28 Thread Bart Van Assche
On Thu, 2018-07-26 at 06:35 -0700, Tejun Heo wrote: > Making removal asynchronous this way sometimes causes issues because > whether the user sees the device released or not is racy. Hello Tejun, How could this change cause any user-visible changes? My understanding is that any work queued with

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-26 Thread Bart Van Assche
On Thu, 2018-07-26 at 07:14 -0700, t...@kernel.org wrote: > Hello, > > On Thu, Jul 26, 2018 at 02:09:41PM +0000, Bart Van Assche wrote: > > On Thu, 2018-07-26 at 06:35 -0700, Tejun Heo wrote: > > > Making removal asynchronous this way sometimes causes issues because >

[PATCH] qedi: Fix a potential buffer overflow

2018-07-26 Thread Bart Van Assche
Tell snprintf() to store at most 255 characters in the output buffer instead of 256. This patch avoids that smatch reports the following warning: drivers/scsi/qedi/qedi_main.c:891: qedi_get_boot_tgt_info() error: snprintf() is printing too much 256 vs 255 Signed-off-by: Bart Van Assche Cc: Cc

Re: [PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-26 Thread Bart Van Assche
On Thu, 2018-07-26 at 06:35 -0700, Tejun Heo wrote: > Making removal asynchronous this way sometimes causes issues because > whether the user sees the device released or not is racy. > kernfs/sysfs have mechanisms to deal with these cases - remove_self > and kernfs_break_active_protection(). Have

[PATCH, RESEND] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-07-25 Thread Bart Van Assche
er_hwframe+0x49/0xbe See also https://www.mail-archive.com/linux-scsi@vger.kernel.org/msg54525.html. Suggested-by: Eric W. Biederman Fixes: ac0ece9174ac ("scsi: use device_remove_file_self() instead of device_schedule_callback()") Signed-off-by: Bart Van Assche Cc: Eric W. Biederman Cc

Re: [PATCH v2] scsi_debug: add cmd abort option to every_nth

2018-07-25 Thread Bart Van Assche
s "every_nth" mechanism. > Ref with original patch to scsi_debug: > > https://lore.kernel.org/lkml/a68ad043-26a1-d3d8-2009-504ba4230...@oracle.com/ Reviewed-by: Bart Van Assche

Re: [PATCHv2 2/2] scsi: set timed out out mq requests to complete

2018-07-25 Thread Bart Van Assche
On Mon, 2018-07-23 at 08:37 -0600, Keith Busch wrote: > diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c > index 8932ae81a15a..2715cdaa669c 100644 > --- a/drivers/scsi/scsi_error.c > +++ b/drivers/scsi/scsi_error.c > @@ -296,6 +296,20 @@ enum blk_eh_timer_return

Re: [PATCH] scsi_debug: add cmd abort option to every_nth

2018-07-20 Thread Bart Van Assche
On Fri, 2018-07-20 at 15:21 -0400, Douglas Gilbert wrote: > /* Complete the processing of the thread that queued a SCSI command to this > @@ -4459,6 +4462,11 @@ static int schedule_resp(struct scsi_cmnd *cmnd, > struct sdebug_dev_info *devip, > sd_dp->issuing_cpu =

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-20 Thread Bart Van Assche
On Fri, 2018-07-20 at 16:08 -0500, Mike Christie wrote: > Hey Bart and Christoph, > > Bart, I noticed we basically had what you are requesting but Christoph > had moved the id code from the fabric drivers to lio core in this commit: > > commit 2650d71e244fb3637b5f58a0080682a8bf9c7091 > Author:

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-19 Thread Bart Van Assche
On Thu, 2018-07-19 at 11:38 -0500, Mike Christie wrote: > On 07/19/2018 10:37 AM, Bart Van Assche wrote: > > The general recommendation for configfs is that each attribute contains a > > single value, just like for sysfs. Patch 11/15 exports two values through > > a singl

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-19 Thread Bart Van Assche
On Wed, 2018-07-18 at 21:15 -0500, Mike Christie wrote: > Oh wait, I think I know what you mean. I should have written "se_node_acl" instead of "se_portal_group". Bart.

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-19 Thread Bart Van Assche
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: > + if (se_sess->se_tpg->se_tpg_tfo->sess_get_initiator_sid) { > + len = snprintf(page, PAGE_SIZE, "%s 0x%6phN\n", > +se_sess->se_node_acl->initiatorname, > +

Re: [PATCH 04/15] target/iscsi: move session_index to common se_session

2018-07-19 Thread Bart Van Assche
On Wed, 2018-07-18 at 22:47 -0500, Mike Christie wrote: > Hey Bart, I looked into this some more and this value is also being used > as the scsiAttIntrPortIndex. For that use, does it need to be unique > across a target when the target has multiple ports? > > So I think it needs to be on the

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-19 Thread Bart Van Assche
On Wed, 2018-07-18 at 20:02 -0500, Mike Christie wrote: > On 07/18/2018 07:03 PM, Mike Christie wrote: > > On 07/18/2018 05:09 PM, Bart Van Assche wrote: > > > [ ... ] > > > is that these involve a transport ID and that that transport ID can be up > > &g

Re: [PATCH 12/15] target: add callout to test a session

2018-07-18 Thread Bart Van Assche
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: > + int (*test_session)(struct se_session *, u8 timeout); Does any of the patches in this series define a test_session callback function? What is the unit of the timeout parameter? 1/HZ, ms or s? Thanks, Bart.

Re: [PATCH 11/15] target: export initiator port values for all sessions

2018-07-18 Thread Bart Van Assche
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: > Export the initiator port info in configfs Does configfs support soft links? Can this information be exported as a soft link from the session directory to the struct se_portal_group configfs object? Thanks, Bart.

Re: [PATCH 09/15] target: add session dir in configfs

2018-07-18 Thread Bart Van Assche
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: > +static void target_fabric_session_release(struct config_item *item) > +{ > + struct se_session *se_sess = container_of(to_config_group(item), > + struct se_session, group); > +

Re: [PATCH 08/15] target: add session removal function

2018-07-18 Thread Bart Van Assche
diately calling > transport_deregister_session or just calling > transport_deregisteir_session. ^ transport_deregister_session? Anyway: Reviewed-by: Bart Van Assche

Re: [PATCH 07/15] target: rename target_alloc_session

2018-07-18 Thread Bart Van Assche
just call those 2 functions to setup and remove > a session. Anyway: Reviewed-by: Bart Van Assche

Re: [PATCH 06/15] target: make transport_init_session_tags static

2018-07-18 Thread Bart Van Assche
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: > transport_init_session_tags is only called from target_core_transport.c > so make it static. Reviewed-by: Bart Van Assche

Re: [PATCH 05/15] target: remove sess_get_index

2018-07-18 Thread Bart Van Assche
if multiple initiators > connected to the same target port. So just use the se_session sid > for all drivers and remove sess_get_index callout. Anyway: Reviewed-by: Bart Van Assche

Re: [PATCH 04/15] target/iscsi: move session_index to common se_session

2018-07-18 Thread Bart Van Assche
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: > diff --git a/drivers/target/target_core_transport.c > b/drivers/target/target_core_transport.c > index 75ddbbb..97a1ee5 100644 > --- a/drivers/target/target_core_transport.c > +++ b/drivers/target/target_core_transport.c > @@ -55,6 +55,8

Re: [PATCH 03/15] target: fix __transport_register_session locking

2018-07-18 Thread Bart Van Assche
lock_irqrestore/spin_unlock_irq. > > This has __transport_register_session use the save/restore > call. Reviewed-by: Bart Van Assche

Re: [PATCH 02/15] target: fix isid copying and comparision

2018-07-18 Thread Bart Van Assche
On Sun, 2018-07-15 at 18:16 -0500, Mike Christie wrote: > The isid is 48 bits, and in hex string format it's 12 bytes. > We are currently copying the 12 byte hex string to a u64 > so we can easily compare it, but this has the problem that > only 8 bytes of the 12 bytes are copied. > > The next

Re: [PATCH] mpt3sas: correct reset of smid while clearing scsi tracker

2018-07-18 Thread Bart Van Assche
On Wed, 2018-07-18 at 01:22 -0400, Sreekanth Reddy wrote: > In mpt3sas_base_clear_st() function smid value is reseted in wrong line, > i.e. driver should reset smid value to zero after decrementing chain_offset > counter in chain_lookup table but in current code, driver is resetting smid > value

Re: [PATCH] sg: fix minor memory leak in error path

2018-07-12 Thread Bart Van Assche
On 07/12/18 13:30, Tony Battersby wrote: Fix a minor memory leak when there is an error opening a /dev/sg device. Reviewed-by: Bart Van Assche

Re: [PATCH] sg: fix minor memory leak in error path

2018-07-12 Thread Bart Van Assche
On Thu, 2018-07-12 at 14:46 -0400, Tony Battersby wrote: > Fix a minor memory leak when there is an error opening a /dev/sg device. Please Cc: stable for patches like this and please also add a Fixes: tag. Thanks, Bart.

Re: [PATCH] scsi: sd_zbc: Fix variable type and bogus comment

2018-07-05 Thread Bart Van Assche
value upon return. To fix this, change "ret" type to s64. Reviewed-by: Bart Van Assche

Re: [PATCH] klist: Make it safe to use klists in atomic context

2018-06-28 Thread Bart Van Assche
On 06/28/18 08:37, Greg Kroah-Hartman wrote: On Fri, Jun 22, 2018 at 02:54:49PM -0700, Bart Van Assche wrote: In the scsi_transport_srp implementation it cannot be avoided to iterate over a klist from atomic context when using the legacy block layer instead of blk-mq. Hence this patch

[PATCH] sd_zbc: Remove an assignment from sd_zbc_setup_report_cmnd()

2018-06-28 Thread Bart Van Assche
igned-off-by: Bart Van Assche Reviewed-by: Damien Le Moal Cc: Hannes Reinecke Cc: Johannes Thumshirn --- drivers/scsi/sd_zbc.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index a14fef11776e..160b79619d30 100644 --- a/drivers/scsi/sd_zb

Re: Possible race in completion with SRP after abort with latest upstream kernel 4.17.0+

2018-06-27 Thread Bart Van Assche
On 06/07/18 08:34, Laurence Oberman wrote: On Thu, 2018-06-07 at 15:21 +, Bart Van Assche wrote: On Thu, 2018-06-07 at 09:23 -0400, Laurence Oberman wrote: Have you seen this before, let me know what else you want from the dump while I look further. Hello Laurence, I haven't seen

Re: [PATCH v1] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-27 Thread Bart Van Assche
On 06/24/18 23:10, Sreekanth Reddy wrote: Before calling scsi_internal_device_block_nowait() API; driver sets sas_device_priv_data->block flag as one. And in the scsih_qcmd() driver checks for this flag as shown below and return the commands with host busy status. } else if

Re: [PATCH 2/2] qedi: Fix truncation of target name

2018-06-27 Thread Bart Van Assche
On Wed, 2018-06-27 at 05:14 -0700, Nilesh Javali wrote: > Use sprintf instead of snprintf to fix truncation of target name. > This fix is extension of patch > "scsi: qedi: Fix truncation of CHAP name and secret". > > Signed-off-by: Nilesh Javali > --- > drivers/scsi/qedi/qedi_main.c | 4 ++-- >

Re: [PATCH 1/2] qedi: Correct the size of target name

2018-06-27 Thread Bart Van Assche
On Wed, 2018-06-27 at 05:14 -0700, Nilesh Javali wrote: > There is potential buffer overflow while getting the target > name from the NVRAM. Correct the size of the buffer to avoid > overflow. > > Signed-off-by: Nilesh Javali > --- > drivers/scsi/qedi/qedi_iscsi.h | 2 +- > 1 file changed, 1

[PATCH] Avoid that SCSI device removal through sysfs triggers a deadlock

2018-06-26 Thread Bart Van Assche
er_hwframe+0x49/0xbe See also https://www.mail-archive.com/linux-scsi@vger.kernel.org/msg54525.html. Suggested-by: Eric W. Biederman Fixes: ac0ece9174ac ("scsi: use device_remove_file_self() instead of device_schedule_callback()") Signed-off-by: Bart Van Assche Cc: Eric W. Biederman Cc

Re: [PATCH] scsi: ibmvscsi: Improve strings handling

2018-06-26 Thread Bart Van Assche
On 06/26/18 12:10, Breno Leitao wrote: if (ppartition_name) strncpy(partition_name, ppartition_name, - sizeof(partition_name)); + sizeof(partition_name) - 1); Please use strlcpy() instead of trying to emulate

[PATCH] sd: Remove a superfluous assignment

2018-06-25 Thread Bart Van Assche
Since blk_rq_bytes(req) returns req->__data_len, assigning that value to req->__data_len is superfluous. Hence remove that assignment. See also commit 5db44863b6eb ("[SCSI] sd: Implement support for WRITE SAME"). Signed-off-by: Bart Van Assche --- drivers/scsi/sd.c | 1 - 1

[PATCH] qedi: Fix misleading indentation

2018-06-25 Thread Bart Van Assche
This patch avoids that smatch reports the following warnings: drivers/scsi/qedi/qedi_fw_api.c:129: init_sqe() warn: inconsistent indenting drivers/scsi/qedi/qedi_fw_api.c:137: init_sqe() warn: inconsistent indenting Signed-off-by: Bart Van Assche Cc: qlogic-storage-upstr...@cavium.com

Re: [PATCH] qedi: Fix static checker warning

2018-06-25 Thread Bart Van Assche
On 06/25/18 05:32, Nilesh Javali wrote: This patch fixes the static checker warning, drivers/scsi/qedi/qedi_main.c:891 qedi_get_boot_tgt_info() error: snprintf() is printing too much 256 vs 255 Which static checker produced this warning? Signed-off-by: Nilesh Javali ---

[PATCH] klist: Make it safe to use klists in atomic context

2018-06-22 Thread Bart Van Assche
d+0x1c1/0x1e0 ret_from_fork+0x24/0x30 See also commit c9ddf73476ff ("scsi: scsi_transport_srp: Fix shost to rport translation"). Signed-off-by: Bart Van Assche Cc: Martin K. Petersen Cc: James Bottomley --- lib/klist.c | 10 ++ 1 file changed, 6 insertions(+), 4 delet

Re: [PATCH v1] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-22 Thread Bart Van Assche
On 06/22/18 09:38, Sreekanth Reddy wrote: In driver's .resume() callback function, driver is doing IOC reset operation. And as per your suggestion we tried using scsi_internal_device_block_nowait() to block the all the devices attached to the HBA before going for IOC reset operation. During

Re: qla2xxx and smatch warnings about uninitialized variables

2018-06-22 Thread Bart Van Assche
On 06/22/18 14:06, Dan Carpenter wrote: On Fri, Jun 22, 2018 at 08:43:21AM -0700, Bart Van Assche wrote: Hello Himanshu, The latest smatch version reports a large number of warnings about uninitialized variables for the qla2xxx driver. I think these warnings indicate real bugs. Can you have

qla2xxx and smatch warnings about uninitialized variables

2018-06-22 Thread Bart Van Assche
Hello Himanshu, The latest smatch version reports a large number of warnings about uninitialized variables for the qla2xxx driver. I think these warnings indicate real bugs. Can you have a look at these warnings? Thanks, Bart. $ make M=drivers/scsi/qla2xxx C=2 CHECK="smatch -p=kernel"

Re: [PATCH v1] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-22 Thread Bart Van Assche
On 06/21/18 22:35, Sreekanth Reddy wrote: No, lock_system_sleep() is not inserted in the interrupt context. we have inserted it in .resume() call back function just before issuing the IOC reset. That's the wrong place to insert a lock_system_sleep() call. Please have a look at

Re: [PATCH v1] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-21 Thread Bart Van Assche
On Thu, 2018-06-21 at 15:41 +0530, Sreekanth Reddy wrote: > Bart, we tried using lock_system_sleep() before calling IOC reset > operation in .resume() callback function and unlock_system_sleep() > after the IOC reset. With this code change we see system is going to > hang state during hibernation

Re: [PATCH v1] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-20 Thread Bart Van Assche
On Wed, 2018-06-20 at 09:18 +0530, Chaitra Basappa wrote: > We have tried with calling scsi_internal_device_block_nowait() API before > doing IOC reset (i.e. host reset) and called > scsi_internal_device_unblock_nowait() after performing IOC reset. > We have tested this code change with various

Re: [PATCH] scsi: let __scsi_remove_device do the blk_put_queue in one place

2018-06-20 Thread Bart Van Assche
On Wed, 2018-06-20 at 18:58 +0200, Anthoine Bourgeois wrote: > On Wed, Jun 20, 2018 at 01:50:38PM +0000, Bart Van Assche wrote: > > On Wed, 2018-06-20 at 11:57 +0200, anthoine.bourge...@gmail.com wrote: > > > The function scsi_device_dev_release_usercontext c

Re: [PATCH] scsi: let __scsi_remove_device do the blk_put_queue in one place

2018-06-20 Thread Bart Van Assche
On Wed, 2018-06-20 at 11:57 +0200, anthoine.bourge...@gmail.com wrote: > The function scsi_device_dev_release_usercontext calls blk_put_queue > with request_queue then set request_queue to NULL. If the function > scsi_device_dev_release_usercontext is racy then the next call to > blk_put_queue

[PATCH v2 0/8] mpt3sas: Fix static source code checker complaints

2018-06-15 Thread Bart Van Assche
. Bart Van Assche (8): mpt3sas: Fix indentation mpt3sas: Remove set-but-not-used variables mpt3sas: Annotate switch/case fall-through mpt3sas: Introduce struct mpt3sas_nvme_cmd mpt3sas: Fix _transport_smp_handler() error path mpt3sas: Fix a race condition in mpt3sas_base_hard_reset_handler

[PATCH v2 5/8] mpt3sas: Fix _transport_smp_handler() error path

2018-06-15 Thread Bart Van Assche
This patch avoids that smatch complains about a double unlock on ioc->transport_cmds.mutex. Fixes: 651a01364994 ("scsi: scsi_transport_sas: switch to bsg-lib for SMP passthrough") Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sathya Prakash Cc: Chaitra P B Cc: S

[PATCH v2 8/8] mpt3sas: Improve kernel-doc headers

2018-06-15 Thread Bart Van Assche
Avoids that warnings about the kernel headers appear when building with W=1. Remove useless "@Returns - Nothing" clauses. Change "@Return - " into "Return: ". Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani Cc: R

[PATCH v2 3/8] mpt3sas: Annotate switch/case fall-through

2018-06-15 Thread Bart Van Assche
This patch avoids that gcc complains about switch/case fall-through when building with W=1. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 1 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 3 +++ 2 files

[PATCH v2 1/8] mpt3sas: Fix indentation

2018-06-15 Thread Bart Van Assche
Modify the indentation such that smatch no longer complains about inconsistent indenting. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 40

[PATCH v2 2/8] mpt3sas: Remove set-but-not-used variables

2018-06-15 Thread Bart Van Assche
This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 10 -- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 5 - 2 files changed, 15 deletions(-) diff --git

[PATCH v2 6/8] mpt3sas: Fix a race condition in mpt3sas_base_hard_reset_handler()

2018-06-15 Thread Bart Van Assche
;shost_recovery. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 10 +- drivers/scsi/mpt3sas/mpt3sas_base.h | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drive

[PATCH v2 7/8] mpt3sas: Split _base_reset_handler(), mpt3sas_scsih_reset_handler() and mpt3sas_ctl_reset_handler()

2018-06-15 Thread Bart Van Assche
-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 118 ++- drivers/scsi/mpt3sas/mpt3sas_base.h | 15 ++-- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 89 +++- drivers/scsi/mpt3sas

[PATCH v2 4/8] mpt3sas: Introduce struct mpt3sas_nvme_cmd

2018-06-15 Thread Bart Van Assche
Make _base_build_nvme_prp() easier to read by introducing a structure to access NVMe command fields. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 13 - drivers/scsi/mpt3sas/mpt3sas_base.h

[PATCH 2/8] mpt3sas: Remove set-but-not-used variables

2018-06-14 Thread Bart Van Assche
This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 10 -- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 5 - 2 files changed, 15 deletions(-) diff --git

[PATCH 5/8] mpt3sas: Introduce struct mpt3sas_nvme_cmd

2018-06-14 Thread Bart Van Assche
Make _base_build_nvme_prp() easier to read by introducing a structure to access NVMe command fields. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 13 - drivers/scsi/mpt3sas/mpt3sas_base.h

[PATCH 7/8] mpt3sas: Fix a race condition in mpt3sas_base_hard_reset_handler()

2018-06-14 Thread Bart Van Assche
;shost_recovery. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 10 +- drivers/scsi/mpt3sas/mpt3sas_base.h | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drive

[PATCH 4/8] mpt3sas: Fix kernel-doc warnings

2018-06-14 Thread Bart Van Assche
This patch avoids that warnings about the kernel headers appear when building with W=1. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 16 +- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 251

[PATCH 8/8] mpt3sas: Split _base_reset_handler(), mpt3sas_scsih_reset_handler() and mpt3sas_ctl_reset_handler()

2018-06-14 Thread Bart Van Assche
Split each of these functions in three functions - one function per reset phase. This patch does not change any functionality but makes the code easier to read. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas

[PATCH 6/8] mpt3sas: Fix _transport_smp_handler() error path

2018-06-14 Thread Bart Van Assche
This patch avoids that smatch complains about a double unlock on ioc->transport_cmds.mutex. Fixes: 651a01364994 ("scsi: scsi_transport_sas: switch to bsg-lib for SMP passthrough") Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Sathya Prakash Cc: Chaitra P B Cc: S

[PATCH 3/8] mpt3sas: Annotate switch/case fall-through

2018-06-14 Thread Bart Van Assche
This patch avoids that gcc complains about switch/case fall-through when building with W=1. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 1 + drivers/scsi/mpt3sas/mpt3sas_scsih.c | 3 +++ 2 files

[PATCH 0/8] mpt3sas: Fix static source code checker complaints

2018-06-14 Thread Bart Van Assche
Hello Martin, This patch series addresses the complaints reported by multiple static source code analysis tools about the mpt3sas source code. Please consider these patches for kernel v4.19. Thanks, Bart. Bart Van Assche (8): mpt3sas: Fix indentation mpt3sas: Remove set-but-not-used

[PATCH 1/8] mpt3sas: Fix indentation

2018-06-14 Thread Bart Van Assche
Modify the indentation such that smatch no longer complains about inconsistent indenting. Signed-off-by: Bart Van Assche Cc: Sathya Prakash Cc: Chaitra P B Cc: Suganath Prabu Subramani --- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 40

Re: [PATCH] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-14 Thread Bart Van Assche
On Thu, 2018-06-14 at 15:56 +0530, Chaitra Basappa wrote: > Bart, > Please see my replies inline. Hello Chaitra, Please don't use inline replies. That makes it very hard to follow the conversation. BTW, in the headers of your e-mail I found the following: "X-Mailer: Microsoft Outlook 14.0".

Re: [PATCH v1] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-14 Thread Bart Van Assche
On Thu, 2018-06-14 at 06:25 -0400, Chaitra P B wrote: > As a part of host reset operation, driver will flushout all IOs > outstanding at driver level with "DID_RESET" result. > To find which are all commands outstanding at the driver level, > driver loops with smid starting from one to HBA queue

Re: [PATCH] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-13 Thread Bart Van Assche
On Wed, 2018-06-13 at 15:46 +0530, Chaitra Basappa wrote: > When host reset is issued from application, through ioctl reset handler > _ctl_do_reset() -> mpt3sas_base_hard_reset_handler() sets > “ioc->shost_recovery” flag. > If “ioc->shost_recovery” flag is set then driver will return all the >

Re: [PATCH] mpt3sas: Fix calltrace observed while running IO & host reset

2018-06-12 Thread Bart Van Assche
On Tue, 2018-06-12 at 09:17 -0400, Chaitra P B wrote: > diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c > b/drivers/scsi/mpt3sas/mpt3sas_scsih.c > index 23902ad..96e523a 100644 > --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c > +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c > @@ -1489,7 +1489,7 @@

Re: Possible race in completion with SRP after abort with latest upstream kernel 4.17.0+

2018-06-07 Thread Bart Van Assche
On Thu, 2018-06-07 at 09:23 -0400, Laurence Oberman wrote: > Have you seen this before, let me know what else you want from the dump > while I look further. Hello Laurence, I haven't seen this before and I can't reproduce this by running srp-tests against Linus' latest master. So it would be

Re: [PATCH] qla2xxx: Fix setting lower transfer speed if GPSC fails

2018-06-04 Thread Bart Van Assche
On Sun, 2018-06-03 at 22:09 -0700, Himanshu Madhani wrote: > This patch prevents driver from setting lower default speed > of 1 GB/sec, if the switch does not support Get Port Speed > Capabilities (GPSC) command. Setting this default speed results > into much lower write performance for large

Re: [PATCH] sd_zbc: Fix sd_zbc_check_zone_size() error path

2018-06-04 Thread Bart Van Assche
n. The local variable zone_blocks must be set to 0 for an > error to be returned. > > Fixes: ccce20fc7968 ("scsi: sd_zbc: Avoid that resetting a zone fails > sporadically") > Signed-off-by: Damien Le Moal > Cc: Bart Van Assche > --- > drivers/scsi/sd_zbc.c | 2 +-

[PATCH v2] scsi_transport_srp: Fix shost to rport translation

2018-05-21 Thread Bart Van Assche
1d0 ret_from_fork+0x24/0x30 Fixes: e68ca75200fe ("scsi_transport_srp: Reduce failover time") Signed-off-by: Bart Van Assche <bart.vanass...@wdc.com> Cc: Hannes Reinecke <h...@suse.com> Cc: Johannes Thumshirn <jthumsh...@suse.de> Cc: Jason Gunthorpe <j...@mellanox.com> Cc:

Re: [PATCH V3] scsi: ufs: Add specific callback for setting DMA mask

2018-05-20 Thread Bart Van Assche
On Sun, 2018-05-20 at 07:54 +0530, Alim Akhtar wrote: > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index a355d98..9a1374e 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -7781,6 +7781,9 @@ EXPORT_SYMBOL_GPL(ufshcd_dealloc_host); > */ >

Re: [PATCH 3/3] scsi: avoid to hold host-wide counter of host_busy for scsi_mq

2018-04-27 Thread Bart Van Assche
On Fri, 2018-04-20 at 14:57 +0800, Ming Lei wrote: > +struct scsi_host_mq_in_flight { > + int cnt; > +}; > + > +static void scsi_host_check_in_flight(struct request *rq, void *data, > + bool reserved) > +{ > + struct scsi_host_mq_in_flight *in_flight = data; > + > + if

Re: [PATCH 2/3] scsi: read host_busy via scsi_host_busy()

2018-04-27 Thread Bart Van Assche
On Fri, 2018-04-20 at 14:57 +0800, Ming Lei wrote: > show_host_busy(struct device *dev, struct device_attribute *attr, char *buf) > { > struct Scsi_Host *shost = class_to_shost(dev); > - return snprintf(buf, 20, "%d\n", atomic_read(>host_busy)); > + return snprintf(buf, 20, "%d\n",

Re: [PATCH 0/3] scsi: scsi-mq: don't hold host_busy in IO path

2018-04-27 Thread Bart Van Assche
On Fri, 2018-04-27 at 09:39 -0600, Jens Axboe wrote: > blk_mq_tagset_busy_iter(>tag_set, scsi_host_check_in_flight, > _flight); > return in_flight.cnt + atomic_read(>host_busy); > > The atomic read is basically free, once we get rid of the dirty of that > variable on each

<    1   2   3   4   5   6   7   8   9   10   >