11 May, 2016
4 commits
-
For reported SAS addresses replace fake IEEE registered NAAs (5) with
locally assigned NAAs (3).Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinecke
Reviewed-by: Bart Van Assche
Signed-off-by: Martin K. Petersen -
Permit changing of a LU name from a (fake) IEEE registered NAA (5) to a
locally assigned UUID. Using a UUID (RFC 4122) for a SCSI designation
descriptor (e.g. a LU name) was added in spc5r08.pdf (a draft INCITS
standard) on 25 January 2016. Add parameter uuid_ctl to use a separate
UUID for each LU (storage device) name. Additional option for all LU
names to have the same UUID (since their storage is shared). Previous
action of using NAA identifier for LU name remains the default.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinecke
Reviewed-by: Bart Van Assche
Signed-off-by: Martin K. Petersen -
Cleanup some mode and vpd pages. Stop reporting SBC (disk) pages when
peripheral type is something else (e.g. tape). Update version
descriptors. Expand LBPRZ flag handling.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinecke
Reviewed-by: Bart Van Assche
Signed-off-by: Martin K. Petersen -
Add submit_queue parameter (minimum and default: 1; maximum: nr_cpu_ids)
that controls how many queues are built, each with their own lock and
in_use bit vector. Add statistics parameter which is default off.Signed-off-by: Douglas Gilbert
Reviewed-by: Bart Van Assche
Signed-off-by: Martin K. Petersen
04 May, 2016
2 commits
-
Based on "[PATH V2] scsi_debug: rework resp_report_luns" patch
sent by Tomas Winkler on Thursday, 26 Feb 2015. His notes:
1. Remove duplicated boundary checks which simplify the fill-in
loop
2. Use more of scsi generic API
Replace fixed length response array a with heap allocation
allowing up to 256 normal LUNs per target.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Reviewed-by: Tomas Winkler
Reviewed-by: Bart Van Assche
Signed-off-by: Martin K. Petersen -
Use TYPE_* constants for SCSI peripheral device types instead of
numbers. Further cleanups requested by checkpatch.pl.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Reviewed-by: Bart Van Assche
Signed-off-by: Martin K. Petersen
30 Apr, 2016
7 commits
-
The most common commands in normal use are the READ and WRITE SCSI
commands. Use likely and unlikely hints along the path taken by these
commands. Rename check_readiness() to make_ua() and remove associated
dead code. Rename devInfoReg() to find_build_dev_info().Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Signed-off-by: Martin K. Petersen -
Group most defines together first; followed by struct definitions and
then table and variable definitions. Normalize all function headers.[mkp: Corrected hex value in WP/DPOFUA MODE SENSE comment]
Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Signed-off-by: Martin K. Petersen -
When a negative value was placed in the delay parameter, a tasklet was
scheduled. Change the tasklet to a work queue. Previously a delay of -1
scheduled a high priority tasklet; since there are no high priority work
queues, treat -1 like other negative values in delay and schedule a work
item.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Signed-off-by: Martin K. Petersen -
Add 'j' to delay names to make it clearer that its unit is jiffies and
to differentiate it from sdebug_ndelay whose unit is nanoseconds.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Signed-off-by: Martin K. Petersen -
The driver supports two command delay interfaces, the original one whose
unit is a jiffy, and a newer one whose unit is a nanosecond. Each had
different implementations. Keep both interfaces but simplify the
implemenation to use a single delay mechanism based on high resolution
timers.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Signed-off-by: Martin K. Petersen -
Remove logic to optionally hold host_lock while each command is
queued. Keep module and sysfs host_lock parameters for backward
compatibility. Note in module parameter description that host_lock is
ignored.Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Signed-off-by: Martin K. Petersen -
Shorten file scope static and constant names. Use more
get/put_unaligned calls to hide bit banging. Introduce
sdebug_verbose boolean to replace frequent masking of
option bit flags. Add GPL and bump version.[mkp: Use logical instead of bitwise OR for LBP VPD flags]
Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinecke
Signed-off-by: Martin K. Petersen
16 Apr, 2016
1 commit
-
Rename SCSI_MAX_SG_SEGMENTS to SG_CHUNK_SIZE, which means the amount
we fit into a single scatterlist chunk.Rename SCSI_MAX_SG_CHAIN_SEGMENTS to SG_MAX_SEGMENTS.
Will move these 2 generic definitions to scatterlist.h later.
Reviewed-by: Christoph Hellwig
Acked-by: Bart Van Assche (for ib_srp changes)
Signed-off-by: Ming Lin
Acked-by: Tejun Heo
Reviewed-by: Sagi Grimberg
Signed-off-by: Martin K. Petersen
08 Jan, 2016
1 commit
22 Dec, 2015
1 commit
-
The OPTIMAL TRANSFER LENGTH reported by scsi_debug is 64 blocks which
translates to 32KB with the default logical block size. That's much
lower than what real storage devices typically report (256KB to 1MB).Bump the optimal transfer length to 1024 blocks.
Acked-by: Douglas Gilbert
Reviewed-by: Ewan Milne
Signed-off-by: Martin K. Petersen
01 Dec, 2015
1 commit
-
Even for signed types we have to check for bigger positive value first.
Otherwise it will be never happened.Signed-off-by: Andy Shevchenko
Acked-by: Douglas Gilbert
Reviewed-by: Johannes Thumshirn
Reviewed-by: Ewan Milne
Signed-off-by: Martin K. Petersen
26 Nov, 2015
2 commits
-
do_div is the wrong way to divide a sector_t, as it is less efficient
when sector_t is 32-bit wide. With the upcoming do_div optimizations,
the kernel starts warning about this:drivers/scsi/scsi_debug.c: In function 'dif_store':
include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a castThis changes the code to use sector_div instead, which always produces
optimal code.Signed-off-by: Arnd Bergmann
Reviewed-by: Hannes Reinicke
Reviewed-by: Sagi Grimberg
Reviewed-by: Johannes Thumshirn
Signed-off-by: Martin K. Petersen -
Ruediger Meier observed a regression with the PREVENT ALLOW MEDIUM
REMOVAL command in lk 3.19:http://www.spinics.net/lists/util-linux-ng/msg11448.html
Inspection indicated the same regression with VERIFY(10).
The patch is against lk 3.19.3 and also works with lk 4.3.0 . With this
patch both commands are accepted and do nothing.ChangeLog:
- fix the lk 3.19 regression so that the PREVENT ALLOW MEDIUM REMOVAL
command is supported once again- same fix for VERIFY(10)
Signed-off-by: Douglas Gilbert
Reviewed-by: Hannes Reinicke
Reviewed-by: Ewan Milne
Signed-off-by: Martin K. Petersen
07 Sep, 2015
7 commits
-
Fixes the following warning
In function ‘resp_requests’:
drivers/scsi//scsi_debug.c:1432:15: warning: variable ‘want_dsense’ set
but not used [-Wunused-but-set-variable]
bool dsense, want_dsense;Signed-off-by: Tomas Winkler
Reviewed-by: Martin K. Petersen
Signed-off-by: James Bottomley -
The use case to report 'REPORT LUNS WLUN' described
in scsi_debug documentation didn't work because:
scsi_scan_host_selected() checks for:
lun < shost->max_lunTo fix this we set:
max_lun = SCSI_W_LUN_REPORT_LUNS + 1;Signed-off-by: Tomas Winkler
Acked-by: Douglas Gilbert
Reviewed-by: Martin K. Petersen
Signed-off-by: James Bottomley -
The function should never be called with cmnd NULL so
put a fat WARN there.
Fix also smatch wraning:
schedule_resp() warn: variable dereferenced before check 'cmnd'Signed-off-by: Tomas Winkler
Acked-by: Douglas Gilbert
Reviewed-by: Martin K. Petersen
Signed-off-by: James Bottomley -
fixes warning:
warning: no previous prototype for ‘dump_sector’Signed-off-by: Tomas Winkler
Acked-by: Douglas Gilbert
Reviewed-by: Martin K. Petersen
Signed-off-by: James Bottomley -
Signed-off-by: Tomas Winkler
Acked-by: Douglas Gilbert
Reviewed-by: Martin K. Petersen
Signed-off-by: James Bottomley -
use SCSI_W_LUN_REPORT_LUNS from scsi.h instead of localy defined
SAM2_WLUN_REPORT_LUNSSigned-off-by: Tomas Winkler
Acked-by: Douglas Gilbert
Reviewed-by: Martin K. Petersen
Signed-off-by: James Bottomley -
Use pr_fmt with both module name and __func__
Also drop few bare printk leftoversThe log format should stay pretty much intact
Signed-off-by: Tomas Winkler
Acked-by: Douglas Gilbert
Reviewed-by: Martin K. Petersen
Signed-off-by: James Bottomley
01 Jul, 2015
1 commit
-
do_device_access() takes a separate parameter to indicate the direction of
data transfer, which it used to use to select the appropriate function out
of sg_pcopy_{to,from}_buffer(). However these two functions now haveSo this patch makes it bypass these wrappers and call the underlying
function sg_copy_buffer() directly; this has the same calling style as
do_device_access() i.e. a separate direction-of-transfer parameter and no
pointers-to-const, so skipping the wrappers not only eliminates the
warning, it also make the code simpler :)[akpm@linux-foundation.org: fix very broken build]
Signed-off-by: Dave Gordon
Acked-by: Arnd Bergmann
Cc: James Bottomley
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
14 Feb, 2015
1 commit
-
printk and friends can now format bitmaps using '%*pb[l]'. cpumask
and nodemask also provide cpumask_pr_args() and nodemask_pr_args()
respectively which can be used to generate the two printf arguments
necessary to format the specified cpu/nodemask.* map_show()'s return value is too high by one and the function could
modify beyond the end of the buffer when the formatted text is long
enough.Signed-off-by: Tejun Heo
Cc: "James E.J. Bottomley"
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
12 Feb, 2015
1 commit
-
Pull first round of SCSI updates from James Bottomley:
"This is the usual grab bag of driver updates (hpsa, storvsc, mp2sas,
megaraid_sas, ses) plus an assortment of minor updates.There's also an update to ufs which adds new phy drivers and finally a
new logging infrastructure for SCSI"* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (114 commits)
scsi_logging: return void for dev_printk() functions
scsi: print single-character strings with seq_putc
scsi: merge consecutive seq_puts calls
scsi: replace seq_printf with seq_puts
aha152x: replace seq_printf with seq_puts
advansys: replace seq_printf with seq_puts
scsi: remove SPRINTF macro
sg: remove an unused variable
hpsa: Use local workqueues instead of system workqueues
hpsa: add in P840ar controller model name
hpsa: add in gen9 controller model names
hpsa: detect and report failures changing controller transport modes
hpsa: shorten the wait for the CISS doorbell mode change ack
hpsa: refactor duplicated scan completion code into a new routine
hpsa: move SG descriptor set-up out of hpsa_scatter_gather()
hpsa: do not use function pointers in fast path command submission
hpsa: print CDBs instead of kernel virtual addresses for uncommon errors
hpsa: do not use a void pointer for scsi_cmd field of struct CommandList
hpsa: return failed from device reset/abort handlers
hpsa: check for ctlr lockup after command allocation in main io path
...
23 Jan, 2015
1 commit
-
cppcheck found the following issue:
(warning) Logical conjunction always evaluates to false:
alloc_len < 4 && alloc_len > 65535...the test should be instead:
if (alloc_len < 4 || alloc_len > 65536)
This error was introduced by recent commit 38d5c8336e60bf6e53a1da9
("scsi_debug: add Report supported opcodes+tmfs; Compare and write")Signed-off-by: Colin Ian King
Acked-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig
20 Jan, 2015
1 commit
-
resp_rsup_opcodes() may get called from atomic context and would need to
use GFP_ATOMIC for allocations:[ 1237.913419] BUG: sleeping function called from invalid context at mm/slub.c:1262
[ 1237.914865] in_atomic(): 1, irqs_disabled(): 0, pid: 7556, name: trinity-c311
[ 1237.916142] 3 locks held by trinity-c311/7556:
[ 1237.916981] #0: (sb_writers#5){.+.+.+}, at: do_readv_writev (include/linux/fs.h:2346 fs/read_write.c:844)
[ 1237.919713] #1: (&of->mutex){+.+.+.}, at: kernfs_fop_write (fs/kernfs/file.c:297)
[ 1237.922626] Mutex: counter: -1 owner: trinity-c311
[ 1237.924044] #2: (s_active#51){.+.+.+}, at: kernfs_fop_write (fs/kernfs/file.c:297)
[ 1237.925960] Preemption disabled blk_execute_rq_nowait (block/blk-exec.c:95)
[ 1237.927416]
[ 1237.927680] CPU: 24 PID: 7556 Comm: trinity-c311 Not tainted 3.19.0-rc4-next-20150116-sasha-00054-g4ad498c-dirty #1744
[ 1237.929603] ffff8804fc9d8000 ffff8804d9bc3548 ffffffff9d439fb2 0000000000000000
[ 1237.931097] 0000000000000000 ffff8804d9bc3588 ffffffff9a18389a ffff8804d9bc3598
[ 1237.932466] ffffffff9a1b1715 ffffffffa15935d8 ffffffff9e6f8cb1 00000000000004ee
[ 1237.933984] Call Trace:
[ 1237.934434] dump_stack (lib/dump_stack.c:52)
[ 1237.935323] ___might_sleep (kernel/sched/core.c:7339)
[ 1237.936259] ? mark_held_locks (kernel/locking/lockdep.c:2549)
[ 1237.937293] __might_sleep (kernel/sched/core.c:7305)
[ 1237.938272] __kmalloc (mm/slub.c:1262 mm/slub.c:2419 mm/slub.c:2491 mm/slub.c:3291)
[ 1237.939137] ? resp_rsup_opcodes (include/linux/slab.h:435 drivers/scsi/scsi_debug.c:1689)
[ 1237.940173] resp_rsup_opcodes (include/linux/slab.h:435 drivers/scsi/scsi_debug.c:1689)
[ 1237.941211] ? add_host_store (drivers/scsi/scsi_debug.c:1584)
[ 1237.942261] scsi_debug_queuecommand (drivers/scsi/scsi_debug.c:5276)
[ 1237.943404] ? blk_rq_map_sg (block/blk-merge.c:254)
[ 1237.944398] ? scsi_init_sgtable (drivers/scsi/scsi_lib.c:1095)
[ 1237.945402] sdebug_queuecommand_lock_or_not (drivers/scsi/scsi_debug.c:5300)
[ 1237.946735] scsi_dispatch_cmd (drivers/scsi/scsi_lib.c:1706)
[ 1237.947720] scsi_queue_rq (drivers/scsi/scsi_lib.c:1996)
[ 1237.948687] __blk_mq_run_hw_queue (block/blk-mq.c:816)
[ 1237.949796] blk_mq_run_hw_queue (block/blk-mq.c:896)
[ 1237.950903] ? _raw_spin_unlock (./arch/x86/include/asm/preempt.h:95 include/linux/spinlock_api_smp.h:154 kernel/locking/spinlock.c:183)
[ 1237.951862] blk_mq_insert_request (block/blk-mq.c:1037)
[ 1237.952876] blk_execute_rq_nowait (block/blk-exec.c:95)
[ 1237.953981] ? lockdep_init_map (kernel/locking/lockdep.c:3034)
[ 1237.954967] blk_execute_rq (block/blk-exec.c:131)
[ 1237.955929] ? blk_rq_bio_prep (block/blk-core.c:2835)
[ 1237.956913] scsi_execute (drivers/scsi/scsi_lib.c:252)
[ 1237.957821] scsi_execute_req_flags (drivers/scsi/scsi_lib.c:281)
[ 1237.958968] scsi_report_opcode (drivers/scsi/scsi.c:956)
[ 1237.960009] sd_revalidate_disk (drivers/scsi/sd.c:2707 drivers/scsi/sd.c:2792)
[ 1237.961139] revalidate_disk (fs/block_dev.c:1081)
[ 1237.962223] sd_rescan (drivers/scsi/sd.c:1532)
[ 1237.963142] scsi_rescan_device (drivers/scsi/scsi_scan.c:1579)
[ 1237.964165] store_rescan_field (drivers/scsi/scsi_sysfs.c:672)
[ 1237.965254] dev_attr_store (drivers/base/core.c:138)
[ 1237.966319] sysfs_kf_write (fs/sysfs/file.c:131)
[ 1237.967289] kernfs_fop_write (fs/kernfs/file.c:311)
[ 1237.968274] do_readv_writev (fs/read_write.c:722 fs/read_write.c:854)
[ 1237.969295] ? __acct_update_integrals (kernel/tsacct.c:145)
[ 1237.970452] ? kernfs_fop_open (fs/kernfs/file.c:271)
[ 1237.971505] ? _raw_spin_unlock (./arch/x86/include/asm/preempt.h:95 include/linux/spinlock_api_smp.h:154 kernel/locking/spinlock.c:183)
[ 1237.972512] ? context_tracking_user_exit (include/linux/vtime.h:89 include/linux/jump_label.h:114 include/trace/events/context_tracking.h:47 kernel/context_tracking.c:140)
[ 1237.973668] ? trace_hardirqs_on_caller (kernel/locking/lockdep.c:2578 kernel/locking/lockdep.c:2625)
[ 1237.974882] ? trace_hardirqs_on (kernel/locking/lockdep.c:2633)
[ 1237.975850] vfs_writev (fs/read_write.c:893)
[ 1237.976691] SyS_writev (fs/read_write.c:926 fs/read_write.c:917)
[ 1237.977538] system_call_fastpath (arch/x86/kernel/entry_64.S:423)Signed-off-by: Sasha Levin
Acked-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig
09 Jan, 2015
2 commits
-
Accept the WRITE BUFFER command and do nothing other than
set the appropriate "microcode has been changed" UA on the LU.>From an earlier patch by Doug Gilbert.
Signed-off-by: Ewan D. Milne
Acked-by: Douglas Gilbert
Tested-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig -
Generate a REPORTED LUNS DATA HAS CHANGED Unit Attention if
sysfs "max_luns" is used to change the number of scsi_debug LUNs.
This is only done if scsi_debug_scsi_level is SPC-3 or above.
Additionally, implement SPC-4 behavior which only generates
this Unit Attention on the first LUN on the target to receive
a command after the change. This condition is cleared when
a REPORT LUNS command is received.Signed-off-by: Ewan D. Milne
Acked-by: Douglas Gilbert
Tested-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig
15 Dec, 2014
3 commits
-
This eliminates a superfluous log message when the capacity is changed:
"check_readiness: unexpected unit attention code=3"
Signed-off-by: Ewan D. Milne
Acked-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig -
All other traversals of the sdebug_host_list take the lock.
Signed-off-by: Ewan D. Milne
Acked-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig -
Kernel build tools pointed out a memory leak so that has been
fixed and its error paths strengthened with a goto. Testing
showed compare and write was only working for lba=0; correcting
the length of the LBA field fixed that.Signed-off-by: Douglas Gilbert
Reviewed-by: Ewan D. Milne
Signed-off-by: Christoph Hellwig
04 Dec, 2014
2 commits
-
For SPI drivers use the message definitions from scsi.h, and for target
drivers introduce a new TCM_*_TAG namespace.Signed-off-by: Christoph Hellwig
Reviewed-by: Bart Van Assche
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com -
Since we got rid of ordered tag support in 2010 the prime use case of
switching on and off ordered tags has been obsolete. The other function
of enabling/disabling tagging entirely has only been correctly implemented
by the 53c700 driver and isn't generally useful.Signed-off-by: Christoph Hellwig
Reviewed-by: Bart Van Assche
Reviewed-by: Martin K. Petersen
25 Nov, 2014
2 commits
-
The Report supported operation codes command is very closely integrated
into the table driven parser and very useful for testing it. Its cdb
masks form the basis of the 'strict' parameter's checks. The Report
supported TMFs command is a simple extension. The Compare and write
command may even be useful, as it should be atomic due to the read-write
lock that the driver uses on its backing store (ram).Signed-off-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig -
The existing 'big switch' parser in queuecommand() is changed to
a table driven parser. The old and new queuecommand() were moved
in the source so diff would not shuffle them. Apart from the new
tables most other changes are refactoring existing response code
to be more easily called out of the table parser. The 'strict'
parameter is added so that cdb_s can be checked for non-zero
values in parts of the cdb that are reserved. Some other changes
include: tweak request sense response when D_SENSE differs; support
NDOB in Write Same(16); and fix crash in Get LBA Status when LBP
was inactive.Signed-off-by: Douglas Gilbert
Signed-off-by: Christoph Hellwig