* [linux-lvm] LVM2 tools lvmcmdline.c major and minor number limits
@ 2008-02-13 11:02 Darren Lavender
2008-02-13 12:15 ` Alasdair G Kergon
0 siblings, 1 reply; 4+ messages in thread
From: Darren Lavender @ 2008-02-13 11:02 UTC (permalink / raw)
To: linux-lvm
I was wondering whether there was any particular reason why the
limitations below are still present given that these were changed
between 2.4 and 2.6 linux kernels?
Eg:
LVM2/tools/lvmcmdline.c
int minor_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
char *ptr;
if (!_get_int_arg(a, &ptr) || (*ptr) || (a->sign == SIGN_MINUS))
return 0;
if (a->i_value > 255) {
log_error("Minor number outside range 0-255");
return 0;
}
return 1;
}
int major_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
{
char *ptr;
if (!_get_int_arg(a, &ptr) || (*ptr) || (a->sign == SIGN_MINUS))
return 0;
if (a->i_value > 255) {
log_error("Major number outside range 0-255");
return 0;
}
/* FIXME Also Check against /proc/devices */
return 1;
}
Linux 2.4 kernel appears to have a major number of 8 bits, likewise for
the minor number.
By comparison, 2.6 appears to have 12 bits for the major and 20 bits for
the minor, significantly larger, eg:
4 #define MINORBITS 20
5 #define MINORMASK ((1U << MINORBITS) - 1)
6
7 #define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
8 #define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
9 #define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi))
Whilst these LVM2 hardcoded limits do not prevent device nodes being
created during normal operation they do prevent the user from specifying
specific major/minor numbers via the cmdline, eg:
# lvcreate -n bigminor -l 5 -M y --major 253 --minor 270 vgtest
Minor number outside range 0-255
Invalid argument 270
Error during parsing of command line.
Rebuilding without these limits (a quick hack/test) produces a device
node that seems to work just fine:
# ./lvm lvcreate -n highminor -l 5 -M y --major 253 --minor 260 vgtest
Logical volume "highminor" created
# ll /dev/mapper/
total 128
drwxr-xr-x 2 root root 4096 Feb 12 16:29 .
drwxr-xr-x 35 root root 122880 Feb 12 16:29 ..
lrwxrwxrwx 1 root root 16 Feb 12 15:52 control -> ../device-mapper
brw------- 1 root root 253, 260 Feb 12 16:29 vgtest-highminor
brw------- 1 root root 253, 250 Feb 12 16:04 vgtest-lowminor
brw------- 1 root root 253, 0 Feb 12 16:04 vgtest-nominor
Can this limitation be either removed or updated to bring it in line
with more recent kernel functionality? Or is there some reason that I
am missing for their continued existence/assigned values.....
Thanks & regards
--
Darren Lavender <dl1@hppine99.gbr.hp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-lvm] LVM2 tools lvmcmdline.c major and minor number limits
2008-02-13 11:02 [linux-lvm] LVM2 tools lvmcmdline.c major and minor number limits Darren Lavender
@ 2008-02-13 12:15 ` Alasdair G Kergon
2008-02-13 13:36 ` Darren Lavender
0 siblings, 1 reply; 4+ messages in thread
From: Alasdair G Kergon @ 2008-02-13 12:15 UTC (permalink / raw)
To: LVM general discussion and development
On Wed, Feb 13, 2008 at 11:02:00AM +0000, Darren Lavender wrote:
> I was wondering whether there was any particular reason why the
> limitations below are still present given that these were changed
> between 2.4 and 2.6 linux kernels?
Yes, it's probably time we changed that - nobody's noticed it before.
We just have to check the code copes OK if someone sets it to a large number
then reboots with a kernel that doesn't support it.
Setting the major number at device creation time is *still* not supported in
2.6. (2.4 does support it.)
Alasdair
--
agk@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-lvm] LVM2 tools lvmcmdline.c major and minor number limits
2008-02-13 12:15 ` Alasdair G Kergon
@ 2008-02-13 13:36 ` Darren Lavender
2008-02-13 14:53 ` Alasdair G Kergon
0 siblings, 1 reply; 4+ messages in thread
From: Darren Lavender @ 2008-02-13 13:36 UTC (permalink / raw)
To: LVM general discussion and development
Hi Alasdair
> On Wed, Feb 13, 2008 at 11:02:00AM +0000, Darren Lavender wrote:
> > I was wondering whether there was any particular reason why the
> > limitations below are still present given that these were changed
> > between 2.4 and 2.6 linux kernels?
>
> Yes, it's probably time we changed that - nobody's noticed it before.
> We just have to check the code copes OK if someone sets it to a large number
> then reboots with a kernel that doesn't support it.
Sure.
> Setting the major number at device creation time is *still* not supported in
> 2.6. (2.4 does support it.)
I think the interest is _only_ in the minor number but I noticed that I
had to specify --major at the command line or I received an error:
# lvcreate -n bigminor -l 5 -M y --minor 70 vgtest
Please specify major number with --major when using -My
lvcreate: Create a logical volume
Without the -M I get a different error:
# lvcreate -n new -l 5 --minor 72 vgtest
Couldn't read major number for logical volume bigminor.
Couldn't read major number for logical volume bigminor.
Couldn't read major number for logical volume bigminor.
Couldn't read major number for logical volume new.
Couldn't read major number for logical volume bigminor.
Couldn't read major number for logical volume new.
Missing major number for persistent device
Couldn't create ioctl argument
Couldn't load device 'vgtest-new'.
Perhaps the persistent device number -1:72 is already in use?
Failed to activate new LV.
Hence the reason I just provided the DM major number in my original
example.
The man pages seem not to mention --major but it does show in the usage:
lvcreate
[-A|--autobackup {y|n}]
[--addtag Tag]
[--alloc AllocationPolicy]
[-C|--contiguous {y|n}]
[-d|--debug]
[-h|-?|--help]
[-i|--stripes Stripes [-I|--stripesize StripeSize]]
{-l|--extents LogicalExtentsNumber |
-L|--size LogicalVolumeSize[kKmMgGtT]}
[-M|--persistent {y|n}] [--major major] [--minor minor]
....... ^^^^^^^^^^^^^
So perhaps this whole area needs a little bit of an overhaul...???
Tested on SLES9SP3 with:
2.6.5-7.308-bigsmp #1 SMP Mon Dec 10 11:36:40 UTC 2007 i686 i686 i386
GNU/Linux
rpm -q lvm2:
lvm2-2.01.14-3.23
Regards
--
Darren Lavender
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-lvm] LVM2 tools lvmcmdline.c major and minor number limits
2008-02-13 13:36 ` Darren Lavender
@ 2008-02-13 14:53 ` Alasdair G Kergon
0 siblings, 0 replies; 4+ messages in thread
From: Alasdair G Kergon @ 2008-02-13 14:53 UTC (permalink / raw)
To: LVM general discussion and development
On Wed, Feb 13, 2008 at 01:36:03PM +0000, Darren Lavender wrote:
> I think the interest is _only_ in the minor number but I noticed that I
> had to specify --major at the command line or I received an error:
The validation probably broke at some stage. One day someone might port the
multiple major number support from 2.4 to 2.6, but there doesn't seem to be any
demand for it.
Alasdair
--
agk@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-13 14:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-13 11:02 [linux-lvm] LVM2 tools lvmcmdline.c major and minor number limits Darren Lavender
2008-02-13 12:15 ` Alasdair G Kergon
2008-02-13 13:36 ` Darren Lavender
2008-02-13 14:53 ` Alasdair G Kergon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).