[PATCH v2 10/18] sg: remove most access_ok functions

2019-07-26 Thread Douglas Gilbert
Since access_ok() has lost it direction (3rd) parameter there seems to be no benefit in calling access_ok() before __copy_{to|from}_user(). Simplify code by using the variant of these functions that do not start with "__". Signed-off-by: Douglas Gilbert --- drivers/scsi

[PATCH v2 08/18] sg: speed sg_poll and sg_get_num_waiting

2019-07-26 Thread Douglas Gilbert
Track the number of submitted and waiting (for read/receive) requests on each file descriptor with two atomic integers. This speeds sg_poll() and ioctl(SG_GET_NUM_WAITING) which are oft used with the asynchronous (non-blocking) interfaces. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c

[PATCH v2 09/18] sg: sg_allow_if_err_recovery and renames

2019-07-26 Thread Douglas Gilbert
Add sg_allow_if_err_recover() to do checks common to several entry points. Replace retval with either res or ret. Rename sg_finish_rem_req() to sg_finish_scsi_blk_rq(). Rename sg_new_write() to sg_submit(). Other cleanups triggered by checkpatch.pl . Signed-off-by: Douglas Gilbert --- drivers

[PATCH v2 00/18] sg: add v4 interface

2019-07-26 Thread Douglas Gilbert
s to be changed back to ktime_get_boot_ns(). Changes since v1 (sent to linux-scsi list on 20190616): - change ktime_get_boot_ns() to ktime_get_boottime_ns() to reflect kernel API change first seen in lk 5.3.0-rc1 Douglas Gilbert (18): sg: move functions around sg: remove typedefs,

[PATCH v2 01/18] sg: move functions around

2019-07-26 Thread Douglas Gilbert
main driver entry points are considered to be those named in struct file_operations sg_fops' definition. Helper functions are often placed above their caller to reduce the number of forward function declarations needed. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c

[PATCH v2 07/18] sg: move header to uapi section

2019-07-26 Thread Douglas Gilbert
Move user interface part of scsi/sg.h into the new header file: include/uapi/scsi/sg.h . Since scsi/sg.h includes the new header, other code including scsi/sg.h should not be impacted. Signed-off-by: Douglas Gilbert --- include/scsi/sg.h | 268 ++--- include

[PATCH v2 03/18] sg: sg_log and is_enabled

2019-07-26 Thread Douglas Gilbert
tions with the IS_ENABLED macro. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 252 +++--- 1 file changed, 125 insertions(+), 127 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 6615777931f7..d14ba4a5441c 100644 --- a/d

[PATCH v2 11/18] sg: replace rq array with lists

2019-07-26 Thread Douglas Gilbert
, information that will be placed in it uses a new struct sg_comm_wr_t object. Since the above changes touch almost every function and low level structures, this patch is big. With so many changes, the diff utility that generates the patch sometimes loses track. Signed-off-by: Douglas Gilbert --- drivers

[PATCH v2 16/18] sg: expand sg_comm_wr_t

2019-07-26 Thread Douglas Gilbert
path. Prior to this and a few other changes, the kernel infrastructure was warning about excessive stack usage. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 178 -- 1 file changed, 92 insertions(+), 86 deletions(-) diff --git a/drivers/scsi

Re: [PATCH 14/19] sg: tag and more_async

