* [PATCH] Ignore partition table on device
@ 2007-06-02 18:55 Jonathan Schleifer
2007-06-02 20:29 ` H. Peter Anvin
2007-06-02 22:54 ` Andries Brouwer
0 siblings, 2 replies; 8+ messages in thread
From: Jonathan Schleifer @ 2007-06-02 18:55 UTC (permalink / raw)
To: aeb; +Cc: linux-kernel
Hello.
This patch adds a new kernel parameter (ignore_partitions=device) to
the kernel. It is useful when using a fake RAID with dmraid so that
Linux won't complain about attemps to access the drive beyond its
boundaries when udev and/or hald are started.
--- linux-2.6.21.1/fs/partitions/check.c.orig 2007-06-02 14:19:26.000000000 +0200
+++ linux-2.6.21.1/fs/partitions/check.c 2007-06-02 15:16:22.000000000 +0200
@@ -39,6 +39,14 @@
extern void md_autodetect_dev(dev_t dev);
#endif
+static char * __initdata ignore_dev;
+static int __init ignore_dev_fn(char *str)
+{
+ ignore_dev = str;
+ return 1;
+}
+__setup("ignore_partitions=", ignore_dev_fn);
+
int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/
static int (*check_part[])(struct parsed_partitions *, struct block_device *) = {
@@ -165,6 +173,13 @@
sprintf(state->name, "p");
state->limit = hd->minors;
+
+ if (ignore_dev != NULL && !strcmp(state->name, ignore_dev)) {
+ memset(&state->parts, 0, sizeof(state->parts));
+ printk(" partition table ignored.\n");
+ return state;
+ }
+
i = res = err = 0;
while (!res && check_part[i]) {
memset(&state->parts, 0, sizeof(state->parts));
--
Jonathan
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] Ignore partition table on device
2007-06-02 18:55 [PATCH] Ignore partition table on device Jonathan Schleifer
@ 2007-06-02 20:29 ` H. Peter Anvin
2007-06-02 21:34 ` Jonathan Schleifer
2007-06-02 22:54 ` Andries Brouwer
1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2007-06-02 20:29 UTC (permalink / raw)
To: Jonathan Schleifer; +Cc: aeb, linux-kernel
Jonathan Schleifer wrote:
> Hello.
>
> This patch adds a new kernel parameter (ignore_partitions=device) to
> the kernel. It is useful when using a fake RAID with dmraid so that
> Linux won't complain about attemps to access the drive beyond its
> boundaries when udev and/or hald are started.
>
This seems broken. If nothing else, there should be ways to enable or
disable this at runtime.
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Ignore partition table on device
2007-06-02 20:29 ` H. Peter Anvin
@ 2007-06-02 21:34 ` Jonathan Schleifer
2007-06-02 22:21 ` H. Peter Anvin
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Schleifer @ 2007-06-02 21:34 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: aeb, linux-kernel
"H. Peter Anvin" <hpa@zytor.com> wrote:
> This seems broken. If nothing else, there should be ways to enable or
> disable this at runtime.
What exactly do you consider broken?
I don't really see a way to change that at runtime since hard disk
partition tables are read at bootup. Or did you mean to change the
device where the partition table should be ignored at runtime, so one
could enable/disable it and reattach the device under the condition
that it's a removable device?
--
Jonathan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Ignore partition table on device
2007-06-02 21:34 ` Jonathan Schleifer
@ 2007-06-02 22:21 ` H. Peter Anvin
2007-06-02 22:43 ` Jonathan Schleifer
0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2007-06-02 22:21 UTC (permalink / raw)
To: Jonathan Schleifer; +Cc: aeb, linux-kernel
Jonathan Schleifer wrote:
> "H. Peter Anvin" <hpa@zytor.com> wrote:
>
>> This seems broken. If nothing else, there should be ways to enable or
>> disable this at runtime.
>
> What exactly do you consider broken?
> I don't really see a way to change that at runtime since hard disk
> partition tables are read at bootup. Or did you mean to change the
> device where the partition table should be ignored at runtime, so one
> could enable/disable it and reattach the device under the condition
> that it's a removable device?
Partition tables aren't just read at bootup. We also adjust partition
tables at runtime. Since this is dynamic, ignoring partition tables
should be, too.
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Ignore partition table on device
2007-06-02 22:21 ` H. Peter Anvin
@ 2007-06-02 22:43 ` Jonathan Schleifer
2007-06-02 23:49 ` H. Peter Anvin
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Schleifer @ 2007-06-02 22:43 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: aeb, linux-kernel
"H. Peter Anvin" <hpa@zytor.com> wrote:
> Partition tables aren't just read at bootup. We also adjust partition
> tables at runtime. Since this is dynamic, ignoring partition tables
> should be, too.
So this is something that should be done with a sysctl? Anyway, it
should also be possible to disable it already at bootup.
--
Jonathan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Ignore partition table on device
2007-06-02 22:43 ` Jonathan Schleifer
@ 2007-06-02 23:49 ` H. Peter Anvin
0 siblings, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2007-06-02 23:49 UTC (permalink / raw)
To: Jonathan Schleifer; +Cc: aeb, linux-kernel
Jonathan Schleifer wrote:
> "H. Peter Anvin" <hpa@zytor.com> wrote:
>
>> Partition tables aren't just read at bootup. We also adjust partition
>> tables at runtime. Since this is dynamic, ignoring partition tables
>> should be, too.
>
> So this is something that should be done with a sysctl? Anyway, it
> should also be possible to disable it already at bootup.
Well you have:
- Bootup
- Module insertion
- Removable device insertion
- Partition table change
... to be concerned with.
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Ignore partition table on device
2007-06-02 18:55 [PATCH] Ignore partition table on device Jonathan Schleifer
2007-06-02 20:29 ` H. Peter Anvin
@ 2007-06-02 22:54 ` Andries Brouwer
1 sibling, 0 replies; 8+ messages in thread
From: Andries Brouwer @ 2007-06-02 22:54 UTC (permalink / raw)
To: Jonathan Schleifer; +Cc: Andries.Brouwer, linux-kernel
On Sat, Jun 02, 2007 at 08:55:13PM +0200, Jonathan Schleifer wrote:
> This patch adds a new kernel parameter (ignore_partitions=device) to
> the kernel. It is useful when using a fake RAID with dmraid so that
> Linux won't complain about attemps to access the drive beyond its
> boundaries when udev and/or hald are started.
>
> +static char * __initdata ignore_dev;
> + if (ignore_dev != NULL && !strcmp(state->name, ignore_dev)) {
I agree that the current behaviour of touching all devices seen
at boot time is rather undesirable. It adds twenty seconds to the
boot time of my machine, where Linux tries to read nonexisting media
in the on-board usb storage devices, starting error-recovery when that
fails, etc. (These days it also seems that even when no errors occur
everything is done twice - maybe a libata bug, I have not looked,
attached a dmesg fragment.) And the unasked-for guessing has caused
a thin trickle of problems for over ten years.
But this patch is not really an improvement.
It allows you to tell about a single device that the kernel should
not try to find a partition table there, because even if it finds
something that resembles a partition table, it would be mistaken.
The general case is that one wants to say the same thing about
several devices - if you ask me, about all devices, except possibly
for an explicitly specified boot device.
It should be userspace that directs the kernel to probe a device.
It should be udev or some such program that tells the kernel to
look for a partition table on a newly found device. Perhaps even
for a partition table of known type. Or maybe userspace does the
looking itself, using partx or so - sometimes userspace knows better
what to expect.
Maybe there already is such an option in the vanilla kernel,
but if there isnt't it should be added: noautoreadpt.
Andries
"done twice":
[ 26.505536] SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
[ 26.505584] sda: Write Protect is off
[ 26.505616] sda: Mode Sense: 00 3a 00 00
[ 26.505630] SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 26.505713] SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
[ 26.505755] sda: Write Protect is off
[ 26.505787] sda: Mode Sense: 00 3a 00 00
[ 26.505801] SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 26.505844] sda: sda1 sda2 < sda5 >
[ 26.535025] sd 0:0:0:0: Attached scsi disk sda
"done twice":
[ 25.839447] scsi6 : SCSI emulation for USB Mass Storage devices
[ 30.844107] sd 6:0:0:0: Attached scsi removable disk sdb
[ 42.519502] sdb : READ CAPACITY failed.
[ 42.770997] scsi7 : SCSI emulation for USB Mass Storage devices
[ 48.024083] sd 7:0:0:0: Attached scsi removable disk sdb
[ 49.326683] sdb : READ CAPACITY failed.
[ 49.331174] scsi 7:0:0:0: rejecting I/O to dead device
There is nothing wrong with sdb (and sdc, sdd, sde).
They are just USB card readers without media.
This is an Ubuntu 2.6.20 kernel.
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <fa.4wKuD5mNHMp1umbfR+OImkVtgUw@ifi.uio.no>]
end of thread, other threads:[~2007-06-03 6:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-02 18:55 [PATCH] Ignore partition table on device Jonathan Schleifer
2007-06-02 20:29 ` H. Peter Anvin
2007-06-02 21:34 ` Jonathan Schleifer
2007-06-02 22:21 ` H. Peter Anvin
2007-06-02 22:43 ` Jonathan Schleifer
2007-06-02 23:49 ` H. Peter Anvin
2007-06-02 22:54 ` Andries Brouwer
[not found] <fa.4wKuD5mNHMp1umbfR+OImkVtgUw@ifi.uio.no>
[not found] ` <fa.vZzvuMSQgFqVdMg4HFBBvE7gt1s@ifi.uio.no>
2007-06-03 6:39 ` Robert Hancock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox