19 Dec, 2015

1 commit

  • Pull xen bug fixes from David Vrabel:
    - XSA-155 security fixes to backend drivers.
    - XSA-157 security fixes to pciback.

    * tag 'for-linus-4.4-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    xen-pciback: fix up cleanup path when alloc fails
    xen/pciback: Don't allow MSI-X ops if PCI_COMMAND_MEMORY is not set.
    xen/pciback: For XEN_PCI_OP_disable_msi[|x] only disable if device has MSI(X) enabled.
    xen/pciback: Do not install an IRQ handler for MSI interrupts.
    xen/pciback: Return error on XEN_PCI_OP_enable_msix when device has MSI or MSI-X enabled
    xen/pciback: Return error on XEN_PCI_OP_enable_msi when device has MSI or MSI-X enabled
    xen/pciback: Save xen_pci_op commands before processing it
    xen-scsiback: safely copy requests
    xen-blkback: read from indirect descriptors only once
    xen-blkback: only read request operation from shared ring once
    xen-netback: use RING_COPY_REQUEST() throughout
    xen-netback: don't use last request to determine minimum Tx credit
    xen: Add RING_COPY_REQUEST()
    xen/x86/pvh: Use HVM's flush_tlb_others op
    xen: Resume PMU from non-atomic context
    xen/events/fifo: Consume unprocessed events when a CPU dies

    Linus Torvalds
     

18 Dec, 2015

1 commit

  • The copy of the ring request was lacking a following barrier(),
    potentially allowing the compiler to optimize the copy away.

    Use RING_COPY_REQUEST() to ensure the request is copied to local
    memory.

    This is part of XSA155.

    CC: stable@vger.kernel.org
    Reviewed-by: Juergen Gross
    Signed-off-by: David Vrabel
    Signed-off-by: Konrad Rzeszutek Wilk

    David Vrabel
     

14 Oct, 2015

1 commit

  • 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
    Reviewed-by: Nicholas Bellinger
    Acked-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     

05 Jul, 2015

1 commit

  • Pull SCSI target updates from Nicholas Bellinger:
    "It's been a busy development cycle for target-core in a number of
    different areas.

    The fabric API usage for se_node_acl allocation is now within
    target-core code, dropping the external API callers for all fabric
    drivers tree-wide.

    There is a new conversion to RCU hlists for se_node_acl and
    se_portal_group LUN mappings, that turns fast-past LUN lookup into a
    completely lockless code-path. It also removes the original
    hard-coded limitation of 256 LUNs per fabric endpoint.

    The configfs attributes for backends can now be shared between core
    and driver code, allowing existing drivers to use common code while
    still allowing flexibility for new backend provided attributes.

    The highlights include:

    - Merge sbc_verify_dif_* into common code (sagi)
    - Remove iscsi-target support for obsolete IFMarker/OFMarker
    (Christophe Vu-Brugier)
    - Add bidi support in target/user backend (ilias + vangelis + agover)
    - Move se_node_acl allocation into target-core code (hch)
    - Add crc_t10dif_update common helper (akinobu + mkp)
    - Handle target-core odd SGL mapping for data transfer memory
    (akinobu)
    - Move transport ID handling into target-core (hch)
    - Move task tag into struct se_cmd + support 64-bit tags (bart)
    - Convert se_node_acl->device_list[] to RCU hlist (nab + hch +
    paulmck)
    - Convert se_portal_group->tpg_lun_list[] to RCU hlist (nab + hch +
    paulmck)
    - Simplify target backend driver registration (hch)
    - Consolidate + simplify target backend attribute implementations
    (hch + nab)
    - Subsume se_port + t10_alua_tg_pt_gp_member into se_lun (hch)
    - Drop lun_sep_lock for se_lun->lun_se_dev RCU usage (hch + nab)
    - Drop unnecessary core_tpg_register TFO parameter (nab)
    - Use 64-bit LUNs tree-wide (hannes)
    - Drop left-over TARGET_MAX_LUNS_PER_TRANSPORT limit (hannes)"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (76 commits)
    target: Bump core version to v5.0
    target: remove target_core_configfs.h
    target: remove unused TARGET_CORE_CONFIG_ROOT define
    target: consolidate version defines
    target: implement WRITE_SAME with UNMAP bit using ->execute_unmap
    target: simplify UNMAP handling
    target: replace se_cmd->execute_rw with a protocol_data field
    target/user: Fix inconsistent kmap_atomic/kunmap_atomic
    target: Send UA when changing LUN inventory
    target: Send UA upon LUN RESET tmr completion
    target: Send UA on ALUA target port group change
    target: Convert se_lun->lun_deve_lock to normal spinlock
    target: use 'se_dev_entry' when allocating UAs
    target: Remove 'ua_nacl' pointer from se_ua structure
    target_core_alua: Correct UA handling when switching states
    xen-scsiback: Fix compile warning for 64-bit LUN
    target: Remove TARGET_MAX_LUNS_PER_TRANSPORT
    target: use 64-bit LUNs
    target: Drop duplicate + unused se_dev_check_wce
    target: Drop unnecessary core_tpg_register TFO parameter
    ...

    Linus Torvalds
     

16 Jun, 2015

3 commits

  • drivers/xen/xen-scsiback.c: In function ‘scsiback_add_translation_entry’:
    drivers/xen/xen-scsiback.c:911:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long unsigned int’ [-Wformat]

    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • LUN allocation is now fully dynamic, so there is no need to
    artificially restrain the number of exported LUNs.

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

    Hannes Reinecke
     
  • This patch drops unnecessary target_core_fabric_ops parameter usage
    for core_tpg_register() during fabric driver TFO->fabric_make_tpg()
    se_portal_group creation callback execution.

    Instead, use the existing se_wwn->wwn_tf->tf_ops pointer to ensure
    fabric driver is really using the same TFO provided at module_init
    time.

    Also go ahead and drop the forward TFO declarations tree-wide, and
    handling the special case for iscsi-target discovery TPG.

    Cc: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

02 Jun, 2015

1 commit

  • Only include SCSI initiator header files in target code that needs
    these header files, namely the SCSI pass-through code and the tcm_loop
    driver. Change SCSI_SENSE_BUFFERSIZE into TRANSPORT_SENSE_BUFFER in
    target code because the former is intended for initiator code and the
    latter for target code. With this patch the only initiator include
    directives in target code that remain are as follows:

    $ git grep -nHE 'include .scsi/(scsi.h|scsi_host.h|scsi_device.h|scsi_cmnd.h)' drivers/target drivers/infiniband/ulp/{isert,srpt} drivers/usb/gadget/legacy/tcm_*.[ch] drivers/{vhost,xen} include/{target,trace/events/target.h}
    drivers/target/loopback/tcm_loop.c:29:#include
    drivers/target/loopback/tcm_loop.c:31:#include
    drivers/target/loopback/tcm_loop.c:32:#include
    drivers/target/loopback/tcm_loop.c:33:#include
    drivers/target/target_core_pscsi.c:39:#include
    drivers/target/target_core_pscsi.c:40:#include
    drivers/xen/xen-scsiback.c:52:#include /* SG_ALL */

    Signed-off-by: Bart Van Assche
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Bart Van Assche
     

01 Jun, 2015

1 commit

  • This patch converts the fixed size se_portal_group->tpg_lun_list[]
    to use modern RCU with hlist_head in order to support an arbitary
    number of se_lun ports per target endpoint.

    It includes dropping core_tpg_alloc_lun() from core_dev_add_lun(),
    and calling it directly from target_fabric_make_lun() to allocate
    a new se_lun. And add a new target_fabric_port_release() configfs
    item callback to invoke kfree_rcu() to release memory during
    se_lun->lun_group shutdown.

    Also now that se_node_acl->lun_entry_hlist is using RCU, convert
    existing tpg_lun_lock to struct mutex so core_tpg_add_node_to_devs()
    can perform RCU updater logic without releasing ->tpg_lun_mutex.

    Also, drop core_tpg_clear_object_luns() and it's single consumer
    in iscsi-target, which is duplicating TPG LUN shutdown logic and
    is current code results in a NOP.

    Finally, sbp-target and xen-scsiback fabric driver conversions are
    included, which are required due to the non-standard way they use
    ->tpg_lun_hlist.

    Reviewed-by: Hannes Reinecke
    Cc: Christoph Hellwig
    Cc: Sagi Grimberg
    Cc: Paul E. McKenney
    Cc: Chris Boot
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     

31 May, 2015

9 commits


25 Apr, 2015

1 commit

  • Pull SCSI target updates from Nicholas Bellinger:
    "Lots of activity in target land the last months.

    The highlights include:

    - Convert fabric drivers tree-wide to target_register_template() (hch
    + bart)

    - iser-target hardening fixes + v1.0 improvements (sagi)

    - Convert iscsi_thread_set usage to kthread.h + kill
    iscsi_target_tq.c (sagi + nab)

    - Add support for T10-PI WRITE_STRIP + READ_INSERT operation (mkp +
    sagi + nab)

    - DIF fixes for CONFIG_DEBUG_SG=y + UNMAP file emulation (akinobu +
    sagi + mkp)

    - Extended TCMU ABI v2 for future BIDI + DIF support (andy + ilias)

    - Fix COMPARE_AND_WRITE handling for NO_ALLLOC drivers (hch + nab)

    Thanks to everyone who contributed this round with new features,
    bug-reports, fixes, cleanups and improvements.

    Looking forward, it's currently shaping up to be a busy v4.2 as well"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (69 commits)
    target: Put TCMU under a new config option
    target: Version 2 of TCMU ABI
    target: fix tcm_mod_builder.py
    target/file: Fix UNMAP with DIF protection support
    target/file: Fix SG table for prot_buf initialization
    target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled
    target: Make core_tmr_abort_task() skip TMFs
    target/sbc: Update sbc_dif_generate pr_debug output
    target/sbc: Make internal DIF emulation honor ->prot_checks
    target/sbc: Return INVALID_CDB_FIELD if DIF + sess_prot_type disabled
    target: Ensure sess_prot_type is saved across session restart
    target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_*
    target: Remove the unused flag SCF_ACK_KREF
    target: Fix two sparse warnings
    target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling
    target: simplify the target template registration API
    target: simplify target_xcopy_init_pt_lun
    target: remove the unused SCF_CMD_XCOPY_PASSTHROUGH flag
    target/rd: reduce code duplication in rd_execute_rw()
    tcm_loop: fixup tpgt string to integer conversion
    ...

    Linus Torvalds
     

17 Apr, 2015

1 commit

  • Pull xen features and fixes from David Vrabel:

    - use a single source list of hypercalls, generating other tables etc.
    at build time.

    - add a "Xen PV" APIC driver to support >255 VCPUs in PV guests.

    - significant performance improve to guest save/restore/migration.

    - scsiback/front save/restore support.

    - infrastructure for multi-page xenbus rings.

    - misc fixes.

    * tag 'stable/for-linus-4.1-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    xen/pci: Try harder to get PXM information for Xen
    xenbus_client: Extend interface to support multi-page ring
    xen-pciback: also support disabling of bus-mastering and memory-write-invalidate
    xen: support suspend/resume in pvscsi frontend
    xen: scsiback: add LUN of restored domain
    xen-scsiback: define a pr_fmt macro with xen-pvscsi
    xen/mce: fix up xen_late_init_mcelog() error handling
    xen/privcmd: improve performance of MMAPBATCH_V2
    xen: unify foreign GFN map/unmap for auto-xlated physmap guests
    x86/xen/apic: WARN with details.
    x86/xen: Provide a "Xen PV" APIC driver to support >255 VCPUs
    xen/pciback: Don't print scary messages when unsupported by hypervisor.
    xen: use generated hypercall symbols in arch/x86/xen/xen-head.S
    xen: use generated hypervisor symbols in arch/x86/xen/trace.c
    xen: synchronize include/xen/interface/xen.h with xen
    xen: build infrastructure for generating hypercall depending symbols
    xen: balloon: Use static attribute groups for sysfs entries
    xen: pcpu: Use static attribute groups for sysfs entry

    Linus Torvalds
     

