scsi_id: sending ioctl 2285 to a partition
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.
Quoted 5 lines · Matthew Wilcox
Commit
0bfc96cb77adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark". 0x2285 isSG_IO. I'm not sure whyscsi_idfeels 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
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Matthew Wilcox
Commit
0bfc96cb77adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark". 0x2285 isSG_IO. I'm not sure whyscsi_idfeels 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?
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
Quoted 8 lines · Matthew Wilcox
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · Matthew Wilcox
Commit
0bfc96cb77adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark".0x2285isSG_IO. I'm not sure whyscsi_idfeels 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
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
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
Quoted 12 lines · Paolo Bonzini
Quoted 11 lines · Matthew Wilcox
Quoted 9 lines · Linus Torvalds
Quoted 5 lines · Matthew Wilcox
Commit
0bfc96cb77adds this printk that triggers tens of thousands of times during a run of "a well-known database benchmark".0x2285isSG_IO. I'm not sure whyscsi_idfeels 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
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
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
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
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
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
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
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