01 Feb, 2013

2 commits

  • This patch fixes a possible divide by zero bug when the fabric_max_sectors
    device attribute is written and backend se_device failed to be successfully
    configured -> enabled.

    Go ahead and use block_size=512 within se_dev_set_fabric_max_sectors()
    in the event of a target_configure_device() failure case, as no valid
    dev->dev_attrib.block_size value will have been setup yet.

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

    Nicholas Bellinger
     
  • This patch fixes a v3.8-rc1 regression bug where an unconfigured se_device
    was incorrectly allowed to perform a fabric port-link. This bug was
    introduced in commit:

    commit 0fd97ccf45be26fb01b3a412f1f6c6b5044b2f16
    Author: Christoph Hellwig
    Date: Mon Oct 8 00:03:19 2012 -0400

    target: kill struct se_subsystem_dev

    which ended up dropping the original se_subsystem_dev->se_dev_ptr check
    preventing this from happening with pre commit 0fd97ccf code.

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

    Nicholas Bellinger
     

30 Jan, 2013

3 commits

  • This patch fixes a regression introduced in v3.8-rc1 code where a
    zero-length READ_CAPACITY_16 was no longer returning GOOD status, but
    instead returning TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE to generate
    a CHECK_CONDITION status.

    This regression was introduced with the following commit:

    commit de103c93aff0bed0ae984274e5dc8b95899badab
    Author: Christoph Hellwig
    Date: Tue Nov 6 12:24:09 2012 -0800

    target: pass sense_reason as a return value

    and this patch has been tested with the following zero-length CDB:

    sg_raw /dev/sdd 9e 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    SCSI Status: Good

    Sense Information:
    sense buffer empty

    Also, convert sbc_emulate_readcapacity() to follow the same method
    of handling transport_kmap_data_sg() return values, but we never
    expect a zero-length request here.

    Cc: Christoph Hellwig
    Cc: Paolo Bonzini
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch fixes a regression introduced in v3.8-rc1 code where
    a zero-length MODE_SENSE was no longer returning GOOD status, but
    instead returning TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE to generate
    a CHECK_CONDITION status.

    This regression was introduced with the following commit:

    commit de103c93aff0bed0ae984274e5dc8b95899badab
    Author: Christoph Hellwig
    Date: Tue Nov 6 12:24:09 2012 -0800

    target: pass sense_reason as a return value

    and this patch has been tested with the following zero-length CDB:

    sg_raw /dev/sdd 5a 00 0a 00 00 00 00 00 00 00
    SCSI Status: Good

    Sense Information:
    sense buffer empty

    Cc: Christoph Hellwig
    Cc: Paolo Bonzini
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch fixes a minor regression introduced in v3.8-rc1 code
    where a zero-length INQUIRY was no longer returning the correct
    INVALID FIELD IN CDB additional sense code.

    This regression was introduced with the following commit:

    commit de103c93aff0bed0ae984274e5dc8b95899badab
    Author: Christoph Hellwig
    Date: Tue Nov 6 12:24:09 2012 -0800

    target: pass sense_reason as a return value

    and this patch has been tested with the following zero-length CDB:

    sg_raw /dev/sdd 12 00 83 00 00 00
    SCSI Status: Check Condition

    Sense Information:
    Fixed format, current; Sense key: Illegal Request
    Additional sense: Invalid field in cdb

    Cc: Christoph Hellwig
    Cc: Paolo Bonzini
    Cc: Roland Dreier
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

11 Jan, 2013