15 Apr, 2015

2 commits

  • Originally Xen PV drivers only use single-page ring to pass along
    information. This might limit the throughput between frontend and
    backend.

    The patch extends Xenbus driver to support multi-page ring, which in
    general should improve throughput if ring is the bottleneck. Changes to
    various frontend / backend to adapt to the new interface are also
    included.

    Affected Xen drivers:
    * blkfront/back
    * netfront/back
    * pcifront/back
    * scsifront/back
    * vtpmfront

    The interface is documented, as before, in xenbus_client.c.

    Signed-off-by: Wei Liu
    Signed-off-by: Paul Durrant
    Signed-off-by: Bob Liu
    Cc: Konrad Wilk
    Cc: Boris Ostrovsky
    Signed-off-by: David Vrabel

    Wei Liu
     
  • Instead of calling target_fabric_configfs_init() +
    target_fabric_configfs_register() / target_fabric_configfs_deregister()
    target_fabric_configfs_free() from every target driver, rewrite the API
    so that we have simple register/unregister functions that operate on
    a const operations vector.

    This patch also fixes a memory leak in several target drivers. Several
    target drivers namely called target_fabric_configfs_deregister()
    without calling target_fabric_configfs_free().

    A large part of this patch is based on earlier changes from
    Bart Van Assche .

    (v2: Add a new TF_CIT_SETUP_DRV macro so that the core configfs code
    can declare attributes as either core only or for drivers)

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

    Christoph Hellwig
     

22 Mar, 2015

1 commit

  • Pull SCSI target fixes from Nicholas Bellinger:
    "Here are current target-pending fixes for v4.0-rc5 code that have made
    their way into the queue over the last weeks.

    The fixes this round include:

    - Fix long-standing iser-target logout bug related to early
    conn_logout_comp completion, resulting in iscsi_conn use-after-tree
    OOpsen. (Sagi + nab)

    - Fix long-standing tcm_fc bug in ft_invl_hw_context() failure
    handing for DDP hw offload. (DanC)

    - Fix incorrect use of unprotected __transport_register_session() in
    tcm_qla2xxx + other single local se_node_acl fabrics. (Bart)

    - Fix reference leak in target_submit_cmd() -> target_get_sess_cmd()
    for ack_kref=1 failure path. (Bart)

    - Fix pSCSI backend ->get_device_type() statistics OOPs with
    un-configured device. (Olaf + nab)

    - Fix virtual LUN=0 target_configure_device failure OOPs at modprobe
    time. (Claudio + nab)

    - Fix FUA write false positive failure regression in v4.0-rc1 code.
    (Christophe Vu-Brugier + HCH)"

    * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
    target: do not reject FUA CDBs when write cache is enabled but emulate_write_cache is 0
    target: Fix virtual LUN=0 target_configure_device failure OOPs
    target/pscsi: Fix NULL pointer dereference in get_device_type
    tcm_fc: missing curly braces in ft_invl_hw_context()
    target: Fix reference leak in target_get_sess_cmd() error path
    loop/usb/vhost-scsi/xen-scsiback: Fix use of __transport_register_session
    tcm_qla2xxx: Fix incorrect use of __transport_register_session
    iscsi-target: Avoid early conn_logout_comp for iser connections
    Revert "iscsi-target: Avoid IN_LOGOUT failure case for iser-target"
    target: Disallow changing of WRITE cache/FUA attrs after export

    Linus Torvalds
     

20 Mar, 2015

1 commit

  • This patch changes loopback, usb-gadget, vhost-scsi and xen-scsiback
    fabric code to invoke transport_register_session() instead of the
    unprotected flavour, to ensure se_tpg->session_lock is taken when
    adding new session list nodes to se_tpg->tpg_sess_list.

    Note that since these four fabric drivers already hold their own
    internal TPG mutexes when accessing se_tpg->tpg_sess_list, and
    consist of a single se_session created through configfs attribute
    access, no list corruption can currently occur.

    So for correctness sake, go ahead and use the se_tpg->session_lock
    protected version for these four fabric drivers.

    Signed-off-by: Bart Van Assche
    Signed-off-by: Nicholas Bellinger

    Bart Van Assche
     

16 Mar, 2015

2 commits

  • When a xen domain is being restored the LUN state of a pvscsi device
    is "Connected" and not "Initialising" as in case of attaching a new
    pvscsi LUN.

    This must be taken into account when adding a new pvscsi device for
    a domain as otherwise the pvscsi LUN won't be connected to the
    SCSI target associated with it.

    Signed-off-by: Juergen Gross
    Reviewed-by: Boris Ostrovsky
    Signed-off-by: David Vrabel

    Juergen Gross
     
  • Add the {xen-pvscsi: } prefix in pr_fmt and remove DPRINTK, then
    replace all DPRINTK with pr_debug.

    Also fixed up some comments just as eliminate redundant whitespace
    and format the code.

    These will make the code easier to read.

    Signed-off-by: Tao Chen
    Reviewed-by: Juergen Gross
    Signed-off-by: David Vrabel

    Tao Chen
     

24 Feb, 2015

1 commit

  • A request in the ring buffer mustn't be read after it has been marked
    as consumed. Otherwise it might already have been reused by the
    frontend without violating the ring protocol.

    To avoid inconsistencies in the backend only work on a private copy
    of the request. This will ensure a malicious guest not being able to
    bypass consistency checks of the backend by modifying an active
    request.

    Signed-off-by: Juergen Gross
    Cc:
    Signed-off-by: David Vrabel

    Juergen Gross
     

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
    ...

    Linus Torvalds
     

28 Jan, 2015

1 commit


09 Jan, 2015

1 commit

  • Instead of having constants.c littered with ifdef statements we should
    be moving dummy functions into the header and condintionally compile in
    constants.c if selected. And update the Kconfig description to reflect
    the actual size difference.

    Suggested-by: Christoph Hellwig
    Tested-by: Robert Elliott
    Reviewed-by: Robert Elliott
    Signed-off-by: Hannes Reinecke
    Signed-off-by: Christoph Hellwig

    Hannes Reinecke
     

04 Dec, 2014

1 commit

  • 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

    Christoph Hellwig
     

12 Nov, 2014

1 commit


06 Oct, 2014

1 commit


23 Sep, 2014

2 commits

  • This code was confusing because we had an unsigned long and then we
    compared it to UINT_MAX and then we stored it in a u16. How many bytes
    is this supposed to have: 2, 4 or 16???

    I've made it a u16 throughout.

    Signed-off-by: Dan Carpenter
    Reviewed-by: Juergen Gross
    Signed-off-by: David Vrabel

    Dan Carpenter
     
  • Introduces the Xen pvSCSI backend. With pvSCSI it is possible for a
    Xen domU to issue SCSI commands to a SCSI LUN assigned to that
    domU. The SCSI commands are passed to the pvSCSI backend in a driver
    domain (usually Dom0) which is owner of the physical device. This
    allows e.g. to use SCSI tape drives in a Xen domU.

    The code is taken from the pvSCSI implementation in Xen done by
    Fujitsu based on Linux kernel 2.6.18.

    Changes from the original version are:
    - port to upstream kernel
    - put all code in just one source file
    - adapt to Linux style guide
    - use target core infrastructure instead doing pure pass-through
    - enable module unloading
    - support SG-list in grant page(s)
    - support task abort
    - remove redundant struct backend
    - allocate resources dynamically
    - correct minor error in scsiback_fast_flush_area
    - free allocated resources in case of error during I/O preparation
    - remove CDB emulation, now handled by target core infrastructure

    Signed-off-by: Juergen Gross
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: David Vrabel

    Juergen Gross