13 Jan, 2021

1 commit

  • commit 2896c93811e39d63a4d9b63ccf12a8fbc226e5e4 upstream.

    When attempting to match EXTENDED COPY CSCD descriptors with corresponding
    se_devices, target_xcopy_locate_se_dev_e4() currently iterates over LIO's
    global devices list which includes all configured backstores.

    This change ensures that only initiator-accessible backstores are
    considered during CSCD descriptor lookup, according to the session's
    se_node_acl LUN list.

    To avoid LUN removal race conditions, device pinning is changed from being
    configfs based to instead using the se_node_acl lun_ref.

    Reference: CVE-2020-28374
    Fixes: cbf031f425fd ("target: Add support for EXTENDED_COPY copy offload emulation")
    Reviewed-by: Lee Duncan
    Signed-off-by: David Disseldorp
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Greg Kroah-Hartman

    David Disseldorp
     

21 Nov, 2020

1 commit


17 Nov, 2020

1 commit

  • Maurizio found a race where the abort and cmd stop paths can race as
    follows:

    1. thread1 runs iscsit_release_commands_from_conn and sets
    CMD_T_FABRIC_STOP.

    2. thread2 runs iscsit_aborted_task and then does __iscsit_free_cmd. It
    then returns from the aborted_task callout and we finish
    target_handle_abort and do:

    target_handle_abort -> transport_cmd_check_stop_to_fabric ->
    lio_check_stop_free -> target_put_sess_cmd

    The cmd is now freed.

    3. thread1 now finishes iscsit_release_commands_from_conn and runs
    iscsit_free_cmd while accessing a command we just released.

    In __target_check_io_state we check for CMD_T_FABRIC_STOP and set the
    CMD_T_ABORTED if the driver is not cleaning up the cmd because of a session
    shutdown. However, iscsit_release_commands_from_conn only sets the
    CMD_T_FABRIC_STOP and does not check to see if the abort path has claimed
    completion ownership of the command.

    This adds a check in iscsit_release_commands_from_conn so only the abort or
    fabric stop path cleanup the command.

    Link: https://lore.kernel.org/r/1605318378-9269-1-git-send-email-michael.christie@oracle.com
    Reported-by: Maurizio Lombardi
    Reviewed-by: Maurizio Lombardi
    Signed-off-by: Mike Christie
    Signed-off-by: Martin K. Petersen

    Mike Christie
     

30 Oct, 2020

1 commit

  • There is a regular need in the kernel to provide a way to declare having a
    dynamically sized set of trailing elements in a structure. Kernel code should
    always use “flexible array members”[1] for these cases. The older style of
    one-element or zero-length arrays should no longer be used[2].

    [1] https://en.wikipedia.org/wiki/Flexible_array_member
    [2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

24 Oct, 2020

1 commit

  • Pull more SCSI updates from James Bottomley:
    "The set of core changes here is Christoph's submission path cleanups.

    These introduced a couple of regressions when first proposed so they
    got held over from the initial merge window pull request to give more
    testing time, which they've now had and Syzbot has confirmed the
    regression it detected is fixed.

    The other main changes are two driver updates (arcmsr, pm80xx) and
    assorted minor clean ups"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (38 commits)
    scsi: qla2xxx: Fix return of uninitialized value in rval
    scsi: core: Set sc_data_direction to DMA_NONE for no-transfer commands
    scsi: sr: Initialize ->cmd_len
    scsi: arcmsr: Update driver version to v1.50.00.02-20200819
    scsi: arcmsr: Add support for ARC-1886 series RAID controllers
    scsi: arcmsr: Fix device hot-plug monitoring timer stop
    scsi: arcmsr: Remove unnecessary syntax
    scsi: pm80xx: Driver version update
    scsi: pm80xx: Increase the number of outstanding I/O supported to 1024
    scsi: pm80xx: Remove DMA memory allocation for ccb and device structures
    scsi: pm80xx: Increase number of supported queues
    scsi: sym53c8xx_2: Fix sizeof() mismatch
    scsi: isci: Fix a typo in a comment
    scsi: qla4xxx: Fix inconsistent format argument type
    scsi: myrb: Fix inconsistent format argument types
    scsi: myrb: Remove redundant assignment to variable timeout
    scsi: bfa: Fix error return in bfad_pci_init()
    scsi: fcoe: Simplify the return expression of fcoe_sysfs_setup()
    scsi: snic: Simplify the return expression of svnic_cq_alloc()
    scsi: fnic: Simplify the return expression of vnic_wq_copy_alloc()
    ...

    Linus Torvalds
     

16 Oct, 2020

1 commit

  • Pull networking updates from Jakub Kicinski:

    - Add redirect_neigh() BPF packet redirect helper, allowing to limit
    stack traversal in common container configs and improving TCP
    back-pressure.

    Daniel reports ~10Gbps => ~15Gbps single stream TCP performance gain.

    - Expand netlink policy support and improve policy export to user
    space. (Ge)netlink core performs request validation according to
    declared policies. Expand the expressiveness of those policies
    (min/max length and bitmasks). Allow dumping policies for particular
    commands. This is used for feature discovery by user space (instead
    of kernel version parsing or trial and error).

    - Support IGMPv3/MLDv2 multicast listener discovery protocols in
    bridge.

    - Allow more than 255 IPv4 multicast interfaces.

    - Add support for Type of Service (ToS) reflection in SYN/SYN-ACK
    packets of TCPv6.

    - In Multi-patch TCP (MPTCP) support concurrent transmission of data on
    multiple subflows in a load balancing scenario. Enhance advertising
    addresses via the RM_ADDR/ADD_ADDR options.

    - Support SMC-Dv2 version of SMC, which enables multi-subnet
    deployments.

    - Allow more calls to same peer in RxRPC.

    - Support two new Controller Area Network (CAN) protocols - CAN-FD and
    ISO 15765-2:2016.

    - Add xfrm/IPsec compat layer, solving the 32bit user space on 64bit
    kernel problem.

    - Add TC actions for implementing MPLS L2 VPNs.

    - Improve nexthop code - e.g. handle various corner cases when nexthop
    objects are removed from groups better, skip unnecessary
    notifications and make it easier to offload nexthops into HW by
    converting to a blocking notifier.

    - Support adding and consuming TCP header options by BPF programs,
    opening the doors for easy experimental and deployment-specific TCP
    option use.

    - Reorganize TCP congestion control (CC) initialization to simplify
    life of TCP CC implemented in BPF.

    - Add support for shipping BPF programs with the kernel and loading
    them early on boot via the User Mode Driver mechanism, hence reusing
    all the user space infra we have.

    - Support sleepable BPF programs, initially targeting LSM and tracing.

    - Add bpf_d_path() helper for returning full path for given 'struct
    path'.

    - Make bpf_tail_call compatible with bpf-to-bpf calls.

    - Allow BPF programs to call map_update_elem on sockmaps.

    - Add BPF Type Format (BTF) support for type and enum discovery, as
    well as support for using BTF within the kernel itself (current use
    is for pretty printing structures).

    - Support listing and getting information about bpf_links via the bpf
    syscall.

    - Enhance kernel interfaces around NIC firmware update. Allow
    specifying overwrite mask to control if settings etc. are reset
    during update; report expected max time operation may take to users;
    support firmware activation without machine reboot incl. limits of
    how much impact reset may have (e.g. dropping link or not).

    - Extend ethtool configuration interface to report IEEE-standard
    counters, to limit the need for per-vendor logic in user space.

    - Adopt or extend devlink use for debug, monitoring, fw update in many
    drivers (dsa loop, ice, ionic, sja1105, qed, mlxsw, mv88e6xxx,
    dpaa2-eth).

    - In mlxsw expose critical and emergency SFP module temperature alarms.
    Refactor port buffer handling to make the defaults more suitable and
    support setting these values explicitly via the DCBNL interface.

    - Add XDP support for Intel's igb driver.

    - Support offloading TC flower classification and filtering rules to
    mscc_ocelot switches.

    - Add PTP support for Marvell Octeontx2 and PP2.2 hardware, as well as
    fixed interval period pulse generator and one-step timestamping in
    dpaa-eth.

    - Add support for various auth offloads in WiFi APs, e.g. SAE (WPA3)
    offload.

    - Add Lynx PHY/PCS MDIO module, and convert various drivers which have
    this HW to use it. Convert mvpp2 to split PCS.

    - Support Marvell Prestera 98DX3255 24-port switch ASICs, as well as
    7-port Mediatek MT7531 IP.

    - Add initial support for QCA6390 and IPQ6018 in ath11k WiFi driver,
    and wcn3680 support in wcn36xx.

    - Improve performance for packets which don't require much offloads on
    recent Mellanox NICs by 20% by making multiple packets share a
    descriptor entry.

    - Move chelsio inline crypto drivers (for TLS and IPsec) from the
    crypto subtree to drivers/net. Move MDIO drivers out of the phy
    directory.

    - Clean up a lot of W=1 warnings, reportedly the actively developed
    subsections of networking drivers should now build W=1 warning free.

    - Make sure drivers don't use in_interrupt() to dynamically adapt their
    code. Convert tasklets to use new tasklet_setup API (sadly this
    conversion is not yet complete).

    * tag 'net-next-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next: (2583 commits)
    Revert "bpfilter: Fix build error with CONFIG_BPFILTER_UMH"
    net, sockmap: Don't call bpf_prog_put() on NULL pointer
    bpf, selftest: Fix flaky tcp_hdr_options test when adding addr to lo
    bpf, sockmap: Add locking annotations to iterator
    netfilter: nftables: allow re-computing sctp CRC-32C in 'payload' statements
    net: fix pos incrementment in ipv6_route_seq_next
    net/smc: fix invalid return code in smcd_new_buf_create()
    net/smc: fix valid DMBE buffer sizes
    net/smc: fix use-after-free of delayed events
    bpfilter: Fix build error with CONFIG_BPFILTER_UMH
    cxgb4/ch_ipsec: Replace the module name to ch_ipsec from chcr
    net: sched: Fix suspicious RCU usage while accessing tcf_tunnel_info
    bpf: Fix register equivalence tracking.
    rxrpc: Fix loss of final ack on shutdown
    rxrpc: Fix bundle counting for exclusive connections
    netfilter: restore NF_INET_NUMHOOKS
    ibmveth: Identify ingress large send packets.
    ibmveth: Switch order of ibmveth_helper calls.
    cxgb4: handle 4-tuple PEDIT to NAT mode translation
    selftests: Add VRF route leaking tests
    ...

    Linus Torvalds
     

15 Oct, 2020

1 commit

  • Pull SCSI updates from James Bottomley:
    "The usual driver updates (ufs, qla2xxx, tcmu, ibmvfc, lpfc, smartpqi,
    hisi_sas, qedi, qedf, mpt3sas) and minor bug fixes.

    There are only three core changes: adding sense codes, cleaning up
    noretry and adding an option for limitless retries"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (226 commits)
    scsi: hisi_sas: Recover PHY state according to the status before reset
    scsi: hisi_sas: Filter out new PHY up events during suspend
    scsi: hisi_sas: Add device link between SCSI devices and hisi_hba
    scsi: hisi_sas: Add check for methods _PS0 and _PR0
    scsi: hisi_sas: Add controller runtime PM support for v3 hw
    scsi: hisi_sas: Switch to new framework to support suspend and resume
    scsi: hisi_sas: Use hisi_hba->cq_nvecs for calling calling synchronize_irq()
    scsi: qedf: Remove redundant assignment to variable 'rc'
    scsi: lpfc: Remove unneeded variable 'status' in lpfc_fcp_cpu_map_store()
    scsi: snic: Convert to use DEFINE_SEQ_ATTRIBUTE macro
    scsi: qla4xxx: Delete unneeded variable 'status' in qla4xxx_process_ddb_changed
    scsi: sun_esp: Use module_platform_driver to simplify the code
    scsi: sun3x_esp: Use module_platform_driver to simplify the code
    scsi: sni_53c710: Use module_platform_driver to simplify the code
    scsi: qlogicpti: Use module_platform_driver to simplify the code
    scsi: mac_esp: Use module_platform_driver to simplify the code
    scsi: jazz_esp: Use module_platform_driver to simplify the code
    scsi: mvumi: Fix error return in mvumi_io_attach()
    scsi: lpfc: Drop nodelist reference on error in lpfc_gen_req()
    scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs()
    ...

    Linus Torvalds
     

14 Oct, 2020

1 commit

  • Pull block updates from Jens Axboe:

    - Series of merge handling cleanups (Baolin, Christoph)

    - Series of blk-throttle fixes and cleanups (Baolin)

    - Series cleaning up BDI, seperating the block device from the
    backing_dev_info (Christoph)

    - Removal of bdget() as a generic API (Christoph)

    - Removal of blkdev_get() as a generic API (Christoph)

    - Cleanup of is-partition checks (Christoph)

    - Series reworking disk revalidation (Christoph)

    - Series cleaning up bio flags (Christoph)

    - bio crypt fixes (Eric)

    - IO stats inflight tweak (Gabriel)

    - blk-mq tags fixes (Hannes)

    - Buffer invalidation fixes (Jan)

    - Allow soft limits for zone append (Johannes)

    - Shared tag set improvements (John, Kashyap)

    - Allow IOPRIO_CLASS_RT for CAP_SYS_NICE (Khazhismel)

    - DM no-wait support (Mike, Konstantin)

    - Request allocation improvements (Ming)

    - Allow md/dm/bcache to use IO stat helpers (Song)

    - Series improving blk-iocost (Tejun)

    - Various cleanups (Geert, Damien, Danny, Julia, Tetsuo, Tian, Wang,
    Xianting, Yang, Yufen, yangerkun)

    * tag 'block-5.10-2020-10-12' of git://git.kernel.dk/linux-block: (191 commits)
    block: fix uapi blkzoned.h comments
    blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue
    blk-mq: get rid of the dead flush handle code path
    block: get rid of unnecessary local variable
    block: fix comment and add lockdep assert
    blk-mq: use helper function to test hw stopped
    block: use helper function to test queue register
    block: remove redundant mq check
    block: invoke blk_mq_exit_sched no matter whether have .exit_sched
    percpu_ref: don't refer to ref->data if it isn't allocated
    block: ratelimit handle_bad_sector() message
    blk-throttle: Re-use the throtl_set_slice_end()
    blk-throttle: Open code __throtl_de/enqueue_tg()
    blk-throttle: Move service tree validation out of the throtl_rb_first()
    blk-throttle: Move the list operation after list validation
    blk-throttle: Fix IO hang for a corner case
    blk-throttle: Avoid tracking latency if low limit is invalid
    blk-throttle: Avoid getting the current time if tg->last_finish_time is 0
    blk-throttle: Remove a meaningless parameter for throtl_downgrade_state()
    block: Remove redundant 'return' statement
    ...

    Linus Torvalds
     

