From: Matthew Wilcox <matthew@wil.cx>
To: Menny_Hamburger@Dell.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] sd: sd should not modify read capacity, cache type or write protect flag on rescan when there is a transport error
Date: Sun, 27 Feb 2011 07:51:12 -0700 [thread overview]
Message-ID: <20110227145112.GG13726@parisc-linux.org> (raw)
In-Reply-To: <D8C50530D6022F40A817A35C40CC06A706576F76F2@DUBX7MCDUB01.EMEA.DELL.COM>
On Sun, Feb 27, 2011 at 02:21:58PM +0000, Menny_Hamburger@Dell.com 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@vger.kernel.org
> 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."
next prev parent reply other threads:[~2011-02-27 14:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-27 14:21 [PATCH] sd: sd should not modify read capacity, cache type or write protect flag on rescan when there is a transport error Menny_Hamburger
2011-02-27 14:51 ` Matthew Wilcox [this message]
2011-02-28 15:34 ` James Bottomley
2011-03-08 9:30 ` Menny_Hamburger
2011-03-08 14:22 ` James Bottomley
2011-03-10 0:01 ` Mike Christie
2011-03-10 8:49 ` Menny_Hamburger
2011-03-10 20:28 ` Mike Christie
2011-03-24 11:10 ` Menny_Hamburger
-- strict thread matches above, loose matches on Subject: below --
2011-02-27 14:58 Menny_Hamburger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110227145112.GG13726@parisc-linux.org \
--to=matthew@wil.cx \
--cc=Menny_Hamburger@Dell.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox