aboutsummaryrefslogtreecommitdiff
path: root/drivers/target/loopback/tcm_loop.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-05scsi: target: tcm_loop: Make tcm_loop_lld_bus constRicardo B. Marliere1-1/+1
Now that the driver core can properly handle constant struct bus_type, move the tcm_loop_lld_bus variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Greg Kroah-Hartman <[email protected]> Suggested-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Ricardo B. Marliere <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2023-10-13scsi: target: Allow userspace to request direct submissionsMike Christie1-1/+1
This allows userspace to request the fabric drivers do direct submissions if they support it. With the new device file, submit_type, users can write 0 - 2 to control how commands are submitted to the backend: 0 - TARGET_FABRIC_DEFAULT_SUBMIT - LIO will use the fabric's default submission type. This is the default for compat. 1 - TARGET_DIRECT_SUBMIT - LIO will submit the cmd to the backend from the calling context if the fabric the cmd was received on supports it, else it will use the fabric's default type. 2 - TARGET_QUEUE_SUBMIT - LIO will queue the cmd to the LIO submission workqueue which will pass it to the backend. When using an NVMe drive and vhost-scsi with direct submission we see around a 20% improvement in 4K I/Os: fio jobs 1 2 4 8 10 -------------------------------------------------- defer 94K 190K 394K 770K 890K direct 128K 252K 488K 950K - And when using the queueing mode, we now no longer see issues like where the iSCSI tx thread is blocked in the block layer waiting on a tag so it can't respond to a nop or perform I/Os for other LUs. Signed-off-by: Mike Christie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-10-13scsi: target: Have drivers report if they support direct submissionsMike Christie1-0/+2
In some cases, like with multiple LUN targets or where the target has to respond to transport level requests from the receiving context it can be better to defer cmd submission to a helper thread. If the backend driver blocks on something like request/tag allocation it can block the entire target submission path and other LUs and transport IO on that session. In other cases like single LUN targets with storage that can support all the commands that the target can queue, then it's best to submit the cmd to the backend from the target's cmd receiving context. Subsequent commits will allow the user to config what they prefer, but drivers like loop can't directly submit because they can be called from a context that can't sleep. And, drivers like vhost-scsi can support direct submission, but need to keep their default behavior of deferring execution to avoid possible regressions where the backend can block. Make the drivers tell LIO core if they support direct submissions and their current default, so we can prevent users from misconfiguring the system and initialize devices correctly. Signed-off-by: Mike Christie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-03-24scsi: target: tcm_loop: Remove redundant driver match functionLizhe1-7/+0
If there is no driver match function, the driver core assumes that each candidate pair (driver, device) matches. See driver_match_device(). pseudo_lld_bus_match() always returns 1 and is therefore equivalent to not registering a match function. Remove it. Signed-off-by: Lizhe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-03-24Merge patch series "Constify most SCSI host templates"Martin K. Petersen1-1/+1
Bart Van Assche <[email protected]> says: It helps humans and the compiler if it is made explicit that SCSI host templates are not modified. Hence this patch series that constifies most SCSI host templates. Please consider this patch series for the next merge window. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-03-24scsi: target: tcm-loop: Declare SCSI host template constBart Van Assche1-1/+1
Make it explicit that the SCSI host template is not modified. Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2023-03-16scsi: target: loop: Remove default fabric ops calloutsDmitry Bogdanov1-41/+0
Remove callouts that are identical to the default implementations in TCM Core. Signed-off-by: Dmitry Bogdanov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2022-11-17scsi: target: tcm_loop: Fix possible name leak in tcm_loop_setup_hba_bus()Yang Yingliang1-1/+2
If device_register() fails in tcm_loop_setup_hba_bus(), the name allocated by dev_set_name() need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup(). The 'tl_hba' will be freed in tcm_loop_release_adapter(), so it don't need goto error label in this case. Fixes: 3703b2c5d041 ("[SCSI] tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module") Signed-off-by: Yang Yingliang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2021-10-16scsi: target: tcm_loop: Call scsi_done() directlyBart Van Assche1-2/+2
Conditional statements are faster than indirect calls. Hence call scsi_done() directly. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2021-09-02Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds1-4/+4
Pull SCSI updates from James Bottomley: "This series consists of the usual driver updates (ufs, qla2xxx, target, smartpqi, lpfc, mpt3sas). The core change causing the most churn was replacing the command request field request with a macro, allowing us to offset map to it and remove the redundant field; the same was also done for the tag field. The most impactful change is the final removal of scsi_ioctl, which has been deprecated for over a decade" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (293 commits) scsi: ufs: Fix ufshcd_request_sense_async() for Samsung KLUFG8RHDA-B2D1 scsi: ufs: ufs-exynos: Fix static checker warning scsi: mpt3sas: Use the proper SCSI midlayer interfaces for PI scsi: lpfc: Use the proper SCSI midlayer interfaces for PI scsi: lpfc: Copyright updates for 14.0.0.1 patches scsi: lpfc: Update lpfc version to 14.0.0.1 scsi: lpfc: Add bsg support for retrieving adapter cmf data scsi: lpfc: Add cmf_info sysfs entry scsi: lpfc: Add debugfs support for cm framework buffers scsi: lpfc: Add support for maintaining the cm statistics buffer scsi: lpfc: Add rx monitoring statistics scsi: lpfc: Add support for the CM framework scsi: lpfc: Add cmfsync WQE support scsi: lpfc: Add support for cm enablement buffer scsi: lpfc: Add cm statistics buffer support scsi: lpfc: Add EDC ELS support scsi: lpfc: Expand FPIN and RDF receive logging scsi: lpfc: Add MIB feature enablement support scsi: lpfc: Add SET_HOST_DATA mbox cmd to pass date/time info to firmware scsi: fc: Add EDC ELS definition ...
2021-08-11scsi: tcm_loop: Use scsi_cmd_to_rq() instead of scsi_cmnd.requestBart Van Assche1-2/+2
Prepare for removal of the request pointer by using scsi_cmd_to_rq() instead. This patch does not change any functionality. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2021-07-27scsi: target: Remove redundant assignment to variable retColin Ian King1-2/+2
The variable ret is being initialized with a value that is never read, the assignment is redundant and can be removed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Addresses-Coverity: ("Unused value")
2021-07-21bus: Make remove callback return voidUwe Kleine-König1-3/+2
The driver core ignores the return value of this callback because there is only little it can do when a device disappears. This is the final bit of a long lasting cleanup quest where several buses were converted to also return void from their remove callback. Additionally some resource leaks were fixed that were caused by drivers returning an error code in the expectation that the driver won't go away. With struct bus_type::remove returning void it's prevented that newly implemented buses return an ignored error code and so don't anticipate wrong expectations for driver authors. Reviewed-by: Tom Rix <[email protected]> (For fpga) Reviewed-by: Mathieu Poirier <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> (For drivers/s390 and drivers/vfio) Acked-by: Russell King (Oracle) <[email protected]> (For ARM, Amba and related parts) Acked-by: Mark Brown <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> (for sunxi-rsb) Acked-by: Pali Rohár <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> (for media) Acked-by: Hans de Goede <[email protected]> (For drivers/platform) Acked-by: Alexandre Belloni <[email protected]> Acked-By: Vinod Koul <[email protected]> Acked-by: Juergen Gross <[email protected]> (For xen) Acked-by: Lee Jones <[email protected]> (For mfd) Acked-by: Johannes Thumshirn <[email protected]> (For mcb) Acked-by: Johan Hovold <[email protected]> Acked-by: Srinivas Kandagatla <[email protected]> (For slimbus) Acked-by: Kirti Wankhede <[email protected]> (For vfio) Acked-by: Maximilian Luz <[email protected]> Acked-by: Heikki Krogerus <[email protected]> (For ulpi and typec) Acked-by: Samuel Iglesias Gonsálvez <[email protected]> (For ipack) Acked-by: Geoff Levand <[email protected]> (For ps3) Acked-by: Yehezkel Bernat <[email protected]> (For thunderbolt) Acked-by: Alexander Shishkin <[email protected]> (For intel_th) Acked-by: Dominik Brodowski <[email protected]> (For pcmcia) Acked-by: Rafael J. Wysocki <[email protected]> (For ACPI) Acked-by: Bjorn Andersson <[email protected]> (rpmsg and apr) Acked-by: Srinivas Pandruvada <[email protected]> (For intel-ish-hid) Acked-by: Dan Williams <[email protected]> (For CXL, DAX, and NVDIMM) Acked-by: William Breathitt Gray <[email protected]> (For isa) Acked-by: Stefan Richter <[email protected]> (For firewire) Acked-by: Benjamin Tissoires <[email protected]> (For hid) Acked-by: Thorsten Scherer <[email protected]> (For siox) Acked-by: Sven Van Asbroeck <[email protected]> (For anybuss) Acked-by: Ulf Hansson <[email protected]> (For MMC) Acked-by: Wolfram Sang <[email protected]> # for I2C Acked-by: Sudeep Holla <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Finn Thain <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-05-31scsi: core: Kill DRIVER_SENSEHannes Reinecke1-1/+0
Replace the check for DRIVER_SENSE with a check for scsi_status_is_check_condition(). Audit all callsites to ensure the SAM status is set correctly. For backwards compability move the DRIVER_SENSE definition to sg.h, and update sg, bsg, and scsi_ioctl to set the DRIVER_SENSE driver_status whenever SAM_STAT_CHECK_CONDITION is present. [mkp: fix zeroday srp warning] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> fix
2021-03-04scsi: target: tcm_loop: Use LIO wq cmd submission helperMike Christie1-16/+6
Convert loop to use the LIO wq cmd submission helper. Link: https://lore.kernel.org/r/[email protected] Tested-by: Laurence Oberman <[email protected]> Reviewed-by: Bodo Stroesser <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2021-03-04scsi: target: tcm_loop: Use block cmd allocator for se_cmdsMike Christie1-11/+8
Make tcm_loop use the block layer cmd allocator for se_cmds instead of using the tcm_loop_cmd_cache. In the future when we can use the host tags for internal requests like TMFs we can completely kill the tcm_loop_cmd_cache. Link: https://lore.kernel.org/r/[email protected] Tested-by: Laurence Oberman <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2021-03-04scsi: target: core: Add gfp_t arg to target_cmd_init_cdb()Mike Christie1-1/+2
tcm_loop could be used like a normal block device, so we can't use GFP_KERNEL and should use GFP_NOIO. This adds a gfp_t arg to target_cmd_init_cdb() and converts the users. For every driver but loop GFP_KERNEL is kept. This will also be useful in subsequent patches where loop needs to do target_submit_prep() from interrupt context to get a ref to the se_device, and so it will need to use GFP_ATOMIC. Link: https://lore.kernel.org/r/[email protected] Tested-by: Laurence Oberman <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2021-03-04scsi: target: tcm_loop: Convert to new submission APIMike Christie1-12/+10
target_submit_cmd_map_sgls() is being removed, so convert loop to the new submission API. Even though loop does its own shutdown sync, this has loop use target_init_cmd()/target_submit_prep()/target_submit() since it needed to map sgls and in the next patches it will use the API to use LIO's workqueue. Link: https://lore.kernel.org/r/[email protected] Tested-by: Laurence Oberman <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-11-04scsi: tcm_loop: Allow queues, can_queue and cmd_per_lun to be settableMike Christie1-2/+12
Make can_queue, nr_hw_queues and cmd_per_lun settable by the user instead of hard coding them. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2020-05-11scsi: target: loopback: Fix READ with data and sensebytesBodo Stroesser1-21/+15
We use tcm_loop with tape emulations running on tcmu. In case application reads a short tape block with a longer READ, or a long tape block with a short READ, according to SCC spec data has to be tranferred _and_ sensebytes with ILI set and information field containing the residual count. Similar problem also exists when using fixed block size in READ. Up to now tcm_loop is not prepared to handle sensebytes if input data is provided, as in tcm_loop_queue_data_in() it only sets SAM_STAT_GOOD and, if necessary, the residual count. To fix the bug, the same handling for sensebytes as present in tcm_loop_queue_status() must be done in tcm_loop_queue_data_in() also. After adding this handling, the two function now are nearly identical, so I created a single function with two wrappers. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bodo Stroesser <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-02-05scsi: remove bidirectional command supportChristoph Hellwig1-15/+0
No real need for bidi support once the OSD code is gone. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-02-04scsi: target/core: Remove the write_pending_status() callback functionBart Van Assche1-6/+0
Due to the patch that makes TMF handling synchronous the write_pending_status() callback function is no longer called. Hence remove it. Acked-by: Felipe Balbi <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Andy Grover <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Bryant G. Ly <[email protected]> Cc: Nicholas Bellinger <[email protected]> Cc: Mike Christie <[email protected]> Cc: Himanshu Madhani <[email protected]> Cc: Quinn Tran <[email protected]> Cc: Saurav Kashyap <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Cc: Juergen Gross <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-12-18scsi: remove the use_clustering flagChristoph Hellwig1-1/+1
The same effects can be achieved by setting the dma_boundary to PAGE_SIZE - 1 and the max_segment_size to PAGE_SIZE, so shift those settings into the drivers. Note that in many cases the setting might be bogus, but this keeps the status quo. [mkp: fix myrs and myrb] Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-11-28scsi: target: replace fabric_ops.name with fabric_aliasDavid Disseldorp1-1/+0
iscsi_target_mod is the only LIO fabric where fabric_ops.name differs from the fabric_ops.fabric_name string. fabric_ops.name is used when matching target/$fabric ConfigFS create paths, so rename it .fabric_alias and fallback to target/$fabric vs .fabric_name comparison if .fabric_alias isn't initialised. iscsi_target_mod is the only fabric module to set .fabric_alias . All other fabric modules rely on .fabric_name matching and can drop the duplicate string. Signed-off-by: David Disseldorp <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-11-28scsi: target: drop unnecessary get_fabric_name() accessor from fabric_opsDavid Disseldorp1-6/+1
All fabrics return a const string. In all cases *except* iSCSI the get_fabric_name() string matches fabric_ops.name. Both fabric_ops.get_fabric_name() and fabric_ops.name are user-facing, with the former being used for PR/ALUA state and the latter for ConfigFS (config/target/$name), so we unfortunately need to keep both strings around for now. Replace the useless .get_fabric_name() accessor function with a const string fabric_name member variable. Signed-off-by: David Disseldorp <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-08-02scsi: target: loop, usb, vhost, xen: use target_remove_sessionMike Christie1-1/+1
This converts drivers that were only calling transport_deregister_session to use target_remove_session. The calling of transport_deregister_session_configfs via target_remove_session for these types of drivers is ok, because they were not exporting info from fields like sess_acl_list, sess->se_tpg and sess->fabric_sess_ptr from configfs accessible functions, so they will see no difference. Signed-off-by: Mike Christie <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Andrzej Pietrasiewicz <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Cc: Juergen Gross <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-08-02scsi: target: rename target_alloc_sessionMike Christie1-1/+1
Rename target_alloc_session to target_setup_session to avoid confusion with the other transport session allocation function that only allocates the session and because the target_alloc_session does so much more. It allocates the session, sets up the nacl and registers the session. The next patch will then add a remove function to match the setup in this one, so it should make sense for all drivers, except iscsi, to just call those 2 functions to setup and remove a session. iscsi will continue to be the odd driver. Signed-off-by: Mike Christie <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: Chris Boot <[email protected]> Cc: Bryant G. Ly <[email protected]> Cc: Michael Cyr <[email protected]> Cc: <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Andrzej Pietrasiewicz <[email protected]> Cc: Michael S. Tsirkin <[email protected]> Cc: Juergen Gross <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-07-02scsi: target/tcm_loop: Avoid that static checkers warn about dead codeBart Van Assche1-4/+1
The code under the "release:" label can only be reached after se_cmd has been set to a non-NULL value. Hence remove the if (se_cmd) test. Keep the else-part since calling transport_generic_free_cmd() is not necessary for a command that has not been submitted to the core. Reported-by: Dan Carpenter <[email protected]> Fixes: 4d3895d5ea43 ("target/tcm_loop: Merge struct tcm_loop_cmd and struct tcm_loop_tmr") Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Mike Christie <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-07-02scsi: target: Remove second argument from fabric_make_tpg()Bart Van Assche1-4/+2
Since most target drivers do not use the second fabric_make_tpg() argument ("group") and since it is trivial to derive the group pointer from the wwn pointer, do not pass the group pointer to fabric_make_tpg(). Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Mike Christie <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2018-03-08target/tcm_loop: Use blk_queue_flag_set()Bart Van Assche1-1/+1
Use blk_queue_flag_set() instead of open-coding this function. Cc: Nicholas A. Bellinger <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Ming Lei <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2018-01-12target: tcm_loop: Use seq_puts() in tcm_loop_show_info()Markus Elfring1-1/+1
The script "checkpatch.pl" pointed information out like the following. WARNING: Prefer seq_puts to seq_printf Thus fix the affected source code place. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2018-01-12target: tcm_loop: Delete an unnecessary return statement in ↵Markus Elfring1-1/+0
tcm_loop_submission_work() The script "checkpatch.pl" pointed information out like the following. WARNING: void function return statements are not generally useful Thus remove such a statement in the affected function. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2018-01-12target: tcm_loop: Delete two unnecessary variable initialisations in ↵Markus Elfring1-2/+2
tcm_loop_issue_tmr() The variables "se_cmd" and "tl_cmd" will eventually be set to appropriate pointers a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2018-01-12target: tcm_loop: Combine substrings for 26 messagesMarkus Elfring1-68/+52
The script "checkpatch.pl" pointed information out like the following. WARNING: quoted string split across lines Thus fix the affected source code places. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2018-01-12target: tcm_loop: Improve a size determination in two functionsMarkus Elfring1-2/+2
Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2018-01-12target: tcm_loop: Delete an error message for a failed memory allocation in ↵Markus Elfring1-10/+4
four functions Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2017-07-06target/tcm_loop: Make TMF processing slightly fasterBart Van Assche1-16/+9
Target drivers must guarantee that struct se_cmd and struct se_tmr_req exist as long as target_tmr_work() is in progress. This is why the tcm_loop driver today passes 1 as second argument to transport_generic_free_cmd() from inside the TMF code. Instead of making the TMF code wait, make the TMF code obtain two references (SCF_ACK_KREF) and drop one reference from inside the .check_stop_free() callback. Signed-off-by: Bart Van Assche <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: David Disseldorp <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2017-07-06target/tcm_loop: Use target_submit_tmr() instead of open-coding this functionBart Van Assche1-29/+3
Use target_submit_tmr() instead of open-coding this function. The only functional change is that TMFs are now added to sess_cmd_list, something the current code does not do. This behavior change is a bug fix because it makes LUN RESETs wait for other TMFs that are in progress for the same LUN. Signed-off-by: Bart Van Assche <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: David Disseldorp <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2017-07-06target/tcm_loop: Replace a waitqueue and a counter by a completionBart Van Assche1-8/+4
This patch simplifies the implementation of the tcm_loop driver but does not change its behavior. Signed-off-by: Bart Van Assche <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: David Disseldorp <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2017-07-06target/tcm_loop: Merge struct tcm_loop_cmd and struct tcm_loop_tmrBart Van Assche1-14/+8
This patch simplifies the tcm_loop implementation but does not change any functionality. Signed-off-by: Bart Van Assche <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: David Disseldorp <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2016-05-10target: make close_session optionalChristoph Hellwig1-6/+0
Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2016-05-10target: make ->shutdown_session optionalChristoph Hellwig1-6/+0
Turns out the template and thus many drivers got the return value wrong: 0 means the fabrics driver needs to put a session reference, which no driver except for the iSCSI target drivers did. Fortunately none of these drivers supports explicit Node ACLs, so the bug was harmless. Even without that only qla2xxx and iscsi every did real work in shutdown_session, so get rid of the boilerplate code in all other drivers. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2016-03-10target: Convert demo-mode only drivers to target_alloc_sessionChristoph Hellwig1-28/+18
This patch converts existing loopback, usb-gadget, and xen-scsiback demo-mode only fabric drivers to use the new target_alloc_session API caller. This includes adding a new alloc_session callback for fabric driver internal nexus pointer assignments. (Fixes for early for-next nexus breakage - Dan Carpenter) Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Acked-by: Juergen Gross <[email protected]> Tested-by: Andrzej Pietrasiewicz <[email protected]> Tested-by: Chris Boot <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2015-11-29tcm_loop: Show address of tpg in configfsSheng Yang1-0/+14
In the past, the scsi_host's number wasn't shown anywhere, user have to depends on vpg_83 to find the block device, which is also depends on backstore implementation. It's better for tcm_loop to provide necessary straightforward information on locate the block device it created. This patch would help to locate the block device created by tcm_loop. The address would be shown at e.g. /sys/kernel/config/target/loopback/naa.60014059436855c1/tpgt_1/address which would looks like "2:0:1", and the lun number can be found at "/tpgt_1/lun/lun_0". Altogether they formated the scsi address of device as "2:0:1:0", which can be used to locate the device easily through 'lsscsi'. (Update to >= v4.4-rc1 configfs attribute usage - nab) Signed-off-by: Sheng Yang <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2015-11-13Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds1-1/+0
Pull final round of SCSI updates from James Bottomley: "Sorry for the delay in this patch which was mostly caused by getting the merger of the mpt2/mpt3sas driver, which was seen as an essential item of maintenance work to do before the drivers diverge too much. Unfortunately, this caused a compile failure (detected by linux-next), which then had to be fixed up and incubated. In addition to the mpt2/3sas rework, there are updates from pm80xx, lpfc, bnx2fc, hpsa, ipr, aacraid, megaraid_sas, storvsc and ufs plus an assortment of changes including some year 2038 issues, a fix for a remove before detach issue in some drivers and a couple of other minor issues" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (141 commits) mpt3sas: fix inline markers on non inline function declarations sd: Clear PS bit before Mode Select. ibmvscsi: set max_lun to 32 ibmvscsi: display default value for max_id, max_lun and max_channel. mptfusion: don't allow negative bytes in kbuf_alloc_2_sgl() scsi: pmcraid: replace struct timeval with ktime_get_real_seconds() mvumi: 64bit value for seconds_since1970 be2iscsi: Fix bogus WARN_ON length check scsi_scan: don't dump trace when scsi_prep_async_scan() is called twice mpt3sas: Bump mpt3sas driver version to 09.102.00.00 mpt3sas: Single driver module which supports both SAS 2.0 & SAS 3.0 HBAs mpt2sas, mpt3sas: Update the driver versions mpt3sas: setpci reset kernel oops fix mpt3sas: Added OEM Gen2 PnP ID branding names mpt3sas: Refcount fw_events and fix unsafe list usage mpt3sas: Refcount sas_device objects and fix unsafe list usage mpt3sas: sysfs attribute to report Backup Rail Monitor Status mpt3sas: Ported WarpDrive product SSS6200 support mpt3sas: fix for driver fails EEH, recovery from injected pci bus error mpt3sas: Manage MSI-X vectors according to HBA device type ...
2015-11-09scsi: use host wide tags by defaultChristoph Hellwig1-1/+0
This patch changes the !blk-mq path to the same defaults as the blk-mq I/O path by always enabling block tagging, and always using host wide tags. We've had blk-mq available for a few releases so bugs with this mode should have been ironed out, and this ensures we get better coverage of over tagging setup over different configs. Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Jens Axboe <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: James Bottomley <[email protected]>
2015-10-13target: use per-attribute show and store methodsChristoph Hellwig1-34/+26
This also allows to remove the target-specific old configfs macros, and gets rid of the target_core_fabric_configfs.h header which only had one function declaration left that could be moved to a better place. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Nicholas Bellinger <[email protected]> Acked-by: Nicholas Bellinger <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2015-07-23tcm_loop: Send I_T_NEXUS_LOSS_OCCURRED UAHannes Reinecke1-0/+5
If the virtual SAS link is set to 'offline' we should be queueing an I_T_NEXUS_LOSS_OCCURRED UA. Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2015-07-23tcm_loop: Remove SAS vestigiesHannes Reinecke1-8/+9
tcm_loop is able to emulate several protocols, so remove last vestigies of the SAS protocol. Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
2015-06-15target: use 64-bit LUNsHannes Reinecke1-2/+2
As we're now using a list to hold the LUNs the target core can now converted to use 64-bit LUNs internally. Signed-off-by: Hannes Reinecke <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>