08 Oct, 2020

1 commit

  • sg_init_table zeroes its first argument, so the allocation of that argument
    doesn't have to.

    the semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    expression x,n,flags;
    @@

    x =
    - kcalloc
    + kmalloc_array
    (n,sizeof(*x),flags)
    ...
    sg_init_table(x,n)
    //

    Link: https://lore.kernel.org/r/1600601186-7420-3-git-send-email-Julia.Lawall@inria.fr
    Signed-off-by: Julia Lawall
    Signed-off-by: Martin K. Petersen

    Julia Lawall
     

06 Oct, 2020

1 commit


03 Oct, 2020

3 commits


25 Sep, 2020

1 commit


23 Sep, 2020

4 commits

  • transport_lookup_tmr_lun() uses "orig_fe_lun" member of struct se_cmd for
    the lookup. Hence, update this field directly for the
    TARGET_SCF_LOOKUP_LUN_FROM_TAG case.

    Link: https://lore.kernel.org/r/1600300471-26135-1-git-send-email-sudhakar.panneerselvam@oracle.com
    Fixes: a36840d80027 ("target: Initialize LUN in transport_init_se_cmd()")
    Reported-by: Martin Wilck
    Reviewed-by: Mike Christie
    Signed-off-by: Sudhakar Panneerselvam
    Signed-off-by: Martin K. Petersen

    Sudhakar Panneerselvam
     
  • scatter_data_area() has two purposes:

    1) Create the iovs for the data area buffer of a SCSI cmd.

    2) If there is data in DMA_TO_DEVICE direction, copy
    the data from sg_list to data area buffer.

    Both are done in a common loop.

    In case of DMA_FROM_DEVICE data transfer, scatter_data_area() is called
    with parameter copy_data = false. But this flag is just used to skip
    memcpy() for data, while radix_tree_lookup still is called for every dbi of
    the area area buffer, and kmap and kunmap are called for every page from
    sg_list and data_area as well as flush_dcache_page() for the data area
    pages. Since the only thing to do with copy_data = false would be to set
    up the iovs, this is a noticeable overhead. Rework the iov creation in the
    main loop of scatter_data_area() providing the new function
    new_block_to_iov(). Based on this, create the short new function
    tcmu_setup_iovs() that only writes the iovs with no overhead. This new
    function is now called instead of scatter_data_area() for bidi buffers and
    for data buffers in those cases where memcpy() would have been skipped.

    Link: https://lore.kernel.org/r/20200910155041.17654-4-bstroesser@ts.fujitsu.com
    Acked-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • queue_cmd_ring() needs to check whether there is enough space in cmd ring
    and data area for the cmd to queue.

    Currently the sequence is:

    1) Calculate size the cmd will occupy on the ring based on estimation of
    needed iovs.

    2) Check whether there is enough space on the ring based on size from 1)

    3) Allocate buffers in data area.

    4) Calculate number of iovs the command really needs while copying
    incoming data (if any) to data area.

    5) Re-calculate real size of cmd on ring based on real number of iovs.

    6) Set up possible padding and cmd on the ring.

    Step 1) must not underestimate the cmd size so use max possible number of
    iovs for the given I/O data size. The resulting overestimation can be
    really high so this sequence is not ideal. The earliest the real number of
    iovs can be calculated is after data buffer allocation. Therefore rework
    the code to implement the following sequence:

    A) Allocate buffers on data area and calculate number of necessary iovs
    during this.

    B) Calculate real size of cmd on ring based on number of iovs.

    C) Check whether there is enough space on the ring.

    D) Set up possible padding and cmd on the ring.

    The new sequence enforces the split of new function tcmu_alloc_data_space()
    from is_ring_space_avail(). Using this function, change queue_cmd_ring()
    according to the new sequence.

    Change routines called by tcmu_alloc_data_space() to allow calculating and
    returning the iov count. Remove counting of iovs in scatter_data_area().

    Link: https://lore.kernel.org/r/20200910155041.17654-3-bstroesser@ts.fujitsu.com
    Acked-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • Simplify code by joining tcmu_cmd_get_data_length() and
    tcmu_cmd_get_block_cnt() into tcmu_cmd_set_block_cnts(). The new function
    sets tcmu_cmd->dbi_cnt and also the new field tcmu_cmd->dbi_bidi_cnt which
    is needed for further enhancements in following patches. Simplify some
    code by using tcmu_cmd->dbi(_bidi)_cnt instead of calculation from length.

    Please note: The calculation of the number of dbis needed for bidi was
    wrong. It was based on the length of the first bidi sg only. I changed it
    to correctly sum up entire length of all bidi sgs.

    Link: https://lore.kernel.org/r/20200910155041.17654-2-bstroesser@ts.fujitsu.com
    Acked-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     

16 Sep, 2020

2 commits


09 Sep, 2020

1 commit

  • Pull SCSI fixes from James Bottomley:
    "Eleven fixes, mostly in drivers or minor fixes in driver related
    infrastructure libraries (target, libfc and libsas).

    Most of the bugs fixed only show up under rare circumstances, the
    exception being the endianness problem in qla2xxx which is used as a
    device on some sparc systems"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: mpt3sas: Don't call disable_irq from IRQ poll handler
    scsi: megaraid_sas: Don't call disable_irq from process IRQ poll
    scsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem
    scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA
    scsi: target: iscsi: Fix data digest calculation
    scsi: lpfc: Update lpfc version to 12.8.0.4
    scsi: lpfc: Extend the RDF FPIN Registration descriptor for additional events
    scsi: lpfc: Fix FLOGI/PLOGI receive race condition in pt2pt discovery
    scsi: lpfc: Fix setting IRQ affinity with an empty CPU mask
    scsi: qla2xxx: Fix regression on sparc64
    scsi: libfc: Fix for double free()
    scsi: pm8001: Fix memleak in pm8001_exec_internal_task_abort

    Linus Torvalds
     

03 Sep, 2020

1 commit

  • The iSCSI target login thread might get stuck with the following stack:

    cat /proc/`pidof iscsi_np`/stack
    [] down_interruptible+0x42/0x50
    [] iscsit_access_np+0xe3/0x167
    [] iscsi_target_locate_portal+0x695/0x8ac
    [] __iscsi_target_login_thread+0x855/0xb82
    [] iscsi_target_login_thread+0x2f/0x5a
    [] kthread+0xfa/0x130
    [] ret_from_fork+0x1f/0x30

    This can be reproduced via the following steps:

    1. Initiator A tries to log in to iqn1-tpg1 on port 3260. After finishing
    PDU exchange in the login thread and before the negotiation is finished
    the the network link goes down. At this point A has not finished login
    and tpg->np_login_sem is held.

    2. Initiator B tries to log in to iqn2-tpg1 on port 3260. After finishing
    PDU exchange in the login thread the target expects to process remaining
    login PDUs in workqueue context.

    3. Initiator A' tries to log in to iqn1-tpg1 on port 3260 from a new
    socket. A' will wait for tpg->np_login_sem with np->np_login_timer
    loaded to wait for at most 15 seconds. The lock is held by A so A'
    eventually times out.

    4. Before A' got timeout initiator B gets negotiation failed and calls
    iscsi_target_login_drop()->iscsi_target_login_sess_out(). The
    np->np_login_timer is canceled and initiator A' will hang forever.
    Because A' is now in the login thread, no new login requests can be
    serviced.

    Fix this by moving iscsi_stop_login_thread_timer() out of
    iscsi_target_login_sess_out(). Also remove iscsi_np parameter from
    iscsi_target_login_sess_out().

    Link: https://lore.kernel.org/r/20200729130343.24976-1-houpu@bytedance.com
    Cc: stable@vger.kernel.org
    Reviewed-by: Mike Christie
    Signed-off-by: Hou Pu
    Signed-off-by: Martin K. Petersen

    Hou Pu
     

02 Sep, 2020

1 commit

  • Current code does not consider 'page_off' in data digest calculation. To
    fix this, add a local variable 'first_sg' and set first_sg.offset to
    sg->offset + page_off.

    Link: https://lore.kernel.org/r/1598358910-3052-1-git-send-email-varun@chelsio.com
    Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1")
    Cc:
    Reviewed-by: Mike Christie
    Signed-off-by: Varun Prakash
    Signed-off-by: Martin K. Petersen

    Varun Prakash
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

15 Aug, 2020

1 commit

  • Pull more SCSI updates from James Bottomley:
    "This is the set of patches which arrived too late to stabilise in
    -next for the first pull.

    It's really just an lpfc driver update and an assortment of minor
    fixes, all in drivers. The only core update is to the zone block
    device driver, which isn't the one most people use"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: lpfc: Update lpfc version to 12.8.0.3
    scsi: lpfc: Fix LUN loss after cable pull
    scsi: lpfc: Fix validation of bsg reply lengths
    scsi: lpfc: Fix retry of PRLI when status indicates its unsupported
    scsi: lpfc: Fix oops when unloading driver while running mds diags
    scsi: lpfc: Fix RSCN timeout due to incorrect gidft counter
    scsi: lpfc: Fix no message shown for lpfc_hdw_queue out of range value
    scsi: lpfc: Fix FCoE speed reporting
    scsi: lpfc: Add missing misc_deregister() for lpfc_init()
    scsi: lpfc: nvmet: Avoid hang / use-after-free again when destroying targetport
    scsi: scsi_transport_sas: Add spaces around binary operator "|"
    scsi: sd_zbc: Improve zone revalidation
    scsi: libfc: Free skb in fc_disc_gpn_id_resp() for valid cases
    scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()
    scsi: target: Make iscsit_register_transport() return void

    Linus Torvalds
     

08 Aug, 2020

2 commits

  • Merge misc updates from Andrew Morton:

    - a few MM hotfixes

    - kthread, tools, scripts, ntfs and ocfs2

    - some of MM

    Subsystems affected by this patch series: kthread, tools, scripts, ntfs,
    ocfs2 and mm (hofixes, pagealloc, slab-generic, slab, slub, kcsan,
    debug, pagecache, gup, swap, shmem, memcg, pagemap, mremap, mincore,
    sparsemem, vmalloc, kasan, pagealloc, hugetlb and vmscan).

    * emailed patches from Andrew Morton : (162 commits)
    mm: vmscan: consistent update to pgrefill
    mm/vmscan.c: fix typo
    khugepaged: khugepaged_test_exit() check mmget_still_valid()
    khugepaged: retract_page_tables() remember to test exit
    khugepaged: collapse_pte_mapped_thp() protect the pmd lock
    khugepaged: collapse_pte_mapped_thp() flush the right range
    mm/hugetlb: fix calculation of adjust_range_if_pmd_sharing_possible
    mm: thp: replace HTTP links with HTTPS ones
    mm/page_alloc: fix memalloc_nocma_{save/restore} APIs
    mm/page_alloc.c: skip setting nodemask when we are in interrupt
    mm/page_alloc: fallbacks at most has 3 elements
    mm/page_alloc: silence a KASAN false positive
    mm/page_alloc.c: remove unnecessary end_bitidx for [set|get]_pfnblock_flags_mask()
    mm/page_alloc.c: simplify pageblock bitmap access
    mm/page_alloc.c: extract the common part in pfn_to_bitidx()
    mm/page_alloc.c: replace the definition of NR_MIGRATETYPE_BITS with PB_migratetype_bits
    mm/shuffle: remove dynamic reconfiguration
    mm/memory_hotplug: document why shuffle_zone() is relevant
    mm/page_alloc: remove nr_free_pagecache_pages()
    mm: remove vm_total_pages
    ...

    Linus Torvalds
     
  • As said by Linus:

    A symmetric naming is only helpful if it implies symmetries in use.
    Otherwise it's actively misleading.

    In "kzalloc()", the z is meaningful and an important part of what the
    caller wants.

    In "kzfree()", the z is actively detrimental, because maybe in the
    future we really _might_ want to use that "memfill(0xdeadbeef)" or
    something. The "zero" part of the interface isn't even _relevant_.

    The main reason that kzfree() exists is to clear sensitive information
    that should not be leaked to other future users of the same memory
    objects.

    Rename kzfree() to kfree_sensitive() to follow the example of the recently
    added kvfree_sensitive() and make the intention of the API more explicit.
    In addition, memzero_explicit() is used to clear the memory to make sure
    that it won't get optimized away by the compiler.

    The renaming is done by using the command sequence:

    git grep -w --name-only kzfree |\
    xargs sed -i 's/kzfree/kfree_sensitive/'

    followed by some editing of the kfree_sensitive() kerneldoc and adding
    a kzfree backward compatibility macro in slab.h.

    [akpm@linux-foundation.org: fs/crypto/inline_crypt.c needs linux/slab.h]
    [akpm@linux-foundation.org: fix fs/crypto/inline_crypt.c some more]

    Suggested-by: Joe Perches
    Signed-off-by: Waiman Long
    Signed-off-by: Andrew Morton
    Acked-by: David Howells
    Acked-by: Michal Hocko
    Acked-by: Johannes Weiner
    Cc: Jarkko Sakkinen
    Cc: James Morris
    Cc: "Serge E. Hallyn"
    Cc: Joe Perches
    Cc: Matthew Wilcox
    Cc: David Rientjes
    Cc: Dan Carpenter
    Cc: "Jason A . Donenfeld"
    Link: http://lkml.kernel.org/r/20200616154311.12314-3-longman@redhat.com
    Signed-off-by: Linus Torvalds

    Waiman Long
     

