Skip to contentSkip to conversation

scsi_id: sending ioctl 2285 to a partition

DISCUSSION Matthew Wilcox 5 participants 15 messages Feb 9, 2012 – Feb 11, 2012

lore
Share & tools
lore
#0 lore raw

Commit 0bfc96cb77 adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark". 0x2285 is SG_IO. I'm not sure why scsi_id feels that it needs to repeatedly send a SCSI INQUIRY to a partition, but there we are.

Oh, userspace is RHEL 6.2 and the kernel in use is 3.2.3.

#1 lore raw
Quoted 5 lines · Matthew Wilcox

Commit 0bfc96cb77 adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark".  0x2285 is SG_IO. I'm not sure why scsi_id feels that it needs to repeatedly send a SCSI INQUIRY to a partition, but there we are.

So is it doing this as root (in which case we end up allowing it) or as a normal user (in which case we end up disallowing it)?

And does it all work well apart from the printk? Because the printk itself is scheduled to be removed, it's only there to hear about users that may be doing crazy things that got disallowed by the patches in question?

Linus

#2 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Matthew Wilcox

Commit 0bfc96cb77 adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark".  0x2285 is SG_IO. I'm not sure why scsi_id feels that it needs to repeatedly send a SCSI INQUIRY to a partition, but there we are.

So is it doing this as root (in which case we end up allowing it) or as a normal user (in which case we end up disallowing it)?

I'm pretty sure it's doing it as root ... it'll be run by udev, after all.

Quoted 4 lines

And does it all work well apart from the printk? Because the printk itself is scheduled to be removed, it's only there to hear about users that may be doing crazy things that got disallowed by the patches in question?

If it is being run as root, then the printk is pointless, right?

#3 lore raw
Quoted 6 lines · Matthew Wilcox
Quoted 4 lines

And does it all work well apart from the printk? Because the printk itself is scheduled to be removed, it's only there to hear about users that may be doing crazy things that got disallowed by the patches in question?

If it is being run as root, then the printk is pointless, right?

No. The original patch actually disallowed it for everybody, including root. The "let them through with a warning"

So part of the point of the printk was to see if these things happened at all. We should have made the root'ness explicit in the printk, though, to see that part too.

Linus

#4 lore raw
In reply to Matthew Wilcox
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Matthew Wilcox

Commit 0bfc96cb77 adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark". 0x2285 is SG_IO. I'm not sure why scsi_id feels that it needs to repeatedly send a SCSI INQUIRY to a partition, but there we are.

Quoted 4 lines
Quoted 2 lines

So is it doing this as root (in which case we end up allowing it) or as a normal user (in which case we end up disallowing it)?

I'm pretty sure it's doing it as root ... it'll be run by udev, after all.

What does the rule look like? Here it is like this:

# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"

which should exclude partitions, and indeed I don't see any such message. I also have this rule:

# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

which makes it clear that udev does not need to send INQUIRY to the partition.

Quoted 6 lines
Quoted 4 lines

And does it all work well apart from the printk? Because the printk itself is scheduled to be removed, it's only there to hear about users that may be doing crazy things that got disallowed by the patches in question?

If it is being run as root, then the printk is pointless, right?

At the time the printk is removed, access also will be disallowed to root.

Paolo

#5 lore raw
Quoted 2 lines · Paolo Bonzini

At the time the printk is removed, access also will be disallowed to root.

Well, that's clearly not going to be the case, since the printk is finding way more cases than the initial expectation was.

Linus

#6 lore raw
Quoted 3 lines · Linus Torvalds
Quoted 1 line
Quoted 1 line

At the time the printk is removed, access also will be disallowed to root.

Well, that's clearly not going to be the case, since the printk is finding way more cases than the initial expectation was.

