public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* out of range LBA using sg_raw
@ 2017-03-08 14:21 Kashyap Desai
  2017-03-08 15:11 ` Christoph Hellwig
  0 siblings, 1 reply; 10+ messages in thread
From: Kashyap Desai @ 2017-03-08 14:21 UTC (permalink / raw)
  To: linux-kernel, linux-scsi

Hi -

Need help to understand  if below is something we should consider to be
fixed in megaraid_sas driver or call as unreal exposure.

I have created slice VD of size 10GB (raid 1) using 2 drives.  Each
Physical Drive size is 256GB.

Last LBA of the VD and  actual Physical disk associated with that VD is
different. Actual Physical disk has larger range of LBA compare VD.

Below is readcap detail of VD0

# sg_readcap /dev/sdu
Read Capacity results:
   Last logical block address=20971519 (0x13fffff), Number of
blocks=20971520
   Logical block length=512 bytes
Hence:
   Device size: 10737418240 bytes, 10240.0 MiB, 10.74 GB

Using below sg_raw command, we should see "LBA out of range" sense.  In
CDB 0x28, pass LBA beyond last lba of VD 0x13fffff.

sg_raw -r 4k /dev/sdx 28 00 01 4f ff ff 00 00 08 00

It works if VD created behind MR controller does not support Fast Path
Write.
In case of Fast Path Write, driver convert LBA of VD to underlying
Physical disk and send IO direct to the physical disk. Since Physical disk
has enough LBA range to respond, it will not send "LBA out of range
sense".

Megaraid_Sas driver never validate range of LBA for VD as it assume to be
validated by upper layer in scsi stack. Other sg_tool method like sg_dd,
sg_write, dd etc has checks of LBA range and driver never receive out of
range LBA.

What is a suggestion ? Shall I add check in megaraid_sas driver or it is
not a valid scenario as "sg_raw" tool can send any type of command which
does not require multiple sanity in driver.

Thanks, Kashyap

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-09  0:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 14:21 out of range LBA using sg_raw Kashyap Desai
2017-03-08 15:11 ` Christoph Hellwig
2017-03-08 15:59   ` Kashyap Desai
2017-03-08 16:04     ` Bart Van Assche
2017-03-08 16:15       ` Kashyap Desai
2017-03-08 16:06     ` Christoph Hellwig
2017-03-08 16:11       ` Kashyap Desai
2017-03-08 16:32     ` Martin K. Petersen
2017-03-08 16:49       ` Kashyap Desai
2017-03-09  0:40         ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox