06 Dec, 2011

2 commits

  • And use a SCF_FUA flag instead.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • This patch removes legacy usage of PYX_TRANSPORT_* return codes in a number
    of locations and addresses cases where transport_generic_request_failure()
    was returning the incorrect sense upon CHECK_CONDITION status after the
    v3.1 converson to use errno return codes.

    This includes the conversion of transport_generic_request_failure() to
    process cmd->scsi_sense_reason and handle extra TCM_RESERVATION_CONFLICT
    before calling transport_send_check_condition_and_sense() to queue up
    response status. It also drops PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES legacy
    usgae, and returns TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE w/ a response
    for these cases.

    transport_generic_allocate_tasks(), transport_generic_new_cmd(), backend
    SCF_SCSI_DATA_SG_IO_CDB ->do_task(), and emulated ->execute_task() have
    all been updated to set se_cmd->scsi_sense_reason and return errno codes
    universally upon failure. This includes cmd->scsi_sense_reason assignment
    in target_core_alua.c, target_core_pr.c and target_core_cdb.c emulation code.

    Finally it updates fabric modules to remove the legacy usage, and for
    TFO->new_cmd_map() callers forwards return values outside of fabric code.
    iscsi-target has also been updated to remove a handful of special cases
    related to the cleanup and signaling QUEUE_FULL handling w/ ft_write_pending()

    (v2: Drop extra SCF_SCSI_CDB_EXCEPTION check during failure from
    transport_generic_new_cmd, and re-add missing task->task_error_status
    assignment in transport_complete_task)

    Cc: Christoph Hellwig
    Cc: stable@kernel.org
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

01 Nov, 2011

1 commit


24 Oct, 2011

5 commits


11 Oct, 2011

1 commit


22 Jul, 2011

9 commits

  • This patch breaks up the ->map_task_SG() backend call into two seperate
    ->map_control_SG() and ->map_data_SG() in order to better address
    IBLOCK and pSCSI. IBLOCK only allocates bios for ->map_data_SG(), and
    pSCSI will allocate a struct request for both cases.

    This patch fixes incorrect usage of ->map_task_SG() for all se_cmd descriptors
    in transport_generic_new_cmd() by moving the call into it's proper location
    directly inside of transport_allocate_data_tasks()

    Reported-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch contains the squashed version of forth round series cleanups
    from Andy and Christoph following the post heavy lifting in the preceeding:
    'Eliminate usage of struct se_mem' and 'Make all control CDBs scatter-gather'
    changes. This also includes a conversion of target core and the v3.0
    mainline fabric modules (loopback and tcm_fc) to use pr_debug and the
    CONFIG_DYNAMIC_DEBUG infrastructure!

    These have been squashed into this third and final round for v3.1.

    target: Remove ifdeffed code in t_g_process_write
    target: Remove direct ramdisk code
    target: Rename task_sg_num to task_sg_nents
    target: Remove custom debug macros for pr_debug. Use pr_err().
    target: Remove custom debug macros in mainline fabrics
    target: Set WSNZ=1 in block limits VPD. Abort if WRITE_SAME sectors = 0
    target: Remove transport do_se_mem_map callback
    target: Further simplify transport_free_pages
    target: Redo task allocation return value handling
    target: Remove extra parentheses
    target: change alloc_task call to take *cdb, not *cmd

    (nab: Fix bogus struct file assignments in fd_do_readv and fd_do_writev)

    Signed-off-by: Andy Grover
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Both backstores and fabrics use arrays of struct scatterlist to describe
    data buffers. However TCM used struct se_mems, basically a linked list
    of scatterlist entries. We are able to simplify the code by eliminating
    this intermediate data structure and just using struct scatterlist[]
    throughout.

    Also, moved attachment of task to cmd out of transport_generic_get_task
    and into allocate_control_task and allocate_data_tasks. The reasoning
    is that it's nonintuitive that get_task should automatically add it to
    the cmd's task list -- it should just return an allocated, initialized
    task. That's all it should do, based on the function's name, so either the
    function shouldn't do it, or the name should change to encapsulate the
    entire essence of what it does.

    (nab: Fix compile warnings in tcm_fc, and make transport_kmap_first_data_page
    honor sg->offset for SGLs from contigious memory with TCM_Loop, and
    fix control se_cmd descriptor memory leak)

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • Implement page B1h, Block Device Characteristics, so that we can report
    a medium rotation rate of 1 (non-rotating / solid state) if the
    is_nonrot device attribute is set; we update the iblock backend to set
    this attribute if the underlying Linux block device has its nonrot
    flag set.

    Signed-off-by: Roland Dreier
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • ibd_depth and ibd_force are used write-only. Remove them.
    ibd_major/minor can be easily retrieved from ibd_bd, so get
    rid of them too.

    Signed-off-by: Roland Dreier
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • This patch converts iblock_create_virtdevice() to use request_queue->nr_request
    for se_dev_limits usage of ->hw_queue_depth and ->queue_depth for individual
    struct se_device export.

    It also removes the now unused defines for IBLOCK_DEVICE_QUEUE_DEPTH and
    IBLOCK_MAX_DEVICE_QUEUE_DEPTH

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch contains a squashed version of third round series cleanups,
    improvements ,and simplfications from Andy and Christoph ahead of the
    heavy lifting between round 3 -> 4 for the target core SGL conversion.

    This include cleanups to the main target I/O path and other miscellaneous
    updates.

    target: Replace custom sgbuf functions with lib funcs
    target: Simplify sector limiting code
    target: get_cdb should never return NULL
    target: Simplify transport_memcpy_se_mem_read_contig
    target: Use assignment rather than increment for t_task_cdbs
    target: Don't pass dma_size to generic_get_mem
    target: Pass sg with type scatterlist in transport_map_sg_to_mem
    target: Move task_sg_num next to task_sg in struct se_task
    target: inline struct se_transport_task into struct se_cmd
    target: Change name & semantics of transport_get_sectors()
    target: Remove unused members of se_cmd
    target: Rename se_cmd.t_task_cdbs to t_task_list_num
    target: Fix some spelling
    target: Remove unused var from transport_generic_do_tmr
    target: map_sg_to_mem: return sg_count in return value
    target/pscsi: Use min_t for sector limits
    target/pscsi: Unused param for pscsi_get_bio()
    target: Rename get_cdb_count to allocate_tasks
    target: Make transport_generic_new_cmd() available for iscsi-target
    target: Remove fabric callback to allocate iovecs
    target: Fix transport_generic_new_cmd WRITE comment

    (hch: Use __GFP_ZERO usage for alloc_pages() usage)

    Signed-off-by: Andy Grover
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • This patch contains the squashed version of second round of target core
    cleanups and simplifications and Andy and Co. It also contains a handful
    of fixes to address bugs the original series and other minor cleanups.

    Here is the condensed shortlog:

    target: Remove unneeded casts to void*
    target: Rename get_lun_for_{cmd,tmr} to lookup_{cmd,tmr}_lun
    target: Make t_task a member of se_cmd, not a pointer
    target: Handle functions returning "-2"
    target: Use cmd->se_dev over cmd->se_lun->lun_se_dev
    target: Embed qr in struct se_cmd
    target: Replace embedded struct se_queue_req with a list_head
    target: Rename list_heads that are nodes in struct se_cmd to "*_node"
    target: Fold transport_device_setup_cmd() into lookup_{tmr,cmd}_lun()
    target: Make t_mem_list and t_mem_list_bidi members of t_task
    target: Add comment & cleanup transport_map_sg_to_mem()
    target: Remove unneeded checks in transport_free_pages()

    (Roland: Fix se_queue_req removal leftovers OOPs)
    (nab: Fix transport_lookup_tmr_lun failure case)
    (nab: Fix list_empty(&cmd->t_task.t_mem_bidi_list) inversion bugs)

    Signed-off-by: Andy Grover
    Signed-off-by: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     
  • This patch contains the squashed version of a number of cleanups and
    minor fixes from Andy's initial series (round 1) for target core this
    past spring. The condensed log looks like:

    target: use errno values instead of returning -1 for everything
    target: Rename transport_calc_sg_num to transport_init_task_sg
    target: Fix leak in error path in transport_init_task_sg
    target/pscsi: Remove pscsi_get_sh() usage
    target: Make two runtime checks into WARN_ONs
    target: Remove hba queue depth and convert to spin_lock_irq usage
    target: dev->dev_status_queue_obj is unused
    target: Make struct se_queue_req.cmd type struct se_cmd *
    target: Remove __transport_get_qr_from_queue()
    target: Rename se_dev->g_se_dev_list to se_dev_node
    target: Remove struct se_global
    target: Simplify scsi mib index table code
    target: Make dev_queue_obj a member of se_device instead of a pointer
    target: remove extraneous returns at end of void functions
    target: Ensure transport_dump_vpd_ident_type returns null-terminated str
    target: Function pointers don't need to use '&' to be assigned
    target: Fix comment in __transport_execute_tasks()
    target: Misc style cleanups
    target: rename struct pr_reservation_template to pr_reservation
    target: Remove #defines that just perform indirection
    target: Inline transport_get_task_from_execute_queue()
    target: Minor header comment fixes

    Signed-off-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    Andy Grover
     

26 Mar, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (55 commits)
    [SCSI] tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module
    [SCSI] qla4xxx: Use polling mode for disable interrupt mailbox completion
    [SCSI] Revert "[SCSI] Retrieve the Caching mode page"
    [SCSI] bnx2fc: IO completion not processed due to missed wakeup
    [SCSI] qla4xxx: Update driver version to 5.02.00-k6
    [SCSI] qla4xxx: masking required bits of add_fw_options during initialization
    [SCSI] qla4xxx: added new function qla4xxx_relogin_all_devices
    [SCSI] qla4xxx: add support for ql4xsess_recovery_tmo cmd line param
    [SCSI] qla4xxx: Add support for ql4xmaxqdepth command line parameter
    [SCSI] qla4xxx: cleanup function qla4xxx_process_ddb_changed
    [SCSI] qla4xxx: Prevent other port reinitialization during remove_adapter
    [SCSI] qla4xxx: remove unused ddb flag DF_NO_RELOGIN
    [SCSI] qla4xxx: cleanup DDB relogin logic during initialization
    [SCSI] qla4xxx: Do not retry ISP82XX initialization if H/W state is failed
    [SCSI] qla4xxx: Do not send mbox command if FW is in failed state
    [SCSI] qla4xxx: cleanup qla4xxx_initialize_ddb_list()
    [SCSI] ses: add subenclosure support
    [SCSI] bnx2fc: Bump version to 1.0.1
    [SCSI] bnx2fc: Remove unnecessary module state checks
    [SCSI] bnx2fc: Fix MTU issue by using static MTU
    ...

    Linus Torvalds
     

25 Mar, 2011

1 commit

  • * 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block: (65 commits)
    Documentation/iostats.txt: bit-size reference etc.
    cfq-iosched: removing unnecessary think time checking
    cfq-iosched: Don't clear queue stats when preempt.
    blk-throttle: Reset group slice when limits are changed
    blk-cgroup: Only give unaccounted_time under debug
    cfq-iosched: Don't set active queue in preempt
    block: fix non-atomic access to genhd inflight structures
    block: attempt to merge with existing requests on plug flush
    block: NULL dereference on error path in __blkdev_get()
    cfq-iosched: Don't update group weights when on service tree
    fs: assign sb->s_bdi to default_backing_dev_info if the bdi is going away
    block: Require subsystems to explicitly allocate bio_set integrity mempool
    jbd2: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explicit plugging
    jbd: finish conversion from WRITE_SYNC_PLUG to WRITE_SYNC and explicit plugging
    fs: make fsync_buffers_list() plug
    mm: make generic_writepages() use plugging
    blk-cgroup: Add unaccounted time to timeslice_used.
    block: fixup plugging stubs for !CONFIG_BLOCK
    block: remove obsolete comments for blkdev_issue_zeroout.
    blktrace: Use rq->cmd_flags directly in blk_add_trace_rq.
    ...

    Fix up conflicts in fs/{aio.c,super.c}

    Linus Torvalds
     

24 Mar, 2011

2 commits

  • This patch converts the target_core_store_dev_enable() -> struct
    se_subsystem_api->create_virtdevice() call to return proper ERR_PTR values
    back up to configfs logic during backend dependent struct se_device ENABLE
    exception conditions.

    Along with the change to target_core_configfs.c, this includes converting IBLOCK,
    FILEIO, pSCSI, and RAMDISK_* backend subsystem plugins to obtain upper level
    PTR_ERR return codes (where available), and return via ERR_PTR during a
    *_create_virtdev() failure.

    Reported-by: Fubo Chen
    Signed-off-by: Nicholas A. Bellinger
    Signed-off-by: James Bottomley

    Nicholas Bellinger
     
  • match_strdup() dynamically allocates memory and it is the responsabillity
    of the caller to free that memory. The following three cases:

    drivers/target/target_core_file.c:fd_set_configfs_dev_params()
    drivers/target/target_core_iblock.c:iblock_set_configfs_dev_params()
    drivers/target/target_core_configfs.c:target_core_dev_pr_store_attr_res_aptpl_metadata()

    should be kfree()'ing the allocated memory once it is no longer needed.
    It also makes sure to return -ENOMEM if the memory allocation in match_strdup()
    should fail. For target_core_configfs.c, this patch adds kfree()'s around
    Opt_initiator_fabric, Opt_initiator_node, Opt_initiator_sid, Opt_sa_res_key,
    Opt_target_fabric, and Opt_target_node for the Persistent Reservations
    Activate Persistence across Target Power Loss (APTPL=1) token parsing.

    Signed-off-by: Jesper Juhl
    Signed-off-by: Nicholas A. Bellinger
    Signed-off-by: James Bottomley

    Jesper Juhl
     

10 Mar, 2011

1 commit

  • Code has been converted over to the new explicit on-stack plugging,
    and delay users have been converted to use the new API for that.
    So lets kill off the old plugging along with aops->sync_page().

    Signed-off-by: Jens Axboe

    Jens Axboe
     

02 Mar, 2011

1 commit


13 Feb, 2011

