03 Aug, 2015

1 commit


31 Jul, 2015

4 commits

  • Fix a memory leak with scsi-mq triggered by commands with large data
    transfer length.

    __sg_alloc_table() sets both table->nents and table->orig_nents to the
    same value. When the scatterlist is DMA-mapped, table->nents is
    overwritten with the (possibly smaller) size of the DMA-mapped
    scatterlist, while table->orig_nents retains the original size of the
    allocated scatterlist. scsi_free_sgtable() should therefore check
    orig_nents instead of nents, and all code that initializes sdb->table
    without calling __sg_alloc_table() should set both nents and orig_nents.

    Fixes: d285203cf647 ("scsi: add support for a blk-mq based I/O path.")
    Cc: # 3.17+
    Signed-off-by: Tony Battersby
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Ewan D. Milne
    Signed-off-by: James Bottomley

    Tony Battersby
     
  • Fixes another signed / unsigned array indexing bug in the ipr driver.
    Currently, when hrrq_index wraps, it becomes a negative number. We
    do the modulo, but still have a negative number, so we end up indexing
    backwards in the array. Given where the hrrq array is located in memory,
    we probably won't actually reference memory we don't own, but nonetheless
    ipr is still looking at data within struct ipr_ioa_cfg and interpreting it as
    struct ipr_hrr_queue data, so bad things could certainly happen.

    Each ipr adapter has anywhere from 1 to 16 HRRQs. By default, we use 2 on new
    adapters. Let's take an example:

    Assume ioa_cfg->hrrq_index=0x7fffffffe and ioa_cfg->hrrq_num=4:

    The atomic_add_return will then return -1. We mod this with 3 and get -2, add
    one and get -1 for an array index.

    On adapters which support more than a single HRRQ, we dedicate HRRQ to adapter
    initialization and error interrupts so that we can optimize the other queues
    for fast path I/O. So all normal I/O uses HRRQ 1-15. So we want to spread the
    I/O requests across those HRRQs.

    With the default module parameter settings, this bug won't hit, only when
    someone sets the ipr.number_of_msix parameter to a value larger than 3 is when
    bad things start to happen.

    Cc:
    Tested-by: Wen Xiong
    Reviewed-by: Wen Xiong
    Reviewed-by: Gabriel Krisman Bertazi
    Signed-off-by: Brian King
    Reviewed-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Brian King
     
  • When ipr's internal driver trace was changed to an atomic, a signed/unsigned
    bug slipped in which results in us indexing backwards in our memory buffer
    writing on memory that does not belong to us. This patch fixes this by removing
    the modulo and instead just mask off the low bits.

    Cc:
    Tested-by: Wen Xiong
    Reviewed-by: Wen Xiong
    Reviewed-by: Gabriel Krisman Bertazi
    Signed-off-by: Brian King
    Reviewed-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Brian King
     
  • Make sure we have the host lock held when calling scsi_report_bus_reset. Fixes
    a crash seen as the __devices list in the scsi host was changing as we were
    iterating through it.

    Cc:
    Reviewed-by: Wen Xiong
    Reviewed-by: Gabriel Krisman Bertazi
    Signed-off-by: Brian King
    Reviewed-by: Martin K. Petersen
    Signed-off-by: James Bottomley

    Brian King
     

30 Jul, 2015

1 commit

  • Pull SCSI target fixes from Nicholas Bellinger:
    "This series is larger than what I'd normally be conformable with
    sending for a -rc5 PULL request..

    However, the bulk of the series is localized to qla2xxx target
    specific fixes that address a number of real-world correctness issues,
    that have been outstanding on the list for ~6 weeks now. They where
    submitted + verified + acked by the HW LLD vendor, contributed by a
    major production customer of the code, and are marked for v3.18.y
    stable code.

    That said, I don't see a good reason to wait another month to get
    these fixes into mainline.

    Beyond the qla2xx specific fixes, this series also includes:

    - bugfix for a long standing use-after-free in iscsi-target during
    TPG shutdown + demo-mode sessions.

    - bugfix for a >= v4.0 regression OOPs in iscsi-target during a
    iscsi_start_kthreads() failure.

    - bugfix for a >= v4.0 regression hang in iscsi-target for iser
    explicit session/connection logout.

    - bugfix for a iser-target bug where a early CMA REJECTED status
    during login triggers a NULL pointer dereference OOPs.

    - bugfixes for a handful of v4.2-rc1 specific regressions related to
    the larger set of recent backend configfs attribute changes.

    A big thanks to QLogic + Pure Storage for the qla2xxx target bugfixes"

    * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (28 commits)
    Documentation/target: Fix tcm_mod_builder.py build breakage
    iser-target: Fix REJECT CM event use-after-free OOPs
    iscsi-target: Fix iser explicit logout TX kthread leak
    iscsi-target: Fix iscsit_start_kthreads failure OOPs
    iscsi-target: Fix use-after-free during TPG session shutdown
    qla2xxx: terminate exchange when command is aborted by LIO
    qla2xxx: drop cmds/tmrs arrived while session is being deleted
    qla2xxx: disable scsi_transport_fc registration in target mode
    qla2xxx: added sess generations to detect RSCN update races
    qla2xxx: Abort stale cmds on qla_tgt_wq when plogi arrives
    qla2xxx: delay plogi/prli ack until existing sessions are deleted
    qla2xxx: cleanup cmd in qla workqueue before processing TMR
    qla2xxx: kill sessions/log out initiator on RSCN and port down events
    qla2xxx: fix command initialization in target mode.
    qla2xxx: Remove msleep in qlt_send_term_exchange
    qla2xxx: adjust debug flags
    qla2xxx: release request queue reservation.
    qla2xxx: Add flush after updating ATIOQ consumer index.
    qla2xxx: Enable target mode for ISP27XX
    qla2xxx: Fix hardware lock/unlock issue causing kernel panic.
    ...

    Linus Torvalds
     

25 Jul, 2015

15 commits

  • The newly introduced aborted_task TFO callback has to terminate
    exchange with QLogic driver, since command is being deleted and
    no status will be queued to the driver at a later point.

    This patch also moves the burden of releasing one cmd refcount to
    the aborted_task handler.

    Changed iSCSI aborted_task logic to satisfy the above requirement.

    Cc: # v3.18+
    Signed-off-by: Alexei Potashnik
    Acked-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Alexei Potashnik
     
  • If a new initiator (different WWN) shows up on the same fcport, old
    initiator's session is scheduled for deletion. But there is a small
    window between it being marked with QLA_SESS_DELETION_IN_PROGRESS
    and qlt_unret_sess getting called when new session's commands will
    keep finding old session in the fcport map.

    This patch drops cmds/tmrs if they find session in the progress of
    being deleted.

    Cc: # v3.18+
    Signed-off-by: Alexei Potashnik
    Acked-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Alexei Potashnik
     
  • There are multiple reasons for disabling this:

    1. It provides no functional benefit. We pretty much only get a few more
    sysfs entries for each port, but all that information is already
    available from /sys/kernel/debug/target/qla-session-X

    2. It already only works in private-loop mode. By disabling we'll be
    getting more uniform behavior with fabric mode.

    3. It creates complications for the new PLOGI handling mechanism:
    scsi_transport_fc port deletion timer could race with new session
    from initiator and cause logout after successful login.

    Cc: # v3.18+
    Signed-off-by: Alexei Potashnik
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Alexei Potashnik
     
  • RSCN processing in qla2xxx driver can run in parallel with ELS/IO
    processing. As such the decision to remove disappeared fc port's
    session could be stale, because a new login sequence has occurred
    since and created a brand new session.

    Previous mechanism of dealing with this by delaying deletion request
    was prone to erroneous deletions if the event that was supposed to
    cancel the deletion never arrived or has been delayed in processing.

    New mechanism relies on a time-like generation counter to serialize
    RSCN updates relative to ELS/IO updates.

    Cc: # v3.18+
    Signed-off-by: Alexei Potashnik
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Alexei Potashnik
     
  • cancel any commands from initiator's s_id that are still waiting
    on qla_tgt_wq when PLOGI arrives.

    Cc: # v3.18+
    Signed-off-by: Alexei Potashnik
    Acked-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Alexei Potashnik
     
  • - keep qla_tgt_sess object on the session list until it's freed

    - modify use of sess->deleted flag to differentiate delayed
    session deletion that can be cancelled from irreversible one:
    QLA_SESS_DELETION_PENDING vs QLA_SESS_DELETION_IN_PROGRESS

    - during IN_PROGRESS deletion all newly arrived commands and TMRs will
    be rejected, existing commands and TMRs will be terminated when
    given by the core to the fabric or simply dropped if session logout
    has already happened (logout terminates all existing exchanges)

    - new PLOGI will initiate deletion of the following sessions
    (unless deletion is already IN_PROGRESS):
    - with the same port_name (with logout)
    - different port_name, different loop_id but the same port_id
    (with logout)
    - different port_name, different port_id, but the same loop_id
    (without logout)

    - additionally each new PLOGI will store imm notify iocb in the
    same port_name session being deleted. When deletion process
    completes this iocb will be acked. Only the most recent PLOGI
    iocb is stored. The older ones will be terminated when replaced.

    - new PRLI will initiate deletion of the following sessions
    (unless deletion is already IN_PROGRESS):
    - different port_name, different port_id, but the same loop_id
    (without logout)

    Cc: # v3.18+
    Signed-off-by: Alexei Potashnik
    Acked-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Alexei Potashnik
     
  • Since cmds go into qla_tgt_wq and TMRs don't, it's possible that TMR
    like TASK_ABORT can be queued over the cmd for which it was meant.
    To avoid this race, use a per-port list to keep track of cmds that
    are enqueued to qla_tgt_wq but not yet processed. When a TMR arrives,
    iterate through this list and remove any cmds that match the TMR.
    This patch supports TASK_ABORT and LUN_RESET.

    Cc: # v3.18+
    Signed-off-by: Swapnil Nagle
    Signed-off-by: Alexei Potashnik
    Acked-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Swapnil Nagle
     
  • To fix some issues talking to ESX, this patch modifies the qla2xxx driver
    so that it never logs into remote ports. This has the side effect of
    getting rid of the "rports" entirely, which means we never log out of
    initiators and never tear down sessions when an initiator goes away.

    This is mostly OK, except that we can run into trouble if we have
    initiator A assigned FC address X:Y:Z by the fabric talking to us, and
    then initiator A goes away. Some time (could be a long time) later,
    initiator B comes along and also gets FC address X:Y:Z (which is
    available again, because initiator A is gone). If initiator B starts
    talking to us, then we'll still have the session for initiator A, and
    since we look up incoming IO based on the FC address X:Y:Z, initiator B
    will end up using ACLs for initiator A.

    Fix this by:

    1. Handling RSCN events somewhat differently; instead of completely
    skipping the processing of fcports, we look through the list, and if
    an fcport disappears, we tell the target code the tear down the
    session and tell the HBA FW to release the N_Port handle.

    2. Handling "port down" events by flushing all of our sessions. The
    firmware was already releasing the N_Port handle but we want the
    target code to drop all the sessions too.

    Cc: # v3.18+
    Signed-off-by: Roland Dreier
    Signed-off-by: Alexei Potashnik
    Acked-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Nicholas Bellinger

    Roland Dreier
     
  • Cc: # v3.18+
    Signed-off-by: Kanoj Sarcar
    Signed-off-by: Himanshu Madhani
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Kanoj Sarcar
     
  • Remove unnecessary msleep from qlt_send_term_exchange as it
    adds latency of 250 msec while sending terminate exchange to
    an aborted task.

    Cc: # v3.18+
    Signed-off-by: Himanshu Madhani
    Signed-off-by: Giridhar Malavali
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Himanshu Madhani
     
  • Adjust debug flag to match debug comment.

    Signed-off-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Quinn Tran
     
  • Request IOCB queue element(s) is reserved during
    good path IO. Under error condition such as unable
    to allocate IOCB handle condition, the IOCB count
    that was reserved is not released.

    Cc: # v3.18+
    Signed-off-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Quinn Tran
     
  • After updating the consumer index of ATIO Q, a read is
    required to flush the write to the adapter register.

    Signed-off-by: Quinn Tran
    Signed-off-by: Himanshu Madhani
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Quinn Tran
     
  • Signed-off-by: Himanshu Madhani
    Signed-off-by: Giridhar Malavali
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Himanshu Madhani
     
  • [ Upstream commit ef86cb2059a14b4024c7320999ee58e938873032 ]

    This patch fixes a kernel panic for qla2xxx Target core
    Module driver introduced by a fix in the qla2xxx initiator code.

    Commit ef86cb2 ("qla2xxx: Mark port lost when we receive an RSCN for it.")
    introduced the regression for qla2xxx Target driver.

    Stack trace will have following signature

    --- ---
    [ffff88081faa3cc8] _raw_spin_lock_irqsave at ffffffff815b1f03
    [ffff88081faa3cd0] qlt_fc_port_deleted at ffffffffa096ccd0 [qla2xxx]
    [ffff88081faa3d20] qla2x00_schedule_rport_del at ffffffffa0913831[qla2xxx]
    [ffff88081faa3d50] qla2x00_mark_device_lost at ffffffffa09159c5[qla2xxx]
    [ffff88081faa3db0] qla2x00_async_event at ffffffffa0938d59 [qla2xxx]
    [ffff88081faa3e30] qla24xx_msix_default at ffffffffa093a326 [qla2xxx]
    [ffff88081faa3e90] handle_irq_event_percpu at ffffffff810a7b8d
    [ffff88081faa3ee0] handle_irq_event at ffffffff810a7d32
    [ffff88081faa3f10] handle_edge_irq at ffffffff810ab6b9
    [ffff88081faa3f30] handle_irq at ffffffff8100619c
    [ffff88081faa3f70] do_IRQ at ffffffff815b4b1c
    --- ---

    Cc: # v3.18+
    Signed-off-by: Saurav Kashyap
    Signed-off-by: Himanshu Madhani
    Reviewed-by: Nicholas Bellinger
    Signed-off-by: Nicholas Bellinger

    Saurav Kashyap
     

