mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: WangYuli <wangyuli@uniontech.com>
To: Bart Van Assche <bvanassche@acm.org>,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com,
	Alan Stern <stern@rowland.harvard.edu>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	stern@rowland.harvard.edu, zhanjun@uniontech.com,
	niecheng1@uniontech.com, guanwentao@uniontech.com,
	chenlinxuan@uniontech.com, Xinwei Zhou <zhouxinwei@uniontech.com>,
	Xu Rao <raoxu@uniontech.com>,
	Yujing Ming <mingyujing@uniontech.com>
Subject: Re: [RESEND PATCH v3] scsi: Bypass certain SCSI commands on disks with "use_192_bytes_for_3f" attribute
Date: Wed, 26 Feb 2025 10:31:36 +0800	[thread overview]
Message-ID: <4EB8ECD64F601331+e2f01a1f-8da5-4e7b-b909-d920a792756a@uniontech.com> (raw)
In-Reply-To: <3b6cca0d-7aa5-43b6-8f4a-429f17558121@acm.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 1314 bytes --]

Hi Bart,

On 2025/2/26 04:54, Bart Van Assche wrote:
>
> Has it been considered to truncate the MODE SENSE buffer to 192 bytes
> instead of rejecting the MODE SENSE command?
>
>
Alan Stern has raised a related issue before. My take on this is 
outlined below.

I personally think that it is not appropriate to modify it directly
to 192. After all, it is called by the user through ioctl, and the
kernel itself will not construct such a data frame. As shown in the
following code:

sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
       {
              int res;
              struct scsi_device *sdp = sdkp->device;
              struct scsi_mode_data data;
              int old_wp = sdkp->write_prot;

              set_disk_ro(sdkp->disk, 0);
              if (sdp->skip_ms_page_3f) {
sd_first_printk(KERN_NOTICE, sdkp, "Assuming Write Enabled\n");
                      return;
              }

              if (sdp->use_192_bytes_for_3f) {
res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 192, &data, NULL);


Link: 
https://lore.kernel.org/all/137902FEE03CCB3B+6130227f-9ddc-4043-9945-da465c28d9d1@uniontech.com/

-- 
WangYuli

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 645 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2025-02-26  2:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24  3:48 WangYuli
2025-02-24 18:11 ` Bart Van Assche
2025-02-25 13:11   ` WangYuli
2025-02-25 20:54     ` Bart Van Assche
2025-02-26  2:31       ` WangYuli [this message]
2025-03-18  6:11 WangYuli
2025-03-21  1:08 ` Martin K. Petersen
2025-03-26 16:51   ` WangYuli

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=4EB8ECD64F601331+e2f01a1f-8da5-4e7b-b909-d920a792756a@uniontech.com \
    --to=wangyuli@uniontech.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bvanassche@acm.org \
    --cc=chenlinxuan@uniontech.com \
    --cc=guanwentao@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mingyujing@uniontech.com \
    --cc=niecheng1@uniontech.com \
    --cc=raoxu@uniontech.com \
    --cc=stern@rowland.harvard.edu \
    --cc=zhanjun@uniontech.com \
    --cc=zhouxinwei@uniontech.com \
    /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

all inboxes | Powered by JetHome®