This is the only interesting case so far, i.e. the patch is actually changing the behavior (but it's still unclear why it happens; it may be misconfiguration or even fixing a bug).

That said, yeah, 1 _is_ way more than 0.

Paolo

#7 lore raw
In reply to Paolo Bonzini
Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Matthew Wilcox
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Matthew Wilcox

Commit 0bfc96cb77 adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark". 0x2285 is SG_IO. I'm not sure why scsi_id feels that it needs to repeatedly send a SCSI INQUIRY to a partition, but there we are.

So is it doing this as root (in which case we end up allowing it) or as a normal user (in which case we end up disallowing it)?

Quoted 8 lines
Quoted 1 line

I'm pretty sure it's doing it as root ... it'll be run by udev, after all.

What does the rule look like? Here it is like this:

# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"

The rule I had was not excluding partitions. I'll fix that and try again.

thanks,

doug

Quoted 18 lines

which should exclude partitions, and indeed I don't see any such message. I also have this rule:

# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

which makes it clear that udev does not need to send INQUIRY to the partition.

Quoted 6 lines
Quoted 4 lines

And does it all work well apart from the printk? Because the printk itself is scheduled to be removed, it's only there to hear about users that may be doing crazy things that got disallowed by the patches in question?

If it is being run as root, then the printk is pointless, right?

At the time the printk is removed, access also will be disallowed to root.

Paolo

#8 lore raw
Quoted 6 lines · Doug
Quoted 4 lines
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"

The rule I had was not excluding partitions. I'll fix that and try again.

So was it a custom rule, or it came with the distro?

Paolo

#9 lore raw
Quoted 9 lines · Paolo Bonzini
Quoted 7 lines
Quoted 4 lines
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"

The rule I had was not excluding partitions. I'll fix that and try
again.

So was it a custom rule, or it came with the distro?

More important: did you have something like this:

# for partitions import parent information
ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

?

Paolo

#10 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini
Quoted 6 lines · Doug
Quoted 4 lines
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"

The rule I had was not excluding partitions. I'll fix that and try again.

So was it a custom rule, or it came with the distro?

It's a custom rule we've been using for a long time to rename our 672 x ssd's.

Quoted 1 line

Paolo

#11 lore raw
Quoted 5 lines · Doug
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The rule I had was not excluding partitions. I'll fix that and try
again.

So was it a custom rule, or it came with the distro?

It's a custom rule we've been using for a long time to rename our 672 x ssd's.

Can you post the whole snippet?

Paolo

#12 lore raw
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Doug
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"

The rule I had was not excluding partitions. I'll fix that and try
again.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

So was it a custom rule, or it came with the distro?

It's a custom rule we've been using for a long time to rename our 672 x ssd's.

Can you post the whole snippet?

Here's what I had in 20-local.rules

KERNEL=="sd*", BUS=="scsi", PROGRAM="scsi_id --whitelisted -d $tempnode", ENV{ID_BUS}="scsi"

BUS=="scsi", RESULT=="3500151795924153d", NAME="disk-r1e1-d1s%n", GROUP:="dba", OWNER:="oracle" BUS=="scsi", RESULT=="35001517959269241", NAME="disk-r1e1-d2s%n", GROUP:="dba", OWNER:="oracle" BUS=="scsi", RESULT=="3500151795926930d", NAME="disk-r1e1-d3s%n", GROUP:="dba", OWNER:="oracle"

Quoted 2 lines

Paolo

#13 lore raw
Quoted 6 lines · Doug

Here's what I had in 20-local.rules

KERNEL=="sd*", BUS=="scsi", PROGRAM="scsi_id --whitelisted -d $tempnode", ENV{ID_BUS}="scsi"

Quoted 7 lines

BUS=="scsi", RESULT=="3500151795924153d", NAME="disk-r1e1-d1s%n", GROUP:="dba", OWNER:="oracle"
BUS=="scsi", RESULT=="35001517959269241", NAME="disk-r1e1-d2s%n", GROUP:="dba", OWNER:="oracle"
BUS=="scsi", RESULT=="3500151795926930d", NAME="disk-r1e1-d3s%n", GROUP:="dba", OWNER:="oracle"

Thanks. I think we could fix scsi_id to strip a partition number and print itself a warning if passed a partition number.

That said, the above rules alone would have failed with latest udev due to the use of BUS= (removed in udev 174).

Paolo

#14 lore raw
In reply to Paolo Bonzini
Quoted 6 lines · Paolo Bonzini
Quoted 1 line · Matthew Wilcox

I'm pretty sure it's doing it as root ... it'll be run by udev, after all.

What does the rule look like?  Here it is like this:

Quoted 7 lines
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*",
IMPORT{program}="scsi_id --export --whitelisted -d $tempnode",
ENV{ID_BUS}="scsi"

which should exclude partitions, and indeed I don't see any such message.  I also have this rule:

I don't think "sd*[!0-9]" matches partition devices.

Kay