24 Jul, 2015

2 commits

  • API compliance scanning with coccinelle flagged:
    ./drivers/scsi/qla2xxx/tcm_qla2xxx.c:407:2-29:
    WARNING: timeout is HZ dependent

    This was introduced in 'commit 75f8c1f693ee ("[SCSI] tcm_qla2xxx: Add >=
    24xx series fabric module for target-core")'. wait_for_completion_timeout()
    expects a timeout in jiffies so the numeric constant makes the effective
    timeout HZ dependent. Resolved by converting it to CONST * HZ.

    Signed-off-by: Nicholas Mc Guire
    Acked-by: Nilesh Javali
    Signed-off-by: Nicholas Bellinger

    Nicholas Mc Guire
     
  • Pull virtio/vhost fixes from Michael Tsirkin:
    "Bugfixes and documentation fixes.

    Igor's patch that allows users to tweak memory table size is
    borderline, but it does fix known crashes, so I merged it"

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
    vhost: add max_mem_regions module parameter
    vhost: extend memory regions allocation to vmalloc
    9p/trans_virtio: reset virtio device on remove
    virtio/s390: rename drivers/s390/kvm -> drivers/s390/virtio
    MAINTAINERS: separate section for s390 virtio drivers
    virtio: define virtio_pci_cfg_cap in header.
    virtio: Fix typecast of pointer in vring_init()
    virtio scsi: fix unused variable warning
    vhost: use binary search instead of linear in find_region()
    virtio_net: document VIRTIO_NET_CTRL_GUEST_OFFLOADS

    Linus Torvalds
     

20 Jul, 2015

1 commit

  • Pull SCSI fixes from James Bottomley:
    "Two fairly simple fixes: one is a change that causes us to have a very
    low queue depth leading to performance issues and the other is a null
    deref occasionally in tapes thanks to use after put"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: fix host max depth checking for the 'queue_depth' sysfs interface
    st: null pointer dereference panic caused by use after kref_put by st_open

    Linus Torvalds
     

16 Jul, 2015

2 commits

  • Commit 1e6f2416044c0 changed the scsi sysfs 'queue_depth' code to
    rejects depths higher than the scsi host template setting. But lots
    of hosts set this to 1, and update the settings in the scsi host
    when the controller/devices probing happens.

    This breaks (at least) mpt2sas and mpt3sas runtime setting of queue
    depth, returning EINVAL for all settings but '1'. And once it's set to
    1, there's no way to go back up.

    Cc: stable@vger.kernel.org
    Fixes: 1e6f2416044c0 "scsi: don't allow setting of queue_depth bigger than can_queue"
    Signed-off-by: Jens Axboe
    Reviewed-by: Martin K. Petersen
    Reviewed-by: Christoph Hellwig
    Signed-off-by: James Bottomley

    Jens Axboe
     
  • Two SLES11 SP3 servers encountered similar crashes simultaneously
    following some kind of SAN/tape target issue:

    ...
    qla2xxx [0000:81:00.0]-801c:3: Abort command issued nexus=3:0:2 -- 1 2002.
    qla2xxx [0000:81:00.0]-801c:3: Abort command issued nexus=3:0:2 -- 1 2002.
    qla2xxx [0000:81:00.0]-8009:3: DEVICE RESET ISSUED nexus=3:0:2 cmd=ffff882f89c2c7c0.
    qla2xxx [0000:81:00.0]-800c:3: do_reset failed for cmd=ffff882f89c2c7c0.
    qla2xxx [0000:81:00.0]-800f:3: DEVICE RESET FAILED: Task management failed nexus=3:0:2 cmd=ffff882f89c2c7c0.
    qla2xxx [0000:81:00.0]-8009:3: TARGET RESET ISSUED nexus=3:0:2 cmd=ffff882f89c2c7c0.
    qla2xxx [0000:81:00.0]-800c:3: do_reset failed for cmd=ffff882f89c2c7c0.
    qla2xxx [0000:81:00.0]-800f:3: TARGET RESET FAILED: Task management failed nexus=3:0:2 cmd=ffff882f89c2c7c0.
    qla2xxx [0000:81:00.0]-8012:3: BUS RESET ISSUED nexus=3:0:2.
    qla2xxx [0000:81:00.0]-802b:3: BUS RESET SUCCEEDED nexus=3:0:2.
    qla2xxx [0000:81:00.0]-505f:3: Link is operational (8 Gbps).
    qla2xxx [0000:81:00.0]-8018:3: ADAPTER RESET ISSUED nexus=3:0:2.
    qla2xxx [0000:81:00.0]-00af:3: Performing ISP error recovery - ha=ffff88bf04d18000.
    rport-3:0-0: blocked FC remote port time out: removing target and saving binding
    qla2xxx [0000:81:00.0]-505f:3: Link is operational (8 Gbps).
    qla2xxx [0000:81:00.0]-8017:3: ADAPTER RESET SUCCEEDED nexus=3:0:2.
    rport-2:0-0: blocked FC remote port time out: removing target and saving binding
    sg_rq_end_io: device detached
    BUG: unable to handle kernel NULL pointer dereference at 00000000000002a8
    IP: [] __pm_runtime_idle+0x28/0x90
    PGD 7e6586f067 PUD 7e5af06067 PMD 0 [1739975.390354] Oops: 0002 [#1] SMP
    CPU 0
    ...
    Supported: No, Proprietary modules are loaded [1739975.390463]
    Pid: 27965, comm: ABCD Tainted: PF X 3.0.101-0.29-default #1 HP ProLiant DL580 Gen8
    RIP: 0010:[] [] __pm_runtime_idle+0x28/0x90
    RSP: 0018:ffff8839dc1e7c68 EFLAGS: 00010202
    RAX: 0000000000000000 RBX: ffff883f0592fc00 RCX: 0000000000000090
    RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000138
    RBP: 0000000000000138 R08: 0000000000000010 R09: ffffffff81bd39d0
    R10: 00000000000009c0 R11: ffffffff81025790 R12: 0000000000000001
    R13: ffff883022212b80 R14: 0000000000000004 R15: ffff883022212b80
    FS: 00007f8e54560720(0000) GS:ffff88407f800000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 00000000000002a8 CR3: 0000007e6ced6000 CR4: 00000000001407f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process ABCD (pid: 27965, threadinfo ffff8839dc1e6000, task ffff883592e0c640)
    Stack:
    ffff883f0592fc00 00000000fffffffa 0000000000000001 ffff883022212b80
    ffff883eff772400 ffffffffa03fa309 0000000000000000 0000000000000000
    ffffffffa04003a0 ffff883f063196c0 ffff887f0379a930 ffffffff8115ea1e
    Call Trace:
    [] st_open+0x129/0x240 [st]
    [] chrdev_open+0x13e/0x200
    [] __dentry_open+0x198/0x310
    [] do_last+0x1f4/0x800
    [] path_openat+0xd9/0x420
    [] do_filp_open+0x4c/0xc0
    [] do_sys_open+0x17f/0x250
    [] system_call_fastpath+0x16/0x1b
    [] 0x7f8e4f617fcf
    Code: eb d3 90 48 83 ec 28 40 f6 c6 04 48 89 6c 24 08 4c 89 74 24 20 48 89 fd 48 89 1c 24 4c 89 64 24 10 41 89 f6 4c 89 6c 24 18 74 11 ff 8f 70 01 00 00 0f 94 c0 45 31 ed 84 c0 74 2b 4c 8d a5 a0
    RIP [] __pm_runtime_idle+0x28/0x90
    RSP
    CR2: 00000000000002a8

    Analysis reveals the cause of the crash to be due to STp->device
    being NULL. The pointer was NULLed via scsi_tape_put(STp) when it
    calls scsi_tape_release(). In st_open() we jump to err_out after
    scsi_block_when_processing_errors() completes and returns the
    device as offline (sdev_state was SDEV_DEL):

    1180 /* Open the device. Needs to take the BKL only because of incrementing the SCSI host
    1181 module count. */
    1182 static int st_open(struct inode *inode, struct file *filp)
    1183 {
    1184 int i, retval = (-EIO);
    1185 int resumed = 0;
    1186 struct scsi_tape *STp;
    1187 struct st_partstat *STps;
    1188 int dev = TAPE_NR(inode);
    1189 char *name;
    ...
    1217 if (scsi_autopm_get_device(STp->device) < 0) {
    1218 retval = -EIO;
    1219 goto err_out;
    1220 }
    1221 resumed = 1;
    1222 if (!scsi_block_when_processing_errors(STp->device)) {
    1223 retval = (-ENXIO);
    1224 goto err_out;
    1225 }
    ...
    1264 err_out:
    1265 normalize_buffer(STp->buffer);
    1266 spin_lock(&st_use_lock);
    1267 STp->in_use = 0;
    1268 spin_unlock(&st_use_lock);
    1269 scsi_tape_put(STp); device = 0 after this
    1270 if (resumed)
    1271 scsi_autopm_put_device(STp->device);
    1272 return retval;

    The ref count for the struct scsi_tape had already been reduced
    to 1 when the .remove method of the st module had been called.
    The kref_put() in scsi_tape_put() caused scsi_tape_release()
    to be called:

    0266 static void scsi_tape_put(struct scsi_tape *STp)
    0267 {
    0268 struct scsi_device *sdev = STp->device;
    0269
    0270 mutex_lock(&st_ref_mutex);
    0271 kref_put(&STp->kref, scsi_tape_release); disk;
    4277
    4278 tpnt->device = NULL; <<buffer) {
    4281 normalize_buffer(tpnt->buffer);
    4282 kfree(tpnt->buffer->reserved_pages);
    4283 kfree(tpnt->buffer);
    4284 }
    4285
    4286 disk->private_data = NULL;
    4287 put_disk(disk);
    4288 kfree(tpnt);
    4289 return;
    4290 }

    Although the problem was reported on SLES11.3 the problem appears
    in linux-next as well.

    The crash is fixed by reordering the code so we no longer access
    the struct scsi_tape after the kref_put() is done on it in st_open().

    Signed-off-by: Shane Seymour
    Signed-off-by: Darren Lavender
    Reviewed-by: Johannes Thumshirn
    Acked-by: Kai Mäkisara
    Cc: stable@vger.kernel.org
    Signed-off-by: James Bottomley

    Seymour, Shane M
     

15 Jul, 2015

1 commit

  • We might return res which is not initialized. Also
    reduce code duplication by exporting srp_parse_tmo so
    srp_tmo_set can reuse it.

    Detected by Coverity.

    Signed-off-by: Sagi Grimberg
    Signed-off-by: Jenny Falkovich
    Reviewed-by: Bart Van Assche
    Signed-off-by: Doug Ledford

    Sagi Grimberg
     

07 Jul, 2015

1 commit

  • drivers/scsi/virtio_scsi.c: In function 'virtscsi_probe':
    drivers/scsi/virtio_scsi.c:952:11: warning: unused variable 'host_prot' [-Wunused-variable]
    int err, host_prot;
    ^

    Signed-off-by: Stephen Rothwell
    Reviewed-by: Michael S. Tsirkin
    Signed-off-by: Michael S. Tsirkin

    Stephen Rothwell
     

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
     

01 Jul, 2015

2 commits

  • Use kvfree() instead of open-coding it.

    Signed-off-by: Pekka Enberg
    Cc: "James E.J. Bottomley"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pekka Enberg
     
  • do_device_access() takes a separate parameter to indicate the direction of
    data transfer, which it used to use to select the appropriate function out
    of sg_pcopy_{to,from}_buffer(). However these two functions now have

    So this patch makes it bypass these wrappers and call the underlying
    function sg_copy_buffer() directly; this has the same calling style as
    do_device_access() i.e. a separate direction-of-transfer parameter and no
    pointers-to-const, so skipping the wrappers not only eliminates the
    warning, it also make the code simpler :)

    [akpm@linux-foundation.org: fix very broken build]
    Signed-off-by: Dave Gordon
    Acked-by: Arnd Bergmann
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Gordon
     