05 Aug, 2020

1 commit


29 Jul, 2020

10 commits

  • Add "tmr_notification" configfs attribute to tcmu devices. If the default
    value 0 is used, tcmu only removes aborted commands from qfull_queue. If
    user changes tmr_notification to 1, additionally TMR notifications will be
    written to the cmd ring.

    Link: https://lore.kernel.org/r/20200726153510.13077-9-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • This patch implements the tmr_notify callback for tcmu. When the callback
    is called, tcmu checks the list of aborted commands it received as
    parameter:

    - aborted commands in the qfull_queue are removed from the queue and
    target_complete_command is called

    - from the cmd_ids of aborted commands currently uncompleted in cmd ring
    it creates a list of aborted cmd_ids.

    Finally a TMR notification is written to cmd ring containing TMR type and
    cmd_id list. If there is no space in ring, the TMR notification is queued
    on a TMR specific queue.

    The TMR specific queue 'tmr_queue' can be seen as a extension of the cmd
    ring. At the end of each iexecution of tcmu_complete_commands() we check
    whether tmr_queue contains TMRs and try to move them onto the ring. If
    tmr_queue is not empty after that, we don't call run_qfull_queue() because
    commands must not overtake TMRs.

    This way we guarantee that cmd_ids in TMR notification received by
    userspace either match an active, not yet completed command or are no
    longer valid due to userspace having complete some cmd_ids meanwhile.

    New commands that were assigned to an aborted cmd_id will always appear on
    the cmd ring _after_ the TMR.

    Link: https://lore.kernel.org/r/20200726153510.13077-8-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • During cmd timeout handling in check_timedout_devices(), due to a race, it
    can happen that tcmu_set_next_deadline() does not start a timer as
    expected:

    1) Either tcmu_check_expired_ring_cmd() checks the inflight_queue or
    tcmu_check_expired_queue_cmd() checks the qfull_queue while jiffies has
    the value X

    2) At the end of the check the queue contains one remaining command with
    deadline X (time_after(X, X) is false and thus the command is not
    handled as being timed out).

    3) After tcmu_check_expired_xxxxx_cmd() a timer interrupt happens and
    jiffies is incremented to X+1.

    4) Now tcmu_set_next_deadline() is called, but it skips the command, since
    time_after(X+1, X) is true. Therefore tcmu_set_next_deadline() finds no
    new deadline and stops the timer, which it shouldn't.

    Since commands that time out are removed from inflight_queue or
    qfull_queue, we don't need the check with time_after() in
    tcmu_set_next_deadline() but can use the deadline from the first cmd in
    the queue.

    Additionally, replace the remaining time_after() calls in
    tcmu_check_expired_xxxxx_cmd() with time_after_eq(), because it is not
    useful to set the timeout to deadline but then check for jiffies being
    greater than deadline.

    Simplify the end of tcmu_handle_completions() and change the check for no
    more pending commands from

    mb->cmd_tail == mb->cmd_head
    to

    idr_is_empty(&udev->commands)

    because the old check doesn't work correctly if paddings or in the future
    TMRs are in the ring.

    Finally tcmu_set_next_deadline() was shifted in the source as
    preparation for later implementation of tmr_notify callback.

    Link: https://lore.kernel.org/r/20200726153510.13077-7-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • The new helper ring_insert_padding is split off from and then called by
    queue_cmd_ring. It inserts a padding if necessary. The new helper will in
    a subsequent patch be used during writing of TMR notifications to command
    ring.

    Link: https://lore.kernel.org/r/20200726153510.13077-6-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • If tcmu receives an already aborted command, tcmu_queue_cmd() should reject
    it.

    Link: https://lore.kernel.org/r/20200726153510.13077-5-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • We initialize and clean up the se_cmd's priv pointer under cmd_ring_lock to
    point to the corresponding tcmu_cmd.

    In the patch that implements tmr_notify callback in tcmu we will use the
    priv pointer.

    Link: https://lore.kernel.org/r/20200726153510.13077-4-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • Target core is modified to call an optional backend callback function if a
    TMR is received or commands are aborted implicitly after a PR command was
    received. The backend function takes as parameters the se_dev, the type of
    the TMR, and the list of aborted commands. If no commands were aborted, an
    empty list is supplied.

    Link: https://lore.kernel.org/r/20200726153510.13077-3-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • This patch modifies core_tmr_abort_task() to use same looping and locking
    scheme as core_tmr_drain_state_list() does.

    This frees the state_list element in se_cmd for later use by tmr
    notification handling.

    Note: __target_check_io_state() now is called with param 0 instead of
    dev->dev_attrib.emulate_tas, because tas is not relevant since we always
    get ABRT on same session like the aborted command.

    Link: https://lore.kernel.org/r/20200726153510.13077-2-bstroesser@ts.fujitsu.com
    Reviewed-by: Mike Christie
    Signed-off-by: Bodo Stroesser
    Signed-off-by: Martin K. Petersen

    Bodo Stroesser
     
  • Commit 25cdda95fda7 ("iscsi-target: Fix initial login PDU asynchronous
    socket close OOPs") changed the return value of
    __iscsi_target_sk_check_close(). However, pr_debug is still printing FALSE
    when returning TRUE which is a little confusing.

    Link: https://lore.kernel.org/r/20200716100212.4237-3-houpu@bytedance.com
    Reviewed-by: Mike Christie
    Signed-off-by: Hou Pu
    Signed-off-by: Martin K. Petersen

    Hou Pu
     
  • iscsi_target_sk_data_ready() could be invoked indirectly by
    iscsi_target_do_login_rx() from the workqueue like this:

    iscsi_target_do_login_rx()
    iscsi_target_do_login()
    iscsi_target_do_tx_login_io()
    iscsit_put_login_tx()
    iscsi_login_tx_data()
    tx_data()
    sock_sendmsg_nosec()
    tcp_sendmsg()
    release_sock()
    sk_backlog_rcv()
    tcp_v4_do_rcv()
    tcp_data_ready()
    iscsi_target_sk_data_ready()

    At that time LOGIN_FLAGS_READ_ACTIVE is not cleared and
    iscsi_target_sk_data_ready will not read data from the socket. Some iscsi
    initiators (libiscsi) will wait forever for a reply.

    LOGIN_FLAGS_READ_ACTIVE should be cleared early just after doing the
    receive and before writing to the socket in iscsi_target_do_login_rx.

    Unfortunately, LOGIN_FLAGS_READ_ACTIVE is also used by sk_state_change to
    do login cleanup if a socket was closed at login time. It is supposed to be
    cleared after the login PDU is successfully processed and replied.

    Introduce another flag, LOGIN_FLAGS_WRITE_ACTIVE, to cover the transmit
    part.

    Link: https://lore.kernel.org/r/20200716100212.4237-2-houpu@bytedance.com
    Reviewed-by: Mike Christie
    Signed-off-by: Hou Pu
    Signed-off-by: Martin K. Petersen

    Hou Pu
     

14 Jul, 2020

1 commit

  • Gcc reports warning as follows:

    drivers/target/target_core_pr.c:1162:26: warning:
    variable 'tpg' set but not used [-Wunused-but-set-variable]
    1162 | struct se_portal_group *tpg;
    | ^~~

    After commit 63c9ffe473d3 ("scsi: target: Check enforce_pr_isids during
    registration"), 'tpg' is never used. Remove it to avoid build warning.

    Link: https://lore.kernel.org/r/20200709114636.69256-1-weiyongjun1@huawei.com
    Reported-by: Hulk Robot
    Reviewed-by: Chaitanya Kulkarni
    Reviewed-by: Himanshu Madhani
    Reviewed-by: Mike Christie
    Signed-off-by: Wei Yongjun
    Signed-off-by: Martin K. Petersen

    Wei Yongjun
     

08 Jul, 2020

1 commit