The following commit has been merged in the master branch: commit 8e78b7dc93c580c050435b0f88991c26e02166bc Merge: 06a660ada2064bbdcd09aeb8173f2ad128c71978 294ab783ad98066b87296db1311c7ba2a60206a5 Author: Linus Torvalds torvalds@linux-foundation.org Date: Fri Sep 11 18:15:18 2015 -0700
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull second round of SCSI updates from James Bottomley: "There's one late arriving patch here (added today), fixing a build issue which the scsi_dh patch set in here uncovered. Other than that, everything has been incubated in -next and the checkers for a week.
The major pieces of this patch are a set patches facilitating better integration between scsi and scsi_dh (the device handling layer used by multi-path; all the dm parts are acked by Mike Snitzer).
This also includes driver updates for mp3sas, scsi_debug and an assortment of bug fixes"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (50 commits) scsi_dh: fix randconfig build error scsi: fix scsi_error_handler vs. scsi_host_dev_release race fcoe: Convert use of __constant_htons to htons mpt2sas: setpci reset kernel oops fix pm80xx: Don't override ts->stat on IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY lpfc: Fix possible use-after-free and double free in lpfc_mbx_cmpl_rdp_page_a2() bfa: Fix incorrect de-reference of pointer bfa: Fix indentation scsi_transport_sas: Remove check for SAS expander when querying bay/enclosure IDs. scsi_debug: resp_request: remove unused variable scsi_debug: fix REPORT LUNS Well Known LU scsi_debug: schedule_resp fix input variable check scsi_debug: make dump_sector static scsi_debug: vfree is null safe so drop the check scsi_debug: use SCSI_W_LUN_REPORT_LUNS instead of SAM2_WLUN_REPORT_LUNS; scsi_debug: define pr_fmt() for consistent logging mpt2sas: Refcount fw_events and fix unsafe list usage mpt2sas: Refcount sas_device objects and fix unsafe list usage scsi_dh: return SCSI_DH_NOTCONN in scsi_dh_activate() scsi_dh: don't allow to detach device handlers at runtime ...
diff --combined drivers/md/Kconfig index d5415ee,e9ea681..3e01e6f --- a/drivers/md/Kconfig +++ b/drivers/md/Kconfig @@@ -259,7 -259,7 +259,7 @@@ config DM_CRYP the ciphers you're going to use in the cryptoapi configuration.
For further information on dm-crypt and userspace tools see: - http://code.google.com/p/cryptsetup/wiki/DMCrypt + https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt
To compile this code as a module, choose M here: the module will be called dm-crypt. @@@ -393,7 -393,7 +393,7 @@@ config DM_MULTIPAT # of SCSI_DH if the latter isn't defined but if # it is, DM_MULTIPATH must depend on it. We get a build # error if SCSI_DH=m and DM_MULTIPATH=y - depends on SCSI_DH || !SCSI_DH + depends on !SCSI_DH || SCSI ---help--- Allow volume managers to support multipath hardware.
@@@ -478,7 -478,7 +478,7 @@@ config DM_LOG_WRITE This device-mapper target takes two devices, one device to use normally, one to log all write operations done to the first device. This is for use by file system developers wishing to verify that - their fs is writing a consitent file system at all times by allowing + their fs is writing a consistent file system at all times by allowing them to replay the log in a variety of ways and to check the contents.
diff --combined drivers/scsi/scsi_error.c index afd34a6,b5bbc12..b616a6b --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@@ -26,6 -26,7 +26,6 @@@ #include <linux/blkdev.h> #include <linux/delay.h> #include <linux/jiffies.h> -#include <asm/unaligned.h>
#include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> @@@ -36,6 -37,7 +36,7 @@@ #include <scsi/scsi_transport.h> #include <scsi/scsi_host.h> #include <scsi/scsi_ioctl.h> + #include <scsi/scsi_dh.h> #include <scsi/sg.h>
#include "scsi_priv.h" @@@ -463,11 -465,10 +464,10 @@@ static int scsi_check_sense(struct scsi if (scsi_sense_is_deferred(&sshdr)) return NEEDS_RETRY;
- if (sdev->scsi_dh_data && sdev->scsi_dh_data->scsi_dh && - sdev->scsi_dh_data->scsi_dh->check_sense) { + if (sdev->handler && sdev->handler->check_sense) { int rc;
- rc = sdev->scsi_dh_data->scsi_dh->check_sense(sdev, &sshdr); + rc = sdev->handler->check_sense(sdev, &sshdr); if (rc != SCSI_RETURN_NOT_HANDLED) return rc; /* handler does not care. Drop down to default handling */ @@@ -2178,8 -2179,17 +2178,17 @@@ int scsi_error_handler(void *data * We never actually get interrupted because kthread_run * disables signal delivery for the created thread. */ - while (!kthread_should_stop()) { + while (true) { + /* + * The sequence in kthread_stop() sets the stop flag first + * then wakes the process. To avoid missed wakeups, the task + * should always be in a non running state before the stop + * flag is checked + */ set_current_state(TASK_INTERRUPTIBLE); + if (kthread_should_stop()) + break; + if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) || shost->host_failed != atomic_read(&shost->host_busy)) { SCSI_LOG_ERROR_RECOVERY(1, @@@ -2531,3 -2541,33 +2540,3 @@@ void scsi_build_sense_buffer(int desc, } } EXPORT_SYMBOL(scsi_build_sense_buffer); - -/** - * scsi_set_sense_information - set the information field in a - * formatted sense data buffer - * @buf: Where to build sense data - * @info: 64-bit information value to be set - * - **/ -void scsi_set_sense_information(u8 *buf, u64 info) -{ - if ((buf[0] & 0x7f) == 0x72) { - u8 *ucp, len; - - len = buf[7]; - ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0); - if (!ucp) { - buf[7] = len + 0xa; - ucp = buf + 8 + len; - } - ucp[0] = 0; - ucp[1] = 0xa; - ucp[2] = 0x80; /* Valid bit */ - ucp[3] = 0; - put_unaligned_be64(info, &ucp[4]); - } else if ((buf[0] & 0x7f) == 0x70) { - buf[0] |= 0x80; - put_unaligned_be64(info, &buf[3]); - } -} -EXPORT_SYMBOL(scsi_set_sense_information);