25 Jun, 2015

1 commit

  • Pull networking updates from David Miller:

    1) Add TX fast path in mac80211, from Johannes Berg.

    2) Add TSO/GRO support to ibmveth, from Thomas Falcon

    3) Move away from cached routes in ipv6, just like ipv4, from Martin
    KaFai Lau.

    4) Lots of new rhashtable tests, from Thomas Graf.

    5) Run ingress qdisc lockless, from Alexei Starovoitov.

    6) Allow servers to fetch TCP packet headers for SYN packets of new
    connections, for fingerprinting. From Eric Dumazet.

    7) Add mode parameter to pktgen, for testing receive. From Alexei
    Starovoitov.

    8) Cache access optimizations via simplifications of build_skb(), from
    Alexander Duyck.

    9) Move page frag allocator under mm/, also from Alexander.

    10) Add xmit_more support to hv_netvsc, from KY Srinivasan.

    11) Add a counter guard in case we try to perform endless reclassify
    loops in the packet scheduler.

    12) Extern flow dissector to be programmable and use it in new "Flower"
    classifier. From Jiri Pirko.

    13) AF_PACKET fanout rollover fixes, performance improvements, and new
    statistics. From Willem de Bruijn.

    14) Add netdev driver for GENEVE tunnels, from John W Linville.

    15) Add ingress netfilter hooks and filtering, from Pablo Neira Ayuso.

    16) Fix handling of epoll edge triggers in TCP, from Eric Dumazet.

    17) Add an ECN retry fallback for the initial TCP handshake, from Daniel
    Borkmann.

    18) Add tail call support to BPF, from Alexei Starovoitov.

    19) Add several pktgen helper scripts, from Jesper Dangaard Brouer.

    20) Add zerocopy support to AF_UNIX, from Hannes Frederic Sowa.

    21) Favor even port numbers for allocation to connect() requests, and
    odd port numbers for bind(0), in an effort to help avoid
    ip_local_port_range exhaustion. From Eric Dumazet.

    22) Add Cavium ThunderX driver, from Sunil Goutham.

    23) Allow bpf programs to access skb_iif and dev->ifindex SKB metadata,
    from Alexei Starovoitov.

    24) Add support for T6 chips in cxgb4vf driver, from Hariprasad Shenai.

    25) Double TCP Small Queues default to 256K to accomodate situations
    like the XEN driver and wireless aggregation. From Wei Liu.

    26) Add more entropy inputs to flow dissector, from Tom Herbert.

    27) Add CDG congestion control algorithm to TCP, from Kenneth Klette
    Jonassen.

    28) Convert ipset over to RCU locking, from Jozsef Kadlecsik.

    29) Track and act upon link status of ipv4 route nexthops, from Andy
    Gospodarek.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1670 commits)
    bridge: vlan: flush the dynamically learned entries on port vlan delete
    bridge: multicast: add a comment to br_port_state_selection about blocking state
    net: inet_diag: export IPV6_V6ONLY sockopt
    stmmac: troubleshoot unexpected bits in des0 & des1
    net: ipv4 sysctl option to ignore routes when nexthop link is down
    net: track link-status of ipv4 nexthops
    net: switchdev: ignore unsupported bridge flags
    net: Cavium: Fix MAC address setting in shutdown state
    drivers: net: xgene: fix for ACPI support without ACPI
    ip: report the original address of ICMP messages
    net/mlx5e: Prefetch skb data on RX
    net/mlx5e: Pop cq outside mlx5e_get_cqe
    net/mlx5e: Remove mlx5e_cq.sqrq back-pointer
    net/mlx5e: Remove extra spaces
    net/mlx5e: Avoid TX CQE generation if more xmit packets expected
    net/mlx5e: Avoid redundant dev_kfree_skb() upon NOP completion
    net/mlx5e: Remove re-assignment of wq type in mlx5e_enable_rq()
    net/mlx5e: Use skb_shinfo(skb)->gso_segs rather than counting them
    net/mlx5e: Static mapping of netdev priv resources to/from netdev TX queues
    net/mlx4_en: Use HW counters for rx/tx bytes/packets in PF device
    ...

    Linus Torvalds
     

