The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: WangYuli <wangyuli@uniontech.com>,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
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: Mon, 24 Feb 2025 10:11:58 -0800	[thread overview]
Message-ID: <ad1ba59a-3a67-4b3c-a05d-c4e56405cc19@acm.org> (raw)
In-Reply-To: <ADB8844D07D40320+20250224034832.40529-1-wangyuli@uniontech.com>

On 2/23/25 7:48 PM, WangYuli wrote:
> However, "lshw" disregards the "use_192_bytes_for_3f" attribute and
> transmits data with a length of 0xff bytes via ioctl, which can cause
> some hard drives to hang and become unusable.

lshw is a user space utility. use_192_bytes_for_3f is not exposed to
user space as far as I know. So how can the above statement be correct?

> @@ -1613,6 +1614,17 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
> +	/*
> +	 * Before we queue this command, check attribute use_192_bytes_for_3f.
> +	 * Because transmits data with a length of 0xff bytes via ioctl may
> +	 * cause some hard drives to hang and become unusable.
> +	 */
> +	if (cmd->cmnd[0] == MODE_SENSE && sdev->use_192_bytes_for_3f &&
> +		cmd->cmnd[2] == 0x3f && cmd->cmnd[4] != 192) {
> +		cmd->result = DID_ABORT << 16;
> +		goto done;
> +	}

 From include/scsi/scsi_device.h:

unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */

The above code uses use_192_bytes_for_3f for another purpose. Please 
respect the purpose of the use_192_bytes_for_3f bitfield.

Thanks,

Bart.


  reply	other threads:[~2025-02-24 18:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24  3:48 [RESEND PATCH v3] scsi: Bypass certain SCSI commands on disks with "use_192_bytes_for_3f" attribute WangYuli
2025-02-24 18:11 ` Bart Van Assche [this message]
2025-02-25 13:11   ` WangYuli
2025-02-25 20:54     ` Bart Van Assche
2025-02-26  2:31       ` WangYuli
  -- strict thread matches above, loose matches on Subject: below --
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=ad1ba59a-3a67-4b3c-a05d-c4e56405cc19@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --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=wangyuli@uniontech.com \
    --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