Bug 309901 - [kernel dm core] struct dm_dev not available to modules, so no access to underlying bdev
[kernel dm core] struct dm_dev not available to modules, so no access to unde...
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
10
All Linux
low Severity medium
: ---
: ---
Assigned To: Alasdair Kergon
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-27 15:54 EDT by Derek Atkins
Modified: 2009-12-18 06:24 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-12-18 00:58:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Proposed Patch 1 (950 bytes, patch)
2007-09-27 16:53 EDT, Derek Atkins
no flags Details | Diff
Proposed Patch 2 (1.02 KB, patch)
2007-09-27 16:54 EDT, Derek Atkins
no flags Details | Diff

  None (edit)
Description Derek Atkins 2007-09-27 15:54:56 EDT
Description of problem:

I'm working on a device-mapper module but there's no public structure definition
of dm_dev, which means there's no public way to access the underlying bdev. 
This means there's no way to write a mapper module that reads from the
underlying block device.

Version-Release number of selected component (if applicable):

All 2.6 kernels I've tried, but in particular I'm working with 2.6.22.5-76.fc7

How reproducible:

Completely reproducible..  struct dm_dev is only defined in dm.h which is a
private kernel header in drivers/md/ ..  It's referenced as an opaque object in
the public device-mapper.h header in include/linux, but unlike the rest of the
structures defined there, it's not.  Nor is there an API to obtain the
block_device pointer out of the dm_dev object.

Steps to Reproduce:
1. look in include/linux/device-mapper.h and notice that dm_dev isn't fully defined.
2. try to write any device mapper module that needs the underlying block_device
3. notice there's no way to obtain that information from the dm_dev
  
Actual results:

structure isn't publically defined, and there's no way to obtain the
block_device member from the results of dm_get_device()

Expected results:

Either dm_dev should be defined in device-mapper.h, or there needs to be an API
to return the block_device from a dm_dev object.

Additional info:
Comment 1 Chuck Ebbert 2007-09-27 16:04:45 EDT
Is a device-mapper module a kernel module? You would need the kernel-devel
package for building those...
Comment 2 Derek Atkins 2007-09-27 16:20:50 EDT
Yes it is a kernel module, and I have the kernel-devel package installed.  The
problem is that the structure isn't defined in any header distributed by
kernel-devel; it's ONLY defined in the kernel sources under 'drivers/md/dm.h',
which you can find only if you "rpmbuild -bp" the kernel source rpm.
Comment 3 Derek Atkins 2007-09-27 16:53:28 EDT
Created attachment 209001 [details]
Proposed Patch 1

This proposed patch makes the dm_dev structure visible in the public header
Comment 4 Derek Atkins 2007-09-27 16:54:12 EDT
Created attachment 209011 [details]
Proposed Patch 2

This patch keeps the dm_dev structure private but adds a public function to
obtain the block_device from the dm_dev object.
Comment 5 Derek Atkins 2007-09-27 16:56:25 EDT
I just attached two patches, either of which would solve the problem.  Both of
them should at least show what I mean by the block_device member of dm_dev.  I
don't particularly care which method gets implemented, which is why I proposed
both methods.

I've added [patch] to the summary; feel free to adjust as necessary.

Thanks
Comment 6 Chuck Ebbert 2007-09-28 13:55:43 EDT
Adding lvm-team to the cc:
Comment 7 Alasdair Kergon 2007-09-29 05:21:57 EDT
Surprisingly, you're the first person to ask for this!

(We'll make a decision on how to export this and some related things upstream,
then the solution will get sucked into Fedora.)
Comment 8 Christopher Brown 2008-01-14 13:00:00 EST
Hello,

I'm reviewing this bug as part of the kernel bug triage project, an attempt to
isolate current bugs in the Fedora kernel.

http://fedoraproject.org/wiki/KernelBugTriage

There hasn't been much activity on this bug for a while. Has the solution been
sucked? :)

If the problem no longer exists then please close this bug or I'll do so in a
few days if there is no additional information lodged.
Comment 9 Alasdair Kergon 2008-01-14 13:20:29 EST
.
Comment 10 Bug Zapper 2008-05-13 23:17:39 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 11 Bug Zapper 2009-06-09 18:53:06 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 12 Derek Atkins 2009-06-10 10:05:15 EDT
This is still an issue in F10;
Probably still in F11 but I haven't tried that yet.
Comment 13 Bug Zapper 2009-11-18 05:08:06 EST
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 14 Bug Zapper 2009-12-18 00:58:52 EST
Fedora 10 changed to end-of-life (EOL) status on 2009-12-17. Fedora 10 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 15 Alasdair Kergon 2009-12-18 06:22:00 EST
I think this is resolved now: let's see.

For display purposes, we have:

const char *dm_device_name(struct mapped_device *md)
{
        return md->name;
}
EXPORT_SYMBOL_GPL(dm_device_name);

Or we have, e.g. for use with disk_devt() or disk_to_dev():
/*
 * The gendisk is only valid as long as you have a reference
 * count on 'md'.
 */
struct gendisk *dm_disk(struct mapped_device *md)
{
        return md->disk;
}
Comment 16 Alasdair Kergon 2009-12-18 06:24:17 EST
and device-mapper.h does now contain

struct dm_dev {
        struct block_device *bdev;
        fmode_t mode;
        char name[16];
};

Note You need to log in before you can comment on or make changes to this bug.