2019-07-23 Thread Douglas Gilbert
On 2019-07-23 2:11 p.m., kbuild test robot wrote: Hi Douglas, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on mkp-scsi/for-next] [also build test WARNING on v5.3-rc1 next-20190723] [if your patch is applied to the wrong git tree, please drop us a note to help

Re: [PATCH 2/3] fcoe: avoid memset across pointer boundaries

2019-07-22 Thread Douglas Gilbert
On 2019-07-22 7:50 a.m., Christoph Hellwig wrote: On Mon, Jul 22, 2019 at 08:22:30AM +0200, Hannes Reinecke wrote: Gcc-9 complains for a memset across pointer boundaries, which happens as the code tries to allocate a flexible array on the stack. Turns out we cannot do this without relying on gcc

[PATCH 14/18] sg: rework debug info

2019-06-16 Thread Douglas Gilbert
ently fixed at 8192 bytes. Later patches will allow a user to change this value via an ioctl. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 238 +++--- 1 file changed, 160 insertions(+), 78 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scs

[PATCH 18/18] sg: bump version to 4.0.03

2019-06-16 Thread Douglas Gilbert
file descriptor is closed; rather these objects are re-used when multiple commands are sent to the same file descriptor. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index

[PATCH 12/18] sg: sense buffer rework

2019-06-16 Thread Douglas Gilbert
commands: those that fail and those that want to return more information other than a SCSI status of GOOD. Allocate sense buffer as needed on the heap and delete as soon as possible. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 47 +++ 1 file

[PATCH 09/18] sg: sg_allow_if_err_recovery and renames

2019-06-16 Thread Douglas Gilbert
Add sg_allow_if_err_recover() to do checks common to several entry points. Replace retval with either res or ret. Rename sg_finish_rem_req() to sg_finish_scsi_blk_rq(). Rename sg_new_write() to sg_submit(). Other cleanups triggered by checkpatch.pl . Signed-off-by: Douglas Gilbert --- drivers

[PATCH 03/18] sg: sg_log and is_enabled

2019-06-16 Thread Douglas Gilbert
tions with the IS_ENABLED macro. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 252 +++--- 1 file changed, 125 insertions(+), 127 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 74243eb25387..bc88fc594a74 100644 --- a/d

[PATCH 11/18] sg: replace rq array with lists

2019-06-16 Thread Douglas Gilbert
, information that will be placed in it uses a new struct sg_comm_wr_t object. Since the above changes touch almost every function and low level structures, this patch is big. With so many changes, the diff utility that generates the patch sometimes loses track. Signed-off-by: Douglas Gilbert --- drivers

[PATCH 15/18] sg: add 8 byte SCSI LUN to sg_scsi_id

2019-06-16 Thread Douglas Gilbert
#x27; value with the version 3 or version 4 driver. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 5 +++-- include/uapi/scsi/sg.h | 5 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 82a2fe25d916..a244ea7d436f 100644

[PATCH 05/18] sg: bitops in sg_device

2019-06-16 Thread Douglas Gilbert
Introduce bitops in sg_device to replace an atomic, a bool and a char. That char (sgdebug) had been reduced to only two states. Add some associated macros to make the code a little clearer. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 104

[PATCH 16/18] sg: expand sg_comm_wr_t

2019-06-16 Thread Douglas Gilbert
path. Prior to this and a few other changes, the kernel infrastructure was warning about excessive stack usage. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 178 -- 1 file changed, 92 insertions(+), 86 deletions(-) diff --git a/drivers/scsi

[PATCH 07/18] sg: move header to uapi section

2019-06-16 Thread Douglas Gilbert
Move user interface part of scsi/sg.h into the new header file: include/uapi/scsi/sg.h . Since scsi/sg.h includes the new header, other code including scsi/sg.h should not be impacted. Signed-off-by: Douglas Gilbert --- include/scsi/sg.h | 268 ++--- include

[PATCH 00/18] sg: add v4 interface

2019-06-16 Thread Douglas Gilbert
same webpage as above in the second half of the section titled: "15 Downloads and testing". This patchset is against Martin Petersen's 5.3/scsi-queue branch. It will also apply to lk 5.1 and probably lk 5.0 . Douglas Gilbert (18): sg: move functions around sg: remove typedefs,

[PATCH 10/18] sg: remove most access_ok functions

2019-06-16 Thread Douglas Gilbert
Since access_ok() has lost it direction (3rd) parameter there seems to be no benefit in calling access_ok() before __copy_{to|from}_user(). Simplify code by using the variant of these functions that do not start with "__". Signed-off-by: Douglas Gilbert --- drivers/scsi

[PATCH 13/18] sg: add sg v4 interface support

2019-06-16 Thread Douglas Gilbert
uests use sg v4 interface objects exclusively. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 489 - include/uapi/scsi/sg.h | 37 +++- 2 files changed, 420 insertions(+), 106 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c

[PATCH 17/18] sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls

2019-06-16 Thread Douglas Gilbert
ction is preferred but existing practice for sync usage (i.e. the current sg driver supporting the v3 interface object with ioctl(SG_IO) while the bsg driver continues to support the v4 interface object with ioctl(SG_IO)) dictates the dual nature of ioctl(SG_IO). Signed-off-by: Douglas Gilbert ---

[PATCH 08/18] sg: speed sg_poll and sg_get_num_waiting

2019-06-16 Thread Douglas Gilbert
Track the number of submitted and waiting (for read/receive) requests on each file descriptor with two atomic integers. This speeds sg_poll() and ioctl(SG_GET_NUM_WAITING) which are oft used with the asynchronous (non-blocking) interfaces. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c

[PATCH 06/18] sg: make open count an atomic

2019-06-16 Thread Douglas Gilbert
Convert sg_device::open_cnt into an atomic. Also rename sg_tablesize into the more descriptive max_sgat_elems. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 39 --- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/sg.c b

[PATCH 01/18] sg: move functions around

2019-06-16 Thread Douglas Gilbert
main driver entry points are considered to be those named in struct file_operations sg_fops' definition. Helper functions are often placed above their caller to reduce the number of forward function declarations needed. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c

[PATCH 04/18] sg: rework sg_poll(), minor changes

2019-06-16 Thread Douglas Gilbert
Re-arrange code in sg_poll(). Rename sg_read_oxfer() to sg_rd_append(). In sg_start_req() rename rw to r0w. Plus associated changes demanded by checkpatch.pl Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 65 ++- 1 file changed, 30 insertions

[PATCH 02/18] sg: remove typedefs, type+formatting cleanup

2019-06-16 Thread Douglas Gilbert
Typedefs for structure types are discouraged so those structures that are private to the driver have had their typedefs removed. This also means that most "camel" type variable names (i.e. mixed case) have been removed. Signed-off-by: Douglas Gilbert --- drivers/scsi/

Re: [PATCH 00/19] sg: v4 interface, rq sharing + multiple rqs

2019-06-06 Thread Douglas Gilbert
On 2019-06-06 10:34 a.m., Martin K. Petersen wrote: Doug, Cutting a patchset that touches around 1500 lines of a 3000 line driver, then adds new functionality amounting to an extra 3000 lines of code (and comments), according to the "one change per patch" rule would result in a patchset with h

Re: [PATCH 00/19] sg: v4 interface, rq sharing + multiple rqs

2019-06-04 Thread Douglas Gilbert
On 2019-06-03 12:19 p.m., Bart Van Assche wrote: On 5/24/19 11:47 AM, Douglas Gilbert wrote: This patchset is big and can be regarded as a driver rewrite. The number of lines increases from around 3000 to over 6000. Every SCSI reviewer I know is too busy to review a patch series that involves

Re: [PATCH 01/19] sg: move functions around

2019-06-03 Thread Douglas Gilbert
On 2019-05-26 11:46 a.m., Bart Van Assche wrote: On 5/24/19 11:47 AM, Douglas Gilbert wrote: Move code around so it has the basic ordering: open(), close(), write(), read(), ioctl(), other system calls (e.g. mmap()), support code and finally debug code. The change was to put the write

Re: [PATCH 00/19] sg: v4 interface, rq sharing + multiple rqs

2019-06-02 Thread Douglas Gilbert
On 2019-05-26 11:49 a.m., Bart Van Assche wrote: On 5/24/19 11:47 AM, Douglas Gilbert wrote: This patchset restores some functionality that was in the v2 driver version and has been broken by some external patch in the interim period (20 years). What is an "external patch"? It

Re: [PATCH 05/19] sg: replace rq array with lists

2019-05-25 Thread Douglas Gilbert
us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Douglas-Gilbert/sg-v4-interface-rq-sharing-multiple-rqs/20190525-161346 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: powerpc-allyesconfig (attached as .config) compiler

[PATCH 17/19] sg: add multiple request support

2019-05-24 Thread Douglas Gilbert
mand to pick up each SCSI command (cdb). See the webpage at: http://sg.danny.cz/sg/sg_v40.html in the section titled: "9 Multiple requests" Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 616 - include/uapi/scsi/sg.h | 11 +- 2 files c

[PATCH 06/19] sg: sense buffer cleanup

2019-05-24 Thread Douglas Gilbert
Only a smaller percentage of SCSI commands should require a sense buffer. Allocate as needed and delete as soon as possible. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 35 ++- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers

[PATCH 01/19] sg: move functions around

2019-05-24 Thread Douglas Gilbert
commands (i.e. writing metadata to the device). The read() system call is associated with receiving the responses of earlier submitted commands. Helper functions are often placed above their caller to reduce the number of forward function declarations needed. Signed-off-by: Douglas Gilbert

[PATCH 02/19] sg: remove typedefs, type+formatting cleanup

2019-05-24 Thread Douglas Gilbert
Typedefs for structure types are discouraged so those structures that are private to the driver have had their typedefs removed. This also means that most "camel" type variable names (i.e. mixed case) have been removed. Signed-off-by: Douglas Gilbert --- drivers/scsi/

[PATCH 18/19] sg: add slave wait capability

2019-05-24 Thread Douglas Gilbert
n the section titled: "7.1 Slave waiting" This patch adds 120 lines and an extra state in the sg_request's state machine. It may cost more than it is worth and so has been added (almost) last. Signed-off-by: Douglas Gilbert --- drivers/

[PATCH 16/19] sg: add shared requests

2019-05-24 Thread Douglas Gilbert
placed by using SG_FLAG_MMAP_IO (but that adds some other overheads). See the webpage at: http://sg.danny.cz/sg/sg_v40.html in the section titled: "7 Request sharing". Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 812 +++-- include/uapi/scsi/sg.h

[PATCH 07/19] sg: add sg v4 interface support

2019-05-24 Thread Douglas Gilbert
se sg v4 interface objects exclusively. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 503 - include/uapi/scsi/sg.h | 37 ++- 2 files changed, 429 insertions(+), 111 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c

[PATCH 08/19] sg: add 8 byte SCSI LUN to sg_scsi_id

2019-05-24 Thread Douglas Gilbert
iver. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 5 +++-- include/uapi/scsi/sg.h | 5 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 3b78b8c8304b..454abfdd4f74 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.

[PATCH 19/19] sg: table of error numbers with meanings

2019-05-24 Thread Douglas Gilbert
host machine, the SCSI HBA or its associated hardware, or the transport or the storage device. For near end errors some creative license is taken with errno values (e.g. ENOTSOCK) to convey a better sense of what this driver is objecting to. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c

[PATCH 12/19] sg: add sg_set_get_extended ioctl

2019-05-24 Thread Douglas Gilbert
/sg/sg_v40.html specifically the section titled: "13 IOCTLs". Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 252 + include/uapi/scsi/sg.h | 67 +++ 2 files changed, 295 insertions(+), 24 deletions(-) diff --git a/drivers

[PATCH 04/19] sg: move header to uapi section

2019-05-24 Thread Douglas Gilbert
Move user interface part of scsi/sg.h into the new header file: include/uapi/scsi/sg.h . Since scsi/sg.h includes the new header, other code including scsi/sg.h should not be impacted. Signed-off-by: Douglas Gilbert --- include/scsi/sg.h | 268 ++--- include

[PATCH 13/19] sg: sgat_elem_sz and sum_fd_dlens

2019-05-24 Thread Douglas Gilbert
ff-by: Douglas Gilbert --- drivers/scsi/sg.c | 64 +++--- include/uapi/scsi/sg.h | 1 + 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index c014fb24eca1..64e9de67ccd4 100644 --- a/drivers/scsi/sg.c

[PATCH 00/19] sg: v4 interface, rq sharing + multiple rqs

2019-05-24 Thread Douglas Gilbert
alf of the section titled: "15 Downloads and testing". This patchset is against Martin Petersen's 5.3/scsi-queue branch. It will also apply to lk 5.1 and probably lk 5.0 . Douglas Gilbert (19): sg: move functions around sg: remove typedefs, type+formatting cleanup sg: sg_log

[PATCH 15/19] sg: add fd sharing , change, unshare

2019-05-24 Thread Douglas Gilbert
the same effect (i.e. to unshare) so this route is the more common. File shares maybe within a single-threaded process, between threads in the same process, or even between processes (on the same machine) by passing an open file descriptor via Unix sockets to the other process. Signed-off

[PATCH 14/19] sg: tag and more_async

2019-05-24 Thread Douglas Gilbert
paths unless you really understand the implications to user space programs. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 278 + include/uapi/scsi/sg.h | 3 + 2 files changed, 199 insertions(+), 82 deletions(-) diff --git a/drivers/scsi/s

[PATCH 09/19] sg: expand sg_comm_wr_t

2019-05-24 Thread Douglas Gilbert
path. Prior to this and a few other changes, the kernel infrastructure was warning about excessive stack usage. Also make open_cnt (count of active open()s on this device) an atomic. Add more unlikely() and likely() hints on conditionals Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 348

[PATCH 03/19] sg: sg_log and is_enabled

2019-05-24 Thread Douglas Gilbert
the IS_ENABLED macro. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 254 ++ 1 file changed, 123 insertions(+), 131 deletions(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 7be3d777dbd4..291c278451ef 100644 --- a/drivers/scsi/sg.c

[PATCH 11/19] sg: add sg_iosubmit_v3 and sg_ioreceive_v3 ioctls

2019-05-24 Thread Douglas Gilbert
n is preferred but existing practice for sync usage (i.e. the current sg driver supporting the v3 interface object with ioctl(SG_IO) while the bsg driver continues to support the v4 interface object with ioctl(SG_IO)) dictates the dual nature of ioctl(SG_IO). Signed-off-by: Douglas Gilbert ---

[PATCH 10/19] sg: add sg_ioabort ioctl

2019-05-24 Thread Douglas Gilbert
r all file descriptors belonging to the current device, or just the current file descriptor. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c | 158 + include/uapi/scsi/sg.h | 3 + 2 files changed, 132 insertions(+), 29 deletions(-) diff --git a/dr

[PATCH 05/19] sg: replace rq array with lists

2019-05-24 Thread Douglas Gilbert
requests (SG_FRQ_*) and the other for file descriptors (SG_FFD_*). Since the above changes touch almost every function and low level structures, this patch is big. With so many changes, the diff utility that generates the patch sometimes loses track. Signed-off-by: Douglas Gilbert --- drivers/scsi/sg.c

Re: [PATCH 21/24] sg: switch to SPDX tags

2019-05-05 Thread Douglas Gilbert
Identifier: GPL-2.0+ /* * History: * Started: Aug 9 by Lawrence Foard (entr...@world.std.com), @@ -8,12 +9,6 @@ *Copyright (C) 1992 Lawrence Foard * Version 2 and 3 extensions to driver: *Copyright (C) 1998 - 2014 Douglas Gilbert - * - * This program is free softwar

Re: [PATCH 21/24] sg: switch to SPDX tags

2019-05-02 Thread Douglas Gilbert
On 2019-05-01 6:14 p.m., Christoph Hellwig wrote: Use the the GPLv2+ SPDX tag instead of verbose boilerplate text. IOWs replace 3.5 lines with 1. Signed-off-by: Christoph Hellwig Acked-by: Douglas Gilbert --- drivers/scsi/sg.c | 7 +-- 1 file changed, 1 insertion(+), 6

sg driver and blk_get_request()

2019-04-20 Thread Douglas Gilbert
I'm trying hard to crash the sg v4 driver that I'm working on and I have seen failures but my test hardware is not really server quality. I haven't got a copy of the crashes. As Murphy would have, after I connected another machine to monitor the test machine's serial port there have been no crash

Re: [PATCH v3 00/26] compat_ioctl: cleanups

2019-04-16 Thread Douglas Gilbert
On 2019-04-16 4:19 p.m., Arnd Bergmann wrote: Hi Al, It took me way longer than I had hoped to revisit this series, see https://lore.kernel.org/lkml/20180912150142.157913-1-a...@arndb.de/ for the previously posted version. I've come to the point where all conversion handlers and most COMPATIBLE

Re: [PATCH 1/2] ch: add missing mutex_lock()/mutex_unlock() in ch_release()

2019-03-21 Thread Douglas Gilbert
On 2019-03-21 7:33 p.m., Bart Van Assche wrote: On Thu, 2019-03-21 at 19:11 -0400, Douglas Gilbert wrote: That doesn't sound right. If it was correct then sg_open() and sg_release() have mutex overkill (and I don't think that is caused by the complexity of adding O_EXCL which is da

Re: [PATCH 1/2] ch: add missing mutex_lock()/mutex_unlock() in ch_release()

2019-03-21 Thread Douglas Gilbert
On 2019-03-21 7:11 p.m., Douglas Gilbert wrote: On 2019-03-21 5:36 p.m., Bart Van Assche wrote: On Wed, 2019-03-20 at 12:39 +0100, Hannes Reinecke wrote: The 'ch_mutex" is meant to guard against modifications of file->private_data, so we need to take in in ch_release() as well

Re: [PATCH 1/2] ch: add missing mutex_lock()/mutex_unlock() in ch_release()

2019-03-21 Thread Douglas Gilbert
On 2019-03-21 5:36 p.m., Bart Van Assche wrote: On Wed, 2019-03-20 at 12:39 +0100, Hannes Reinecke wrote: The 'ch_mutex" is meant to guard against modifications of file->private_data, so we need to take in in ch_release() as well as in ch_open(). Signed-off-by: Hannes Reinecke --- drivers/sc

Re: ideas for fix to scsi_ioctl_reset

2019-03-14 Thread Douglas Gilbert
On 2019-03-14 11:19 a.m., Bart Van Assche wrote: On Wed, 2019-03-13 at 23:52 -0400, Douglas Gilbert wrote: On 2019-03-13 10:39 p.m., Bart Van Assche wrote: On 3/13/19 6:32 PM, Douglas Gilbert wrote: I agree that scsi_ioctl_reset() should be taught how to produce a request that doesn't bl

Re: ideas for fix to scsi_ioctl_reset

2019-03-13 Thread Douglas Gilbert
On 2019-03-13 10:39 p.m., Bart Van Assche wrote: On 3/13/19 6:32 PM, Douglas Gilbert wrote: I agree that scsi_ioctl_reset() should be taught how to produce a request that doesn't blow up intermediate code expecting all requests to be well made with respect to mq. Hi Doug, Do you perhaps

Re: ideas for fix to scsi_ioctl_reset

2019-03-13 Thread Douglas Gilbert
On 2019-03-13 6:15 p.m., James Smart wrote: On 3/13/2019 2:44 PM, Bart Van Assche wrote: On Wed, 2019-03-13 at 13:19 -0700, James Smart wrote: I've got an oops for the following stack:     ...     lpfc_send_taskmgmt+0x28a [lpfc]     lpfc_bus_reset_handler+0x16a [lpfc]     scsi_try_bus_reset+0x3

Re: [PATCH] scsi_debug: Fix a recently introduced regression

2019-02-12 Thread Douglas Gilbert
On 2019-02-12 2:57 a.m., Christoph Hellwig wrote: On Fri, Feb 08, 2019 at 01:21:27PM -0800, Bart Van Assche wrote: A recent commit removed an element from opcode_info_arr[] but did not modify opcode_ind_arr[] nor was SDEB_I_XDWRITEREAD removed. Remove SDEB_I_XDWRITEREAD and bring the two arrays

Re: [PATCH 2/5] scsi_debug: Use scsi_[gs]et_resid() where appropriate

2019-02-09 Thread Douglas Gilbert
On 2019-02-08 4:25 p.m., Bart Van Assche wrote: This patch does not change any functionality. Cc: Douglas Gilbert Signed-off-by: Bart Van Assche Acked-by: Douglas Gilbert --- drivers/scsi/scsi_debug.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers

Re: [PATCH] scsi: scsi_debug: Implement support for write protect

2019-02-09 Thread Douglas Gilbert
-by: Martin K. Petersen Acked-by: Douglas Gilbert --- drivers/scsi/scsi_debug.c | 76 --- 1 file changed, 31 insertions(+), 45 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index e27f4df24021..19a3e9527c59 100644 --- a

Re: Recent removal of bsg read/write support

2019-02-01 Thread Douglas Gilbert
Updated reply, see below. On 2018-09-03 4:34 a.m., Dror Levin wrote: On Sun, Sep 2, 2018 at 8:55 PM Linus Torvalds wrote: On Sun, Sep 2, 2018 at 4:44 AM Richard Weinberger wrote: CC'ing relevant people. Otherwise your mail might get lost. Indeed. Sorry for that. On Sun, Sep 2, 2018 a

Re: [PATCH] RDMA/srp: Increase max_segment_size

2019-01-30 Thread Douglas Gilbert
On 2019-01-30 3:23 p.m., Bart Van Assche wrote: On Tue, 2019-01-22 at 15:47 -0500, Douglas Gilbert wrote: On 2019-01-22 1:25 p.m., Bart Van Assche wrote: The default behavior of the SCSI core is to set the block layer request queue parameter max_segment_size to 64 KB. That means that elements

Re: [PATCH v2 1/7] Introduce the bidi_supported flag in the host template structure

2019-01-29 Thread Douglas Gilbert
On 2019-01-29 3:35 a.m., Christoph Hellwig wrote: I disagree with investing further effort into BIDI support. It is dead for all practical purposes in standards and implementation, and the fact that we found all these bugs in it just further confirms that. The only answer to that is to bite the

[PATCH] scsi_debug: fix write_same with virtual_gb problem

2019-01-25 Thread Douglas Gilbert
ff-by: Douglas Gilbert Reported-by: Bart Van Assche Tested by: Bart Van Assche --- A change since the test by Bart is memcpy() to memmove() since part of the "fake_store" buffer is being copied to itself which with some LBAs will be overlapping. drivers/scsi/sc

Re: Kernel v5.0, scsi_debug and libiscsi

2019-01-23 Thread Douglas Gilbert
On 2019-01-23 5:56 p.m., Bart Van Assche wrote: On Fri, 2019-01-11 at 13:01 -0500, Douglas Gilbert wrote: On 2019-01-10 6:22 p.m., Bart Van Assche wrote: Hi Doug, Have you ever tried to run the libiscsi conformance tests against the scsi_debug driver? I tried the following: modprobe

Re: [PATCH v2 0/7] Fix handling of bidi commands

2019-01-23 Thread Douglas Gilbert
this patchset (or v1) exofs tests "blew up" when SCSI errors were injected (as predicted). So Boaz, could you apply this patchset and try those tests again. So: Tested-by: Douglas Gilbert Please apply this to all patches in this set.

Re: [PATCH] sd: Protect against submitting READ(6) or WRITE(6) with 256 logical blocks

2019-01-23 Thread Douglas Gilbert
On 2019-01-23 2:12 p.m., Bart Van Assche wrote: Since the READ(6) and WRITE(6) commands interpret a zero in the transfer length field in the CDB as 256 logical blocks, avoid submitting such commands. Cc: Douglas Gilbert Cc: Hannes Reinecke Cc: Christoph Hellwig Reported-by: Douglas Gilbert

Re: [PATCH 0/7] Fix handling of bidi commands

2019-01-22 Thread Douglas Gilbert
On 2019-01-22 7:56 p.m., Bart Van Assche wrote: On Tue, 2019-01-22 at 18:30 -0500, Douglas Gilbert wrote: This patchset needs something like the following if UAS (USB Attached SCSI) is configured in your kernel. Beware of tabs/spaces/line_wraps as this is a cut and paste: diff --git a/drivers

Re: [PATCH 0/7] Fix handling of bidi commands

2019-01-22 Thread Douglas Gilbert
On 2019-01-22 1:57 p.m., Bart Van Assche wrote: Hi Martin, Recently Doug Gilbert reported that handling of bidi commands is broken in the scsi-mq code. This patch series fixes that bug and also simplifies bidi command handling. Please consider these patches for kernel v5.1. Thanks, Bart. Bart

Re: [PATCH] RDMA/srp: Increase max_segment_size

2019-01-22 Thread Douglas Gilbert
On 2019-01-22 1:25 p.m., Bart Van Assche wrote: The default behavior of the SCSI core is to set the block layer request queue parameter max_segment_size to 64 KB. That means that elements of scatterlists are limited to 64 KB. Since RDMA adapters support larger sizes, increase max_segment_size for

Re: dd hangs when reading large partitions

2019-01-18 Thread Douglas Gilbert
On 2019-01-18 7:10 a.m., Marc Gonzalez wrote: Hello, I'm running into an issue which I don't know how to debug. So I'm open to ideas and suggestions :-) On my arm64 board, I have enabled Universal Flash Storage support. I wanted to benchmark read performance, and noticed that the system locks

Re: [PATCH fix] scsi_lib: make sure scsi_request.sense valid

2019-01-17 Thread Douglas Gilbert
On 2019-01-17 4:48 p.m., Bart Van Assche wrote: On Thu, 2019-01-17 at 16:05 -0500, Douglas Gilbert wrote: On 2019-01-16 8:06 p.m., Bart Van Assche wrote: On Wed, 2019-01-16 at 19:54 -0500, Douglas Gilbert wrote: On 2019-01-16 6:56 p.m., Bart Van Assche wrote: On Wed, 2019-01-16 at 10:57

Re: lk 4.20.0 sd: 'Unaligned partial completion (resid=3584, sector_sz=4096)' forever

2019-01-17 Thread Douglas Gilbert
On 2019-01-16 8:57 p.m., Martin K. Petersen wrote: Doug, except the I_T nexus on which the command causing the change was received with the additional sense code set to CAPACITY DATA HAS CHANGED." So seeing I'm using the I_T nexus that sent the FORMAT UNIT, then no Unit Attention is expected,

Re: [ANNOUNCE] v4 sg driver: ready for testing

2019-01-16 Thread Douglas Gilbert
ities in sg3_utils-1.45 (beta, revision 807) at the top of this page: http://sg.danny.cz/sg/index.html Doug Gilbert *** the reason for the split is the tree wide change to the access_ok() function. On 2018-12-25 2:39 a.m., Douglas Gilbert wrote: There is an update to the sg v4 driver

Re: [PATCH fix] scsi_lib: make sure scsi_request.sense valid

2019-01-16 Thread Douglas Gilbert
On 2019-01-16 6:56 p.m., Bart Van Assche wrote: On Wed, 2019-01-16 at 10:57 -0500, Douglas Gilbert wrote: The block layer assumes scsi_request:sense is always a valid pointer. This is set up once in scsi_mq_init_request() and the containing scsi_cmnd object is used often, being re-initialized

Re: lk 4.20.0 sd: 'Unaligned partial completion (resid=3584, sector_sz=4096)' forever

2019-01-16 Thread Douglas Gilbert
On 2019-01-16 11:55 a.m., Douglas Gilbert wrote: On 2019-01-16 11:44 a.m., Martin K. Petersen wrote: Doug, If these types of disks (ones that can fast format between 512 and 4096 bytes) are not out in the field yet, they soon will be. This problem requires a hard reboot (i.e. hold you finger

Re: lk 4.20.0 sd: 'Unaligned partial completion (resid=3584, sector_sz=4096)' forever

2019-01-16 Thread Douglas Gilbert
On 2019-01-16 11:44 a.m., Martin K. Petersen wrote: Doug, If these types of disks (ones that can fast format between 512 and 4096 bytes) are not out in the field yet, they soon will be. This problem requires a hard reboot (i.e. hold you finger on the power button for 5-10 seconds). Sad

Re: lk 4.20.0 sd: 'Unaligned partial completion (resid=3584, sector_sz=4096)' forever

2019-01-16 Thread Douglas Gilbert
Ping If these types of disks (ones that can fast format between 512 and 4096 bytes) are not out in the field yet, they soon will be. This problem requires a hard reboot (i.e. hold you finger on the power button for 5-10 seconds). Sad Doug Gilbert On 2018-12-24 9:19 p.m., Douglas

Re: [PATCH] sd: skip non-removable devices in sd_check_events()

2019-01-16 Thread Douglas Gilbert
On 2019-01-16 5:58 a.m., Martin Wilck wrote: On Wed, 2019-01-16 at 11:32 +0100, Hannes Reinecke wrote: On 1/16/19 11:26 AM, Martin Wilck wrote: On Wed, 2019-01-16 at 08:35 +0100, Hannes Reinecke wrote: If the device is _not_ removable we should not start the event poller as the media will not

[PATCH fix] scsi_lib: make sure scsi_request.sense valid

2019-01-16 Thread Douglas Gilbert
else. And that is what bidi handling does in scsi_mq_prep_fn(). The result is an oops at some later time when the partly overwritten object is re-used. The overwrite is from d285203cf647d but 'git blame' does not show removed code, so that commit may not be the culprit. Signed-off-by: Dougl

Re: [PATCH v2 4/7] sd: Create helper functions for read/write commands

2019-01-15 Thread Douglas Gilbert
On 2019-01-15 10:23 p.m., Bart Van Assche wrote: On 1/15/19 6:34 PM, Douglas Gilbert wrote: On 2019-01-15 7:50 p.m., Bart Van Assche wrote: +static blk_status_t sd_setup_rw6_cmnd(struct scsi_cmnd *cmd, bool write, +  sector_t lba, unsigned int nr_blocks

Re: [PATCH v2 4/7] sd: Create helper functions for read/write commands

2019-01-15 Thread Douglas Gilbert
See below. On 2019-01-15 7:50 p.m., Bart Van Assche wrote: From: "Martin K. Petersen" Create a helper function for each of the 6, 10, 16 and 32-byte READ/WRITE variants and use those when setting up reads and writes. Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen [ bvanassch

Re: [PATCH] scsi: wd719x Replace GFP_KERNEL with GFP_ATOMIC in wd719x_chip_init

2019-01-14 Thread Douglas Gilbert
On 2019-01-14 10:29 a.m., Christoph Hellwig wrote: On Mon, Jan 14, 2019 at 11:24:49PM +0800, wangbo wrote: wd719x_host_reset get spinlock first then call wd719x_chip_init, so replace GFP_KERNEL with GFP_ATOMIC in wd719x_chip_init. Please move the allocation outside the lock instead. GFP_ATOMI

Re: Kernel v5.0, scsi_debug and libiscsi

2019-01-11 Thread Douglas Gilbert
On 2019-01-10 6:22 p.m., Bart Van Assche wrote: Hi Doug, Have you ever tried to run the libiscsi conformance tests against the scsi_debug driver? I tried the following: modprobe scsi_debug delay=0 max_luns=3 dev=$(for f in /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/[0-9]*/block/

Re: Kernel v5.0, scsi_debug and libiscsi

2019-01-10 Thread Douglas Gilbert
On 2019-01-10 10:31 p.m., Bart Van Assche wrote: On 1/10/19 6:09 PM, Douglas Gilbert wrote: On 2019-01-10 6:22 p.m., Bart Van Assche wrote: Hi Doug, Have you ever tried to run the libiscsi conformance tests against the scsi_debug driver? I tried the following: modprobe scsi_debug delay=0

Re: Kernel v5.0, scsi_debug and libiscsi

2019-01-10 Thread Douglas Gilbert
On 2019-01-10 6:22 p.m., Bart Van Assche wrote: Hi Doug, Have you ever tried to run the libiscsi conformance tests against the scsi_debug driver? I tried the following: modprobe scsi_debug delay=0 max_luns=3 dev=$(for f in /sys/bus/pseudo/drivers/scsi_debug/adapter*/host*/target*/[0-9]*/block/

Re: [PATCH v5] scsi: add debugfs directories

2019-01-09 Thread Douglas Gilbert
On 2019-01-09 7:24 a.m., John Garry wrote: On 09/01/2019 09:17, John Garry wrote: On 08/01/2019 04:00, Douglas Gilbert wrote: Add a top level "scsi" directory in debugfs (usually at /sys/kernel/debug/scsi) with two subdirectories: "uld" and "lld". The idea is to

Re: [PATCH v5] scsi: add debugfs directories

2019-01-09 Thread Douglas Gilbert
On 2019-01-09 4:17 a.m., John Garry wrote: On 08/01/2019 04:00, Douglas Gilbert wrote: Add a top level "scsi" directory in debugfs (usually at /sys/kernel/debug/scsi) with two subdirectories: "uld" and "lld". The idea is to place mid-level related 'knobs&#x

[PATCH v5] scsi: add debugfs directories

2019-01-07 Thread Douglas Gilbert
since v2: - export symbols so other driver can use them [John Garry] - make prior code conditional on CONFIG_BLK_DEBUG_FS Changes since v1: - tweak Makefile to keep kbuild test robot happier Signed-off-by: Douglas Gilbert --- My intention is to add a /sys/kernel/debug/scsi/uld/sg directory cont

Re: [PATCH v4] scsi: add debugfs directories

2019-01-07 Thread Douglas Gilbert
John, See response below. On 2019-01-07 10:38 a.m., John Garry wrote: On 05/01/2019 01:52, Douglas Gilbert wrote: Add a top level "scsi" directory in debugfs (usually at /sys/kernel/debugfs/scsi) with two subdirectories: "uld" and "lld". The idea is to place mi

[PATCH v4] scsi: add debugfs directories

2019-01-04 Thread Douglas Gilbert
er driver can use them [John Garry] - make prior code conditional on CONFIG_BLK_DEBUG_FS Changes since v1: - tweak Makefile to keep kbuild test robot happier Signed-off-by: Douglas Gilbert --- My intention is to add a /sys/kernel/debug/scsi/uld/sg directory containing at least a pseudo file called de

Re: [PATCH v3] scsi: add debugfs directories

2019-01-04 Thread Douglas Gilbert
On 2019-01-04 11:52 a.m., James Bottomley wrote: On Fri, 2019-01-04 at 11:18 -0500, Douglas Gilbert wrote: Add a top level "scsi" directory in debugfs (usually at /sys/kernel/debugfs/scsi) with two subdirectories: "uld" and "lld". The idea is to place mid-leve

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