Bug 104073 - Crash when partitioning > 1TB disk
Crash when partitioning > 1TB disk
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: anaconda (Show other bugs)
9
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeremy Katz
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-09 12:52 EDT by Curtis Regentin
Modified: 2007-04-18 12:57 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-04 23:26:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Curtis Regentin 2003-09-09 12:52:45 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20021120
Netscape/7.01

Description of problem:
When attempting to partition a disk >1TB, if a partition extends beyond the 1TB
mark, it fails.   1TB is 2^31 blocks?... hmmm.

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


How reproducible:
Always

Steps to Reproduce:
Run install and make a partition past the 1TB mark.

Additional info:

Excerpts from the dump:
Traceback (most recent call last):
  File "/usr/bin/anaconda", line 739, in ?
    intf.run(id, dispatch, configFileData)
  File "/usr/lib/anaconda/text.py", line 459, in run
    dispatch.gotoNext()
  File "/usr/lib/anaconda/dispatch.py", line 157, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/dispatch.py", line 225, in moveStep
    rc = apply(func, self.bindArgs(args))
  File "/usr/lib/anaconda/packages.py", line 462, in turnOnFilesystems
    diskset.savePartitions ()
  File "/usr/lib/anaconda/partedUtils.py", line 595, in savePartitions
    disk.commit()
error: Error: Error informing the kernel about modifications to 
partition /dev/sda1 - Invalid argument.  This means Linux won't know about any 
changes you made to /dev/sda1 until you reboot - so you shouldn't mount 
it or use it in any way before rebooting.



And here's the offending partition:
, PreexistingPartitionSpec instance, containing members:
      currentDrive: None
      badblocks: None
      format: 1
      migrate: None
      origfstype: FATFileSystem instance, containing members:
        partedPartitionFlags: []
        checked: 0
        name: vfat
        migratetofs: None
        deviceArguments: {}
        supported: -1
        partedFileSystemType: <PedFileSystemType object at 0x83c2938>
        defaultOptions: defaults
        maxSizeMB: 2048
        extraFormatArgs: []
        formattable: 1
        linuxnativefs: 0
        maxLabelChars: 16
      primary: None
      fstype: Already dumped
      preexist: 1
      dev: PartitionDevice instance, containing members:
        device: sda1
        isSetup: 0
        fsoptions: {}
        doLabel: 1
        label: None
      uniqueID: 1
      device: sda1
      mountpoint: /u1
      requestSize: 1361359.67871
      maxSizeMB: None
      size: 1361359.67871
      end: 2788064684
      drive: sda
      fslabel: None
      grow: 0
      start: 63
      protected: 0
      ignoreBootConstraints: 0
      type: 1
Comment 1 Michael Fulbright 2003-09-10 14:46:12 EDT
If you try to manually partition this device with parted does it fail similarly?
Comment 2 Curtis Regentin 2003-09-18 15:54:34 EDT
The version of parted that gets installed does not fail.  If I recompile a new
version, it does fail - with the same message about not being able to reread the
partition table.  Looks like the bug is in the kernel; patch below.  I also
submitted to the lkml.  Error message as follows:
-----------------------------------------------------------------
bash# ./parted /dev/sdb mkpart primary ext2 0 1710000
Warning: Unable to align partition properly.  This probably means that another
partitioning tool generated an incorrect partition table, because it didn't have
the correct BIOS geometry.  It is safe to ignore,but ignoring may cause
(fixable) problems with some boot loaders.
Ignore/Cancel?
------------------------------------------------------------------

Parted also fails the show the partition properly (though it seems to work
fine), as follows:
------------------------------------------------------------------
bash# parted /dev/sdb print
Disk geometry for /dev/sdb: 0.000-1717021.687 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031 -387155.121  primary   ext2    
-------------------------------------------------------------------    


------------- SNIP FOR PATCH ----------------------
--- linux-2.4.22.old/drivers/block/blkpg.c	2003-09-18 11:48:04.000000000 -0700
+++ linux-2.4.22/drivers/block/blkpg.c	2003-09-18 12:19:25.000000000 -0700
@@ -63,21 +63,20 @@
  *                 or has the same number as an existing one
  *          0: all OK.
  */
+
 int add_partition(kdev_t dev, struct blkpg_partition *p) {
 	struct gendisk *g;
-	long long ppstart, pplength;
-	long pstart, plength;
+	unsigned long long pstart, plength;
 	int i, drive, first_minor, end_minor, minor;
+	unsigned long maxblock = 0xffffffffUL;
 
 	/* convert bytes to sectors, check for fit in a hd_struct */
-	ppstart = (p->start >> 9);
-	pplength = (p->length >> 9);
-	pstart = ppstart;
-	plength = pplength;
-	if (pstart != ppstart || plength != pplength
-	    || pstart < 0 || plength < 0)
+	pstart = (p->start >> 9);
+	plength = (p->length >> 9);
+	if (pstart > maxblock || plength > maxblock || (pstart+plength) > maxblock)
 		return -EINVAL;
 
+
 	/* find the drive major */
 	g = get_gendisk(dev);
 	if (!g)

Comment 3 Curtis Regentin 2003-09-18 16:05:03 EDT
Ok, I put in a wrong error message for the failure under my static compiled
version of parted.  Here's the real one:

...
(parted) mkpart                                                           
Partition type?  primary/extended? pri
File system type?  [ext2]? ext2                                           
Start? 0                                                                  
End? 1710000                                                              
Error: Error informing the kernel about modifications to partition /dev/sdb1 -
Invalid argument.  This means Linux won't know about
any changes you made to /dev/sdb1 until you reboot - so you shouldn't mount it
or use it in any way before rebooting.
Ignore/Cancel?                                                            
Comment 4 Jeremy Katz 2004-10-04 23:26:19 EDT
This is fixed with the 2.6 kernel in current releases.
Comment 5 efgh 2004-12-14 18:53:12 EST
Is this fixed in any of older 2.4.x kernels?

I got the same error with 2.4.23, when I was trying to create a RAID 
5 array with 5 300gig disks..

**********************************************************************
Unhandled exception:

Traceback (most recent call last):
  File "/usr/lib/anaconda", line 739, in ?
    intf.run(id, dispatch, configFileData)
  File "/usr/lib/anaconda/text.py", line 459, in run
    dispatch.gotoNext()
  File "/usr/lib/anaconda/dispatch.py", line 157, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/dispatch.py", line 225, in moveStep
    rc = apply(func, self.bindArgs(args))
  File "/usr/lib/anaconda/packages.py", line 462, in turnOnFilesystems
    diskset.savePartitions()
  File "/usr/lib/anaconda/partedUtils.py", line 595 in savePartitions
    disk.commit ()

error:Error: Error informing the kernel about the modifications to 
partition /dev/sda3 - invalid argument. This means Linux won't know 
about any changes you made to /dev/sda3 until you reboot - so you 
shouldn't mount it or use it in any way before rebooting.
**********************************************************************

Thanks.

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