Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 May 2019 00:30:28 +0000 (17:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 May 2019 00:30:28 +0000 (17:30 -0700)
Pull SCSI fixes from James Bottomley:
 "This is the same set of patches sent in the merge window as the final
  pull except that Martin's read only rework is replaced with a simple
  revert of the original change that caused the regression.

  Everything else is an obvious fix or small cleanup"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  Revert "scsi: sd: Keep disk read-only when re-reading partition"
  scsi: bnx2fc: fix incorrect cast to u64 on shift operation
  scsi: smartpqi: Reporting unhandled SCSI errors
  scsi: myrs: Fix uninitialized variable
  scsi: lpfc: Update lpfc version to 12.2.0.2
  scsi: lpfc: add check for loss of ndlp when sending RRQ
  scsi: lpfc: correct rcu unlock issue in lpfc_nvme_info_show
  scsi: lpfc: resolve lockdep warnings
  scsi: qedi: remove set but not used variables 'cdev' and 'udev'
  scsi: qedi: remove memset/memcpy to nfunc and use func instead
  scsi: qla2xxx: Add cleanup for PCI EEH recovery

1  2 
drivers/scsi/bnx2fc/bnx2fc_hwi.c
drivers/scsi/sd.c

@@@ -830,7 -830,7 +830,7 @@@ ret_err_rqe
                        ((u64)err_entry->data.err_warn_bitmap_hi << 32) |
                        (u64)err_entry->data.err_warn_bitmap_lo;
                for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) {
-                       if (err_warn_bit_map & (u64) (1 << i)) {
+                       if (err_warn_bit_map & ((u64)1 << i)) {
                                err_warn = i;
                                break;
                        }
@@@ -991,6 -991,7 +991,6 @@@ void bnx2fc_arm_cq(struct bnx2fc_rport 
                        FCOE_CQE_TOGGLE_BIT_SHIFT);
        msg = *((u32 *)rx_db);
        writel(cpu_to_le32(msg), tgt->ctx_base);
 -      mmiowb();
  
  }
  
@@@ -1408,6 -1409,7 +1408,6 @@@ void bnx2fc_ring_doorbell(struct bnx2fc
                                (tgt->sq_curr_toggle_bit << 15);
        msg = *((u32 *)sq_db);
        writel(cpu_to_le32(msg), tgt->ctx_base);
 -      mmiowb();
  
  }
  
diff --combined drivers/scsi/sd.c
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *      sd.c Copyright (C) 1992 Drew Eckhardt
   *           Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale
@@@ -2257,6 -2256,22 +2257,6 @@@ static void read_capacity_error(struct 
  
  #define READ_CAPACITY_RETRIES_ON_RESET        10
  
 -/*
 - * Ensure that we don't overflow sector_t when CONFIG_LBDAF is not set
 - * and the reported logical block size is bigger than 512 bytes. Note
 - * that last_sector is a u64 and therefore logical_to_sectors() is not
 - * applicable.
 - */
 -static bool sd_addressable_capacity(u64 lba, unsigned int sector_size)
 -{
 -      u64 last_sector = (lba + 1ULL) << (ilog2(sector_size) - 9);
 -
 -      if (sizeof(sector_t) == 4 && last_sector > U32_MAX)
 -              return false;
 -
 -      return true;
 -}
 -
  static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
                                                unsigned char *buffer)
  {
                return -ENODEV;
        }
  
 -      if (!sd_addressable_capacity(lba, sector_size)) {
 -              sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a "
 -                      "kernel compiled with support for large block "
 -                      "devices.\n");
 -              sdkp->capacity = 0;
 -              return -EOVERFLOW;
 -      }
 -
        /* Logical blocks per physical block exponent */
        sdkp->physical_block_size = (1 << (buffer[13] & 0xf)) * sector_size;
  
@@@ -2403,6 -2426,14 +2403,6 @@@ static int read_capacity_10(struct scsi
                return sector_size;
        }
  
 -      if (!sd_addressable_capacity(lba, sector_size)) {
 -              sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a "
 -                      "kernel compiled with support for large block "
 -                      "devices.\n");
 -              sdkp->capacity = 0;
 -              return -EOVERFLOW;
 -      }
 -
        sdkp->capacity = lba + 1;
        sdkp->physical_block_size = sector_size;
        return sector_size;
@@@ -2572,7 -2603,6 +2572,6 @@@ sd_read_write_protect_flag(struct scsi_
        int res;
        struct scsi_device *sdp = sdkp->device;
        struct scsi_mode_data data;
-       int disk_ro = get_disk_ro(sdkp->disk);
        int old_wp = sdkp->write_prot;
  
        set_disk_ro(sdkp->disk, 0);
                          "Test WP failed, assume Write Enabled\n");
        } else {
                sdkp->write_prot = ((data.device_specific & 0x80) != 0);
-               set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro);
+               set_disk_ro(sdkp->disk, sdkp->write_prot);
                if (sdkp->first_scan || old_wp != sdkp->write_prot) {
                        sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n",
                                  sdkp->write_prot ? "on" : "off");
@@@ -3294,7 -3324,6 +3293,7 @@@ static void sd_probe_async(void *data, 
        if (sdp->removable) {
                gd->flags |= GENHD_FL_REMOVABLE;
                gd->events |= DISK_EVENT_MEDIA_CHANGE;
 +              gd->event_flags = DISK_EVENT_FLAG_POLL | DISK_EVENT_FLAG_UEVENT;
        }
  
        blk_pm_runtime_init(sdp->request_queue, dev);