24 Jun, 2015

4 commits

  • Pull SCSI updates from James Bottomley:
    "This is the usual grab bag of driver updates (lpfc, hpsa,
    megaraid_sas, cxgbi, be2iscsi) plus an assortment of minor updates.

    There is also one new driver: the Cisco snic. The advansys driver has
    been rewritten to get rid of the warning about converting it to the
    DMA API, the tape statistics patch got in and finally, there's a
    resuffle of SCSI header files to separate more cleanly initiator from
    target mode (and better share the common definitions)"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (156 commits)
    snic: driver for Cisco SCSI HBA
    qla2xxx: Fix indentation
    qla2xxx: Comment out unreachable code
    fusion: remove dead MTRR code
    advansys: fix compilation errors and warnings when CONFIG_PCI is not set
    mptsas: fix depth param in scsi_track_queue_full
    megaraid: fix irq setup process regression
    lpfc: Update version to 10.7.0.0 for upstream patch set.
    lpfc: Fix to drop PLOGIs from fabric node till LOGO processing completes
    lpfc: Fix scsi task management error message.
    lpfc: Fix cq_id masking problem.
    lpfc: Fix scsi prep dma buf error.
    lpfc: Add support for using block multi-queue
    lpfc: Devices are not discovered during takeaway/giveback testing
    lpfc: Fix vport deletion failure.
    lpfc: Check for active portpeerbeacon.
    lpfc: Update driver version for upstream patch set 10.6.0.1.
    lpfc: Change buffer pool empty message to miscellaneous category
    lpfc: Fix incorrect log message reported for empty FCF record.
    lpfc: Fix rport leak.
    ...

    Linus Torvalds
     
  • Pull rdma updates from Doug Ledford:

    - a large cleanup of how device capabilities are checked for various
    features

    - additional cleanups in the MAD processing

    - update to the srp driver

    - creation and use of centralized log message helpers

    - add const to a number of args to calls and clean up call chain

    - add support for extended cq create verb

    - add support for timestamps on cq completion

    - add support for processing OPA MAD packets

    * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (92 commits)
    IB/mad: Add final OPA MAD processing
    IB/mad: Add partial Intel OPA MAD support
    IB/mad: Add partial Intel OPA MAD support
    IB/core: Add OPA MAD core capability flag
    IB/mad: Add support for additional MAD info to/from drivers
    IB/mad: Convert allocations from kmem_cache to kzalloc
    IB/core: Add ability for drivers to report an alternate MAD size.
    IB/mad: Support alternate Base Versions when creating MADs
    IB/mad: Create a generic helper for DR forwarding checks
    IB/mad: Create a generic helper for DR SMP Recv processing
    IB/mad: Create a generic helper for DR SMP Send processing
    IB/mad: Split IB SMI handling from MAD Recv handler
    IB/mad cleanup: Generalize processing of MAD data
    IB/mad cleanup: Clean up function params -- find_mad_agent
    IB/mlx4: Add support for CQ time-stamping
    IB/mlx4: Add mmap call to map the hardware clock
    IB/core: Pass hardware specific data in query_device
    IB/core: Add timestamp_mask and hca_core_clock to query_device
    IB/core: Extend ib_uverbs_create_cq
    IB/core: Add CQ creation time-stamping flag
    ...

    Linus Torvalds
     
  • Pull power management and ACPI updates from Rafael Wysocki:
    "The rework of backlight interface selection API from Hans de Goede
    stands out from the number of commits and the number of affected
    places perspective. The cpufreq core fixes from Viresh Kumar are
    quite significant too as far as the number of commits goes and because
    they should reduce CPU online/offline overhead quite a bit in the
    majority of cases.

    From the new featues point of view, the ACPICA update (to upstream
    revision 20150515) adding support for new ACPI 6 material to ACPICA is
    the one that matters the most as some new significant features will be
    based on it going forward. Also included is an update of the ACPI
    device power management core to follow ACPI 6 (which in turn reflects
    the Windows' device PM implementation), a PM core extension to support
    wakeup interrupts in a more generic way and support for the ACPI _CCA
    device configuration object.

    The rest is mostly fixes and cleanups all over and some documentation
    updates, including new DT bindings for Operating Performance Points.

    There is one fix for a regression introduced in the 4.1 cycle, but it
    adds quite a number of lines of code, it wasn't really ready before
    Thursday and you were on vacation, so I refrained from pushing it on
    the last minute for 4.1.

    Specifics:

    - ACPICA update to upstream revision 20150515 including basic support
    for ACPI 6 features: new ACPI tables introduced by ACPI 6 (STAO,
    XENV, WPBT, NFIT, IORT), changes related to the other tables (DTRM,
    FADT, LPIT, MADT), new predefined names (_BTH, _CR3, _DSD, _LPI,
    _MTL, _PRR, _RDI, _RST, _TFP, _TSN), fixes and cleanups (Bob Moore,
    Lv Zheng).

    - ACPI device power management core code update to follow ACPI 6
    which reflects the ACPI device power management implementation in
    Windows (Rafael J Wysocki).

    - rework of the backlight interface selection logic to reduce the
    number of kernel command line options and improve the handling of
    DMI quirks that may be involved in that and to make the code
    generally more straightforward (Hans de Goede).

    - fixes for the ACPI Embedded Controller (EC) driver related to the
    handling of EC transactions (Lv Zheng).

    - fix for a regression related to the ACPI resources management and
    resulting from a recent change of ACPI initialization code ordering
    (Rafael J Wysocki).

    - fix for a system initialization regression related to ACPI
    introduced during the 3.14 cycle and caused by running the code
    that switches the platform over to the ACPI mode too early in the
    initialization sequence (Rafael J Wysocki).

    - support for the ACPI _CCA device configuration object related to
    DMA cache coherence (Suravee Suthikulpanit).

    - ACPI/APEI fixes and cleanups (Jiri Kosina, Borislav Petkov).

    - ACPI battery driver cleanups (Luis Henriques, Mathias Krause).

    - ACPI processor driver cleanups (Hanjun Guo).

    - cleanups and documentation update related to the ACPI device
    properties interface based on _DSD (Rafael J Wysocki).

    - ACPI device power management fixes (Rafael J Wysocki).

    - assorted cleanups related to ACPI (Dominik Brodowski, Fabian
    Frederick, Lorenzo Pieralisi, Mathias Krause, Rafael J Wysocki).

    - fix for a long-standing issue causing General Protection Faults to
    be generated occasionally on return to user space after resume from
    ACPI-based suspend-to-RAM on 32-bit x86 (Ingo Molnar).

    - fix to make the suspend core code return -EBUSY consistently in all
    cases when system suspend is aborted due to wakeup detection (Ruchi
    Kandoi).

    - support for automated device wakeup IRQ handling allowing drivers
    to make their PM support more starightforward (Tony Lindgren).

    - new tracepoints for suspend-to-idle tracing and rework of the
    prepare/complete callbacks tracing in the PM core (Todd E Brandt,
    Rafael J Wysocki).

    - wakeup sources framework enhancements (Jin Qian).

    - new macro for noirq system PM callbacks (Grygorii Strashko).

    - assorted cleanups related to system suspend (Rafael J Wysocki).

    - cpuidle core cleanups to make the code more efficient (Rafael J
    Wysocki).

    - powernv/pseries cpuidle driver update (Shilpasri G Bhat).

    - cpufreq core fixes related to CPU online/offline that should reduce
    the overhead of these operations quite a bit, unless the CPU in
    question is physically going away (Viresh Kumar, Saravana Kannan).

    - serialization of cpufreq governor callbacks to avoid race
    conditions in some cases (Viresh Kumar).

    - intel_pstate driver fixes and cleanups (Doug Smythies, Prarit
    Bhargava, Joe Konno).

    - cpufreq driver (arm_big_little, cpufreq-dt, qoriq) updates (Sudeep
    Holla, Felipe Balbi, Tang Yuantian).

    - assorted cleanups in cpufreq drivers and core (Shailendra Verma,
    Fabian Frederick, Wang Long).

    - new Device Tree bindings for representing Operating Performance
    Points (Viresh Kumar).

    - updates for the common clock operations support code in the PM core
    (Rajendra Nayak, Geert Uytterhoeven).

    - PM domains core code update (Geert Uytterhoeven).

    - Intel Knights Landing support for the RAPL (Running Average Power
    Limit) power capping driver (Dasaratharaman Chandramouli).

    - fixes related to the floor frequency setting on Atom SoCs in the
    RAPL power capping driver (Ajay Thomas).

    - runtime PM framework documentation update (Ben Dooks).

    - cpupower tool fix (Herton R Krzesinski)"

    * tag 'pm+acpi-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (194 commits)
    cpuidle: powernv/pseries: Auto-promotion of snooze to deeper idle state
    x86: Load __USER_DS into DS/ES after resume
    PM / OPP: Add binding for 'opp-suspend'
    PM / OPP: Allow multiple OPP tables to be passed via DT
    PM / OPP: Add new bindings to address shortcomings of existing bindings
    ACPI: Constify ACPI device IDs in documentation
    ACPI / enumeration: Document the rules regarding the PRP0001 device ID
    ACPI / video: Make acpi_video_unregister_backlight() private
    acpi-video-detect: Remove old API
    toshiba-acpi: Port to new backlight interface selection API
    thinkpad-acpi: Port to new backlight interface selection API
    sony-laptop: Port to new backlight interface selection API
    samsung-laptop: Port to new backlight interface selection API
    msi-wmi: Port to new backlight interface selection API
    msi-laptop: Port to new backlight interface selection API
    intel-oaktrail: Port to new backlight interface selection API
    ideapad-laptop: Port to new backlight interface selection API
    fujitsu-laptop: Port to new backlight interface selection API
    eeepc-laptop: Port to new backlight interface selection API
    dell-wmi: Port to new backlight interface selection API
    ...

    Linus Torvalds
     
  • Pull trivial tree updates from Jiri Kosina:
    "As usual, mostly comment, kerneldoc and printk() fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
    lpfc: Grammar s/an negative/a negative/
    ARM: lib/lib1funcs.S: fix typo s/substractions/subtractions/
    cx25821: cx25821-medusa-reg.h: fix 0x0x prefix
    lib: crc-itu-t.[ch] fix 0x0x prefix in integer constants
    rapidio: Fix kerneldoc and comment
    qla4xxx: Fix printk() in qla4_83xx_read_reset_template() and qla4_83xx_pre_loopback_config()
    treewide: Kconfig: fix wording / spelling
    usb/serial: fix grammar in Kconfig help text for FTDI_SIO
    megaraid_sas: fix kerneldoc
    netfilter: ebtables: fix comment grammar
    drm/radeon: fix comment
    isdn: fix grammar in comment
    ARM: KVM: fix comment

    Linus Torvalds
     

22 Jun, 2015

1 commit


20 Jun, 2015

1 commit

  • Cisco has developed a new PCI HBA interface called sNIC, which stands for
    SCSI NIC. This is a new storage feature supported on specialized network
    adapter. The new PCI function provides a uniform host interface and abstracts
    backend storage.

    [jejb: fix up checkpatch errors]
    Signed-off-by: Narsimhulu Musini
    Signed-off-by: Sesidhar Baddela
    Reviewed-by: Hannes Reinecke
    Signed-off-by: James Bottomley

    Narsimhulu Musini
     

16 Jun, 2015

1 commit

  • 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
     

15 Jun, 2015

1 commit