Re: [PATCH] sd: sd should not modify read capacity, cache type or write protect flag on rescan when there is a transport error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 27, 2011 at 02:21:58PM +0000, Menny_Hamburger@xxxxxxxx wrote:
> @@ -1502,10 +1502,16 @@
>           set_media_not_present(sdkp);
> 
> -    /*
> -    * We used to set media_present to 0 here to indicate no media
> -    * in the drive, but some drives fail read capacity even with
> -    * media present, so we can't do that.
> -    */
> -    sdkp->capacity = 0; /* unknown mapped to zero - as usual */
> +    if (host_byte(the_result) && !sdkp->first_scan)
> +          sd_printk(KERN_NOTICE, sdkp, "host error while reading capacity\n");

This patch is corrupted ... looks like Exchange has converted tabs
to spaces.

> +    else {
> +          /*
> +          * We used to set media_present to 0 here to indicate no media
> +          * in the drive, but some drives fail read capacity even with
> +          * media present, so we can't do that.
> +          */
> +          sdkp->capacity = 0; /* unknown mapped to zero - as usual */
> +    }
> +
> +    sd_printk(KERN_NOTICE, sdkp, "assuming capacity %llu.\n", sdkp->capacity);
> }
> 
> @@ -1878,6 +1884,11 @@
> 
>      if (!scsi_status_is_good(res)) {
> -          sd_printk(KERN_WARNING, sdkp,
> -                 "Test WP failed, assume Write Enabled\n");
> +          if (host_byte(res) && !sdkp->first_scan) {
> +               sd_printk(KERN_NOTICE, sdkp, "host error while reading write protect flag\n");
> +               set_disk_ro(sdkp->disk, sdkp->write_prot);
> +          }
> +
> +          sd_printk(KERN_WARNING, sdkp, 
> +                 "Test WP failed, assume Write %s\n", (sdkp->write_prot) ? "Disabled" : "Enabled");
>     } else {
>           sdkp->write_prot = ((data.device_specific & 0x80) != 0);
> @@ -2034,8 +2045,14 @@
> 
>  defaults:
> -    sd_printk(KERN_ERR, sdkp, "Assuming drive cache: write through\n");
> -    sdkp->WCE = 0;
> -    sdkp->RCD = 0;
> -    sdkp->DPOFUA = 0;
> +    if (host_byte(res) && !sdkp->first_scan) 
> +          sd_printk(KERN_NOTICE, sdkp, "host error while reading cache type\n");
> +    else {
> +          sdkp->WCE = 0;
> +          sdkp->RCD = 0;
> +          sdkp->DPOFUA = 0;
> +    }
> +
> +    sd_printk(KERN_ERR, sdkp, "Assuming drive cache: %s\n", 
> +            sd_cache_types[sdkp->RCD + 2*sdkp->WCE]);
> }
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux