linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: linux-lvm@redhat.com
Subject: Re: [linux-lvm] lvm fails when /proc/devices contains "-1 smblk"
Date: Sat, 17 Mar 2012 21:51:40 +0100	[thread overview]
Message-ID: <4F64F95C.3040105@redhat.com> (raw)
In-Reply-To: <1332005463.13726.2.camel@maxim-laptop>

Dne 17.3.2012 18:31, Maxim Levitsky napsal(a):
> On Sat, 2012-03-17 at 16:12 +0000, Alasdair G Kergon wrote: 
>>> Dne 16.3.2012 07:28, John Mesmon napsal(a):
>>>> Block devices:
>>>>  -1 smblk
>>
>> That's outside the range of valid major numbers and surely shouldn't be getting
>> exposed to userspace in /proc/devices.
>>
>> static struct mtd_blktrans_ops sm_ftl_ops = {
>>         .name           = "smblk",
>>         .major          = -1,
>>
>> Why's -1 being used?
>>
>> Alasdair
> 
> Woops. I accidentally assigned it 4096 major.
> I probably thought that it will get me dynamic major number, sorry!
> Will fix soon!
> 


So I've made couple experiments, and it seem that numbers printed via
/proc/devices  are actually not reflecting kernel reality.


It seems that if the kernel driver uses i.e. 'major == -4290'
then  cat /proc/devices  shows exactly this number (-4290).

But the device physically appears with major 3902.
So obviously kernel masks 0xfff and it's using it as unsigned number.

I'll update lvm code to go with same logic - while probably giving a user
warning, the major number used for device is not correct (so they could fixed
just like in smblk case).

Also I guess kernel patch which would fix this behavior might be useful as
well, but lvm needs to work with old kernels anyway.

Zdenek

      reply	other threads:[~2012-03-17 20:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16  6:28 [linux-lvm] lvm fails when /proc/devices contains "-1 smblk" John Mesmon
2012-03-17  9:46 ` Zdenek Kabelac
2012-03-17 16:12   ` Alasdair G Kergon
2012-03-17 17:31     ` Maxim Levitsky
2012-03-17 20:51       ` Zdenek Kabelac [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F64F95C.3040105@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).