2 commits

  • This patch adds an explict check for struct iblock_dev->ibd_bd in
    iblock_free_device() before calling blkdev_put(), which will otherwise hit
    the following NULL pointer dereference @ ib_dev->ibd_bd when iblock_create_virtdevice()
    fails to claim an already in-use struct block_device via blkdev_get_by_path().

    [ 112.528578] Target_Core_ConfigFS: Allocated struct se_subsystem_dev: ffff88001e750000 se_dev_su_ptr: ffff88001dd05d70
    [ 112.534681] Target_Core_ConfigFS: Calling t->free_device() for se_dev_su_ptr: ffff88001dd05d70
    [ 112.535029] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
    [ 112.535029] IP: [] mutex_lock+0x14/0x35
    [ 112.535029] PGD 1e5d0067 PUD 1e274067 PMD 0
    [ 112.535029] Oops: 0002 [#1] SMP
    [ 112.535029] last sysfs file: /sys/devices/pci0000:00/0000:00:07.1/host2/target2:0:0/2:0:0:0/type
    [ 112.535029] CPU 0
    [ 112.535029] Modules linked in: iscsi_target_mod target_core_stgt scsi_tgt target_core_pscsi target_core_file target_core_iblock target_core_mod configfs sr_mod cdrom sd_mod ata_piix mptspi mptscsih libata mptbase [last unloaded: scsi_wait_scan]
    [ 112.535029]
    [ 112.535029] Pid: 3345, comm: python2.5 Not tainted 2.6.37+ #1 440BX Desktop Reference Platform/VMware Virtual Platform
    [ 112.535029] RIP: 0010:[] [] mutex_lock+0x14/0x35
    [ 112.535029] RSP: 0018:ffff88001e6d7d58 EFLAGS: 00010246
    [ 112.535029] RAX: 0000000000000000 RBX: 0000000000000020 RCX: 0000000000000082
    [ 112.535029] RDX: ffff88001e6d7fd8 RSI: 0000000000000083 RDI: 0000000000000020
    [ 112.535029] RBP: ffff88001e6d7d68 R08: 0000000000000000 R09: 0000000000000000
    [ 112.535029] R10: ffff8800000be860 R11: ffff88001f420000 R12: 0000000000000020
    [ 112.535029] R13: 0000000000000083 R14: ffff88001d809430 R15: ffff88001d8094f8
    [ 112.535029] FS: 00007ff17ca7d6e0(0000) GS:ffff88001fa00000(0000) knlGS:0000000000000000
    [ 112.535029] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 112.535029] CR2: 0000000000000020 CR3: 000000001e5d2000 CR4: 00000000000006f0
    [ 112.535029] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [ 112.535029] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    [ 112.535029] Process python2.5 (pid: 3345, threadinfo ffff88001e6d6000, task ffff88001e2d0760)
    [ 112.535029] Stack:
    [ 112.535029] ffff88001e6d7d88 0000000000000000 ffff88001e6d7d98 ffffffff811187fc
    [ 112.535029] ffff88001d809430 ffff88001dd05d70 ffff88001e750860 ffff88001e750000
    [ 112.535029] ffff88001e6d7db8 ffffffffa00e3757 ffff88001e6d7db8 0000000000000004
    [ 112.535029] Call Trace:
    [ 112.535029] [] blkdev_put+0x28/0x107
    [ 112.535029] [] iblock_free_device+0x1d/0x36 [target_core_iblock]
    [ 112.535029] [] target_core_drop_subdev+0x15f/0x18d [target_core_mod]
    [ 112.535029] [] client_drop_item+0x25/0x31 [configfs]
    [ 112.535029] [] configfs_rmdir+0x1a1/0x223 [configfs]
    [ 112.535029] [] vfs_rmdir+0x7e/0xd3
    [ 112.535029] [] do_rmdir+0xa3/0xf4
    [ 112.535029] [] sys_rmdir+0x11/0x13
    [ 112.535029] [] system_call_fastpath+0x16/0x1b
    [ 112.535029] Code: 8b 04 25 88 b5 00 00 48 2d d8 1f 00 00 48 89 43 18 31 c0 5e 5b c9 c3 55 48 89 e5 53 48 89 fb 48 83 ec 08 e8 c4 f7 ff ff 48 89 df ff 0f 79 05 e8 1e ff ff ff 65 48 8b 04 25 88 b5 00 00 48 2d
    [ 112.535029] RIP [] mutex_lock+0x14/0x35
    [ 112.535029] RSP
    [ 112.535029] CR2: 0000000000000020
    [ 132.679636] ---[ end trace 05754bb48eb828f0 ]---

    Note it also adds an second explict check for ib_dev->ibd_bio_set before calling
    bioset_free() to fix the same possible NULL pointer deference during an early
    iblock_create_virtdevice() failure.

    Signed-off-by: Nicholas A. Bellinger
    Signed-off-by: James Bottomley

    Nicholas Bellinger
     
  • blkdev_get_by_path() returns an ERR_PTR() or error and it doesn't return
    a NULL. It looks like this bug would be easy to trigger by mistake.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Nicholas A. Bellinger
    Signed-off-by: James Bottomley

    Dan Carpenter
     

15 Jan, 2011

1 commit

  • LIO target is a full featured in-kernel target framework with the
    following feature set:

    High-performance, non-blocking, multithreaded architecture with SIMD
    support.

    Advanced SCSI feature set:

    * Persistent Reservations (PRs)
    * Asymmetric Logical Unit Assignment (ALUA)
    * Protocol and intra-nexus multiplexing, load-balancing and failover (MC/S)
    * Full Error Recovery (ERL=0,1,2)
    * Active/active task migration and session continuation (ERL=2)
    * Thin LUN provisioning (UNMAP and WRITE_SAMExx)

    Multiprotocol target plugins

    Storage media independence:

    * Virtualization of all storage media; transparent mapping of IO to LUNs
    * No hard limits on number of LUNs per Target; maximum LUN size ~750 TB
    * Backstores: SATA, SAS, SCSI, BluRay, DVD, FLASH, USB, ramdisk, etc.

    Standards compliance:

    * Full compliance with IETF (RFC 3720)
    * Full implementation of SPC-4 PRs and ALUA

    Significant code cleanups done by Christoph Hellwig.

    [jejb: fix up for new block bdev exclusive interface. Minor fixes from
    Randy Dunlap and Dan Carpenter.]
    Signed-off-by: Nicholas A. Bellinger
    Signed-off-by: James Bottomley

    Nicholas Bellinger