8 commits

  • Commit 64c13330a389 ("iscsi-target: Fix bug in handling of ExpStatSN
    ACK during u32 wrap-around") introduced a bug where we compare the
    wrong SN against our ExpCmdSN.

    Reported-by: Ben Hutchings
    Signed-off-by: Roland Dreier
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • When transport_lookup_tmr_lun() fails and we return a task management
    response from target_complete_tmr_failure(), we need to call
    transport_cmd_check_stop_to_fabric() to release the last ref to the
    cmd after calling se_tfo->queue_tm_rsp(), or else we will never remove
    the failed TMR from the session command list (and we'll end up waiting
    forever when trying to tear down the session).

    (nab: Fix minor compile breakage)

    Signed-off-by: Roland Dreier
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • If a backend IO takes a really long then an initiator might abort a
    command, and then when it gives up on the abort, send a LUN reset too,
    all before we process any of the original command or the abort. (The
    abort will wait for the backend IO to complete too)

    When the backend IO final completes (or fails), the abort handling
    will proceed and queue up a "return aborted status" operation. Then,
    while that's still pending, the LUN reset might find the original
    command still on the LUN's list of commands and try to return aborted
    status again, which leads to a use-after free when the first
    se_tfo->queue_status call frees the command and then the second
    se_tfo->queue_status call runs.

    Fix this by removing a command from the LUN state_list when we first
    are about to queue aborted status; we shouldn't do anything
    LUN-related after we've started returning status, so this seems like
    the correct thing to do.

    Signed-off-by: Roland Dreier
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • This patch fixes a regression bug introduced during v3.6.x code with
    the following commit to drop transport_add_cmd_to_queue(), which
    originally re-set CMD_T_ACTIVE during pending WRITE I/O submission:

    commit af8772926f019b7bddd7477b8de5f3b0f12bad21
    Author: Christoph Hellwig
    Date: Sun Jul 8 15:58:49 2012 -0400

    target: replace the processing thread with a TMR work queue

    The following sequence happens for write commands (or any other
    commands with a data out phase):

    - The transport calls target_submit_cmd(), which sets CMD_T_ACTIVE in
    cmd->transport_state and sets cmd->t_state to TRANSPORT_NEW_CMD.
    - Things go on transport_generic_new_cmd(), which notices that the
    command needs to transfer data, so it sets cmd->t_state to
    TRANSPORT_WRITE_PENDING and calls transport_cmd_check_stop().
    - transport_cmd_check_stop() clears CMD_T_ACTIVE in cmd->transport_state
    and returns in the normal case.
    - Then we continue on to call ->se_tfo->write_pending().
    - The data comes back from the initiator, and the transport calls
    target_execute_cmd(), which sets cmd->t_state to TRANSPORT_PROCESSING
    and calls into the backend to actually write the data.

    At this point, the backend might take a long time to complete the
    command, since it has to do real IO. If an abort request comes in for
    this command at this point, it will not wait for the command to finish
    since CMD_T_ACTIVE is not set. Then when the command does finally
    finish, we blow up with use-after-free.

    Avoid this by setting CMD_T_ACTIVE in target_execute_cmd() so that
    transport_wait_for_tasks() waits for the command to finish executing.
    This matches the behavior from before commit 1389533ef944 ("target:
    remove transport_generic_handle_data"), when data was signaled via
    transport_generic_handle_data(), which set CMD_T_ACTIVE because it
    called transport_add_cmd_to_queue().

    Signed-off-by: Roland Dreier
    Reported-by: Martin Svec
    Cc: Christoph Hellwig
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • Clear the target role when no target is provided for
    the node performing a PRLI.

    Signed-off-by: Mark Rustad
    Reviewed-by: Bhanu Prakash Gollapudi
    Acked by Robert Love
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Mark Rustad
     
  • When generating a PRLI response to an initiator, clear the
    FCP_SPPF_RETRY bit in the response.

    Signed-off-by: Mark Rustad
    Reviewed-by: Bhanu Prakash Gollapudi
    Acked by Robert Love
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Mark Rustad
     
  • The compiler complained about uninitialized variables, so
    use TCM_NO_SENSE here.

    Signed-off-by: Hannes Reinecke
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Hannes Reinecke
     
  • Introduce TCM_NO_SENSE, mapping to sense code
    'Not ready, no additional sense information'.

    Signed-off-by: Hannes Reinecke
    Cc: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Hannes Reinecke
     

09 Jan, 2013

1 commit


16 Dec, 2012

1 commit

  • Pull target updates from Nicholas Bellinger:
    "It has been a very busy development cycle this time around in target
    land, with the highlights including:

    - Kill struct se_subsystem_dev, in favor of direct se_device usage
    (hch)
    - Simplify reservations code by combining SPC-3 + SCSI-2 support for
    virtual backends only (hch)
    - Simplify ALUA code for virtual only backends, and remove left over
    abstractions (hch)
    - Pass sense_reason_t as return value for I/O submission path (hch)
    - Refactor MODE_SENSE emulation to allow for easier addition of new
    mode pages. (roland)
    - Add emulation of MODE_SELECT (roland)
    - Fix bug in handling of ExpStatSN wrap-around (steve)
    - Fix bug in TMR ABORT_TASK lookup in qla2xxx target (steve)
    - Add WRITE_SAME w/ UNMAP=0 support for IBLOCK backends (nab)
    - Convert ib_srpt to use modern target_submit_cmd caller + drop
    legacy ioctx->kref usage (nab)
    - Convert ib_srpt to use modern target_submit_tmr caller (nab)
    - Add link_magic for fabric allow_link destination target_items for
    symlinks within target_core_fabric_configfs.c code (nab)
    - Allocate pointers in instead of full structs for
    config_group->default_groups (sebastian)
    - Fix 32-bit highmem breakage for FILEIO (sebastian)

    All told, hch was able to shave off another ~1K LOC by killing the
    se_subsystem_dev abstraction, along with a number of PR + ALUA
    simplifications. Also, a nice patch by Roland is the refactoring of
    MODE_SENSE handling, along with the addition of initial MODE_SELECT
    emulation support for virtual backends.

    Sebastian found a long-standing issue wrt to allocation of full
    config_group instead of pointers for config_group->default_group[]
    setup in a number of areas, which ends up saving memory with big
    configurations. He also managed to fix another long-standing BUG wrt
    to broken 32-bit highmem support within the FILEIO backend driver.

    Thank you again to everyone who contributed this round!"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (50 commits)
    target/iscsi_target: Add NodeACL tags for initiator group support
    target/tcm_fc: fix the lockdep warning due to inconsistent lock state
    sbp-target: fix error path in sbp_make_tpg()
    sbp-target: use simple assignment in tgt_agent_rw_agent_state()
    iscsi-target: use kstrdup() for iscsi_param
    target/file: merge fd_do_readv() and fd_do_writev()
    target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping
    target: Add link_magic for fabric allow_link destination target_items
    ib_srpt: Convert TMR path to target_submit_tmr
    ib_srpt: Convert I/O path to target_submit_cmd + drop legacy ioctx->kref
    target: Make spc_get_write_same_sectors return sector_t
    target/configfs: use kmalloc() instead of kzalloc() for default groups
    target/configfs: allocate only 6 slots for dev_cg->default_groups
    target/configfs: allocate pointers instead of full struct for default_groups
    target: update error handling for sbc_setup_write_same()
    iscsit: use GFP_ATOMIC under spin lock
    iscsi_target: Remove redundant null check before kfree
    target/iblock: Forward declare bio helpers
    target: Clean up flow in transport_check_aborted_status()
    target: Clean up logic in transport_put_cmd()
    ...

    Linus Torvalds
     

14 Dec, 2012

2 commits

  • Thanks for reviews, looking a lot better.

    ---- 8< ----

    Initiator access config could be easier. The way other storage vendors
    have addressed this is to support initiator groups: the admin adds
    initiator WWNs to the group, and then LUN permissions can be granted for
    the entire group at once.

    Instead of changing ktarget's configfs interface, this patch keeps
    the configfs interface per-initiator-wwn and just adds a 'tag' field
    for each. This should be enough for user tools like targetcli to group
    initiator ACLs and sync their configurations.

    acl_tag is not used internally, but needs to be kept in configfs so that
    all user tools can avoid dependencies on each other.

    Code tested to work, although userspace pieces still to be implemented.

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

    Andy Grover
     
  • Pull trivial branch from Jiri Kosina:
    "Usual stuff -- comment/printk typo fixes, documentation updates, dead
    code elimination."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
    HOWTO: fix double words typo
    x86 mtrr: fix comment typo in mtrr_bp_init
    propagate name change to comments in kernel source
    doc: Update the name of profiling based on sysfs
    treewide: Fix typos in various drivers
    treewide: Fix typos in various Kconfig
    wireless: mwifiex: Fix typo in wireless/mwifiex driver
    messages: i2o: Fix typo in messages/i2o
    scripts/kernel-doc: check that non-void fcts describe their return value
    Kernel-doc: Convention: Use a "Return" section to describe return values
    radeon: Fix typo and copy/paste error in comments
    doc: Remove unnecessary declarations from Documentation/accounting/getdelays.c
    various: Fix spelling of "asynchronous" in comments.
    Fix misspellings of "whether" in comments.
    eisa: Fix spelling of "asynchronous".
    various: Fix spelling of "registered" in comments.
    doc: fix quite a few typos within Documentation
    target: iscsi: fix comment typos in target/iscsi drivers
    treewide: fix typo of "suport" in various comments and Kconfig
    treewide: fix typo of "suppport" in various comments
    ...

    Linus Torvalds
     

13 Dec, 2012

3 commits

  • The lockdep warning below is in theory correct but it will be in really weird
    rare situation that ends up that deadlock since the tcm fc session is hashed
    based the rport id. Nonetheless, the complaining below is about rcu callback
    that does the transport_deregister_session() is happening in softirq, where
    transport_register_session() that happens earlier is not. This triggers the
    lockdep warning below. So, just fix this to make lockdep happy by disabling
    the soft irq before calling transport_register_session() in ft_prli.

    BTW, this was found in FCoE VN2VN over two VMs, couple of create and destroy
    would get this triggered.

    v1: was enforcing register to be in softirq context which was not righ. See,
    http://www.spinics.net/lists/target-devel/msg03614.html

    v2: following comments from Roland&Nick (thanks), it seems we don't have to
    do transport_deregister_session() in rcu callback, so move it into ft_sess_free()
    but still do kfree() of the corresponding ft_sess struct in rcu callback to
    make sure the ft_sess is not freed till the rcu callback.

    ...
    [ 1328.370592] scsi2 : FCoE Driver
    [ 1328.383429] fcoe: No FDMI support.
    [ 1328.384509] host2: libfc: Link up on port (000000)
    [ 1328.934229] host2: Assigned Port ID 00a292
    [ 1357.232132] host2: rport 00a393: Remove port
    [ 1357.232568] host2: rport 00a393: Port sending LOGO from Ready state
    [ 1357.233692] host2: rport 00a393: Delete port
    [ 1357.234472] host2: rport 00a393: work event 3
    [ 1357.234969] host2: rport 00a393: callback ev 3
    [ 1357.235979] host2: rport 00a393: Received a LOGO response closed
    [ 1357.236706] host2: rport 00a393: work delete
    [ 1357.237481]
    [ 1357.237631] =================================
    [ 1357.238064] [ INFO: inconsistent lock state ]
    [ 1357.238450] 3.7.0-rc7-yikvm+ #3 Tainted: G O
    [ 1357.238450] ---------------------------------
    [ 1357.238450] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
    [ 1357.238450] ksoftirqd/0/3 [HC0[0]:SC1[1]:HE0:SE0] takes:
    [ 1357.238450] (&(&se_tpg->session_lock)->rlock){+.?...}, at: [] transport_deregister_session+0x41/0x148 [target_core_mod]
    [ 1357.238450] {SOFTIRQ-ON-W} state was registered at:
    [ 1357.238450] [] mark_held_locks+0x6d/0x95
    [ 1357.238450] [] trace_hardirqs_on_caller+0x12d/0x197
    [ 1357.238450] [] trace_hardirqs_on+0xd/0xf
    [ 1357.238450] [] _raw_spin_unlock_irq+0x2d/0x45
    [ 1357.238450] [] __transport_register_session+0xb8/0x122 [target_core_mod]
    [ 1357.238450] [] transport_register_session+0x44/0x5a [target_core_mod]
    [ 1357.238450] [] ft_prli+0x1e3/0x275 [tcm_fc]
    [ 1357.238450] [] fc_rport_recv_req+0x95e/0xdc5 [libfc]
    [ 1357.238450] [] fc_lport_recv_els_req+0xc4/0xd5 [libfc]
    [ 1357.238450] [] fc_lport_recv_req+0x12f/0x18f [libfc]
    [ 1357.238450] [] fc_exch_recv+0x8ba/0x981 [libfc]
    [ 1357.238450] [] fcoe_percpu_receive_thread+0x47a/0x4e2 [fcoe]
    [ 1357.238450] [] kthread+0xb1/0xb9
    [ 1357.238450] [] ret_from_fork+0x7c/0xb0
    [ 1357.238450] irq event stamp: 275411
    [ 1357.238450] hardirqs last enabled at (275410): [] rcu_process_callbacks+0x229/0x42a
    [ 1357.238450] hardirqs last disabled at (275411): [] _raw_spin_lock_irqsave+0x22/0x8e
    [ 1357.238450] softirqs last enabled at (275394): [] __do_softirq+0x246/0x26f
    [ 1357.238450] softirqs last disabled at (275399): [] run_ksoftirqd+0x29/0x62
    [ 1357.238450]
    [ 1357.238450] other info that might help us debug this:
    [ 1357.238450] Possible unsafe locking scenario:
    [ 1357.238450]
    [ 1357.238450] CPU0
    [ 1357.238450] ----
    [ 1357.238450] lock(&(&se_tpg->session_lock)->rlock);
    [ 1357.238450]
    [ 1357.238450] lock(&(&se_tpg->session_lock)->rlock);
    [ 1357.238450]
    [ 1357.238450] *** DEADLOCK ***
    [ 1357.238450]
    [ 1357.238450] no locks held by ksoftirqd/0/3.
    [ 1357.238450]
    [ 1357.238450] stack backtrace:
    [ 1357.238450] Pid: 3, comm: ksoftirqd/0 Tainted: G O 3.7.0-rc7-yikvm+ #3
    [ 1357.238450] Call Trace:
    [ 1357.238450] [] print_usage_bug+0x1f5/0x206
    [ 1357.238450] [] ? save_stack_trace+0x2c/0x49
    [ 1357.238450] [] ? print_irq_inversion_bug.part.14+0x1ae/0x1ae
    [ 1357.238450] [] mark_lock+0x106/0x258
    [ 1357.238450] [] __lock_acquire+0x2e7/0xe53
    [ 1357.238450] [] ? pvclock_clocksource_read+0x48/0xb4
    [ 1357.238450] [] ? rcu_process_gp_end+0xc0/0xc9
    [ 1357.238450] [] ? transport_deregister_session+0x41/0x148 [target_core_mod]
    [ 1357.238450] [] lock_acquire+0x119/0x143
    [ 1357.238450] [] ? transport_deregister_session+0x41/0x148 [target_core_mod]
    [ 1357.238450] [] _raw_spin_lock_irqsave+0x54/0x8e
    [ 1357.238450] [] ? transport_deregister_session+0x41/0x148 [target_core_mod]
    [ 1357.238450] [] transport_deregister_session+0x41/0x148 [target_core_mod]
    [ 1357.238450] [] ? rcu_process_callbacks+0x229/0x42a
    [ 1357.238450] [] ft_sess_rcu_free+0x17/0x24 [tcm_fc]
    [ 1357.238450] [] ? ft_sess_free+0x1b/0x1b [tcm_fc]
    [ 1357.238450] [] rcu_process_callbacks+0x260/0x42a
    [ 1357.238450] [] __do_softirq+0x13a/0x26f
    [ 1357.238450] [] ? __schedule+0x65f/0x68e
    [ 1357.238450] [] run_ksoftirqd+0x29/0x62
    [ 1357.238450] [] smpboot_thread_fn+0x1a5/0x1aa
    [ 1357.238450] [] ? smpboot_unregister_percpu_thread+0x47/0x47
    [ 1357.238450] [] kthread+0xb1/0xb9
    [ 1357.238450] [] ? wait_for_common+0xbb/0x10a
    [ 1357.238450] [] ? __init_kthread_worker+0x59/0x59
    [ 1357.238450] [] ret_from_fork+0x7c/0xb0
    [ 1357.238450] [] ? __init_kthread_worker+0x59/0x59
    [ 1417.440099] rport-2:0-0: blocked FC remote port time out: removing rport

    Signed-off-by: Yi Zou
    Cc: Open-FCoE
    Cc: Nicholas A. Bellinger
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Yi Zou
     
  • If the TPG memory is allocated successfully, but we fail further along
    in the function, a dangling pointer to freed memory is left in the TPort
    structure. This is mostly harmless, but does prevent re-trying the
    operation without first removing the TPort altogether.

    Reported-by: Chen Gang
    Signed-off-by: Chris Boot
    Cc: Andy Grover
    Cc: Nicholas A. Bellinger
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Chris Boot
     
  • There is no need to memcpy() a 32-bit integer. The data pointer is
    guaranteed to be quadlet aligned by the FireWire stack so we can replace
    the memcpy() with an assignment.

    Thanks to Stefan Richter.

    Signed-off-by: Chris Boot
    Cc: Stefan Richter
    Cc: Andy Grover
    Cc: Clemens Ladisch
    Cc: Nicholas A. Bellinger
    Signed-off-by: Nicholas Bellinger

    Chris Boot
     

08 Dec, 2012

1 commit


06 Dec, 2012

2 commits


05 Dec, 2012

1 commit

  • This patch adds [dev,lun]_link_magic value assignment + checks within generic
    target_fabric_port_link() and target_fabric_mappedlun_link() code to ensure
    destination config_item *target_item sent from configfs_symlink() ->
    config_item_operations->allow_link() is the underlying se_device->dev_group
    and se_lun->lun_group that we expect to symlink.

    Reported-by: Sebastian Andrzej Siewior
    Cc: Sebastian Andrzej Siewior
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

28 Nov, 2012

11 commits


19 Nov, 2012

1 commit


18 Nov, 2012

1 commit

  • - If we stop processing an already-aborted command in
    target_execute_cmd(), then we need to complete t_transport_stop_comp
    to wake up the the TMR handling thread, or else it will end up
    waiting forever.

    - If we've a already sent an "aborted" status for a command in
    transport_check_aborted_status() then we should bail out of
    transport_send_task_abort() to avoid freeing the command twice.

    Signed-off-by: Roland Dreier
    Cc: stable@vger.kernel.org
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     

16 Nov, 2012

3 commits

  • This patch adds support for emulation of WRITE_SAME w/ UNMAP=0 within
    iblock_execute_write_same() backend code.

    The emulation uses a bio_add_page() call for each sector, and by default
    enforces a limit of max_write_same_len=0xFFFF (65536) sectors following
    what scsi_debug reports per default for MAXIMUM WRITE SAME LENGTH.

    It also sets max_write_same_len to the operational default at setup ->
    iblock_configure_device() time.

    (hch: Move unmap logic into iblock_execute_write_same_unmap + add
    check for single sector SGLs in iblock_execute_write_same)
    (mkp: Update comment for 0xFFFF magic constant)
    (nab: drop left-over max_write_same_len check in iblock_execute_write_same)

    Cc: Christoph Hellwig
    Cc: Martin K. Petersen
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds a new max_write_same_len device attribute for use with
    WRITE_SAME w/ UNMAP=0 backend emulation. This can be useful for
    lowering the default backend value (IBLOCK uses 0xFFFF).

    Also, update block limits VPD emulation code in spc_emulate_evpd_b0() to
    report MAXIMUM WRITE SAME LENGTH, and enforce max_write_same_len during
    sbc_parse() -> sbc_setup_write_same() CDB sanity checking for all emulated
    WRITE_SAME w/ UNMAP=0 cases.

    (Robert: Move max_write_same_len check in sbc_setup_write_same() to
    check both WRITE_SAME w/ UNMAP=1 and w/ UNMAP=0 cases)

    Cc: Christoph Hellwig
    Cc: Martin K. Petersen
    Cc: Robert Elliott
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • This patch adds a new sbc_ops->execute_write_same_unmap() caller for use
    with WRITE_SAME w/ UNMAP=1, and performs the ->execute_cmd() setup based
    this bit within sbc_setup_write_same() code.

    Also, makes the changes in sbc_parse_cdb() to handle a sense_reason_t
    return from sbc_setup_write_same() on error.

    Reported-by: Christoph Hellwig
    Cc: Martin K. Petersen
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger