Bug 249067 - dosfslabel fails to read/write label on device-mapper device
dosfslabel fails to read/write label on device-mapper device
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: dosfstools (Show other bugs)
5.3
All Linux
low Severity medium
: ---
: ---
Assigned To: Stepan Kasal
:
Depends On:
Blocks: 228988
  Show dependency treegraph
 
Reported: 2007-07-20 14:17 EDT by Jun'ichi NOMURA
Modified: 2013-04-12 15:15 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 483085 (view as bug list)
Environment:
Last Closed: 2010-01-06 03:55:13 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)
a patch for mkdosfs (682 bytes, patch)
2007-07-20 14:17 EDT, Jun'ichi NOMURA
no flags Details | Diff
reproducer shell script (533 bytes, application/x-sh)
2007-07-20 14:20 EDT, Jun'ichi NOMURA
no flags Details

  None (edit)
Description Jun'ichi NOMURA 2007-07-20 14:17:28 EDT
Description of problem:
  dosfslabel fails to read/write label on device-mapper device

Version-Release number of selected component:
  dosfstools-2.11-6.2.el5
  device-mapper-multipath-0.4.7-10.el5
  dmraid-1.0.0.rc13-2.el5

How reproducible:
  Always

Steps to Reproduce:
  1. Create DM device (multipath, dmraid, etc.)
  2. Execute dosfslabel to write a label on it

Actual results:
  # dosfslabel /dev/mapper/200301384044c0009p1 a
  Invalid disk format in boot sector.
  # dosfslabel /dev/mapper/200301384044c0009p1 
  Invalid disk format in boot sector.

Expected results:
  # dosfslabel /dev/mapper/200301384044c0009p1 a
  # dosfslabel /dev/mapper/200301384044c0009p1 
  a          

Additional Info:
  The same operation works on loop device.
    # losetup /dev/loop0 loopfile
    # mkdosfs /dev/loop0
    mkdosfs 2.11 (12 Mar 2005)
    Loop device does not match a floppy size, using default hd params
    # dosfslabel /dev/loop0 a
    # dosfslabel /dev/loop0
    a

  The problem is caused by the following reasons:
    1. dosfslabel checks the FAT superblock to see if the 'secs_track'
       and 'heads' values are non-zero (and they are actually zero),
    2. 'secs_track' and 'heads' are set by mkdosfs, the values came
       from the result of HDIO_GETGEO ioctl or the default ones if the ioctl
       fails (ioctl returns successful but all-zero result),
    3. unless user-space program specifically sets the geometry with
       dm_task_set_geometry() library call, device-mapper device returns
       all-zero geometry for HDIO_GETGEO ioctl (and neither multipath-tools,
       kpartx nor dmraid calls dm_task_set_geometry())

  Possible fix:
    a) Modify multipath-tools, kpartx and dmraid to set the geometry
       on the DM device
    b) Modify device-mapper to return -ENOTTY if the geometry isn't set
    c) Modify mkdosfs to use the default value if the returned geometry
       is all-zero
    d) Modify dosfslabel to ignore 'secs_track' and 'heads' being zero
 
  a) will be the most productive as it could solve other possible issues
  regarding the geometry and HDIO_GETGEO. But it will take time.

  Others are workaround.
  Attached is a patch to do c).
Comment 1 Jun'ichi NOMURA 2007-07-20 14:17:28 EDT
Created attachment 159671 [details]
a patch for mkdosfs
Comment 2 Jun'ichi NOMURA 2007-07-20 14:20:20 EDT
Created attachment 159672 [details]
reproducer shell script

Test script to do dosfslabel on DM device (on top of loop dev).

# sh dosfslabel-fail.sh 
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.000104256 seconds, 9.6 kB/s
mkdosfs 2.11 (12 Mar 2005)
Invalid disk format in boot sector.
Invalid disk format in boot sector.
Invalid disk format in boot sector.
FAIL
Comment 3 RHEL Product and Program Management 2007-12-03 15:44:18 EST
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release.  This request will
be reviewed for a future Red Hat Enterprise Linux release.
Comment 9 Daniel Baumann 2009-12-24 04:07:57 EST
Hi,

I could not reproduce this, it works fine with 3.0.6.

Regards,
Daniel
Comment 10 errata-xmlrpc 2010-01-06 03:55:13 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0007.html

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