Bug 104073

Summary: Crash when partitioning > 1TB disk
Product: [Retired] Red Hat Linux Reporter: Curtis Regentin <cregentin>
Component: anacondaAssignee: Jeremy Katz <katzj>
Status: CLOSED CURRENTRELEASE QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: linux_issues, ppokorny
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-05 03:26:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Curtis Regentin 2003-09-09 16:52:45 UTC
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 18:46:12 UTC
If you try to manually partition this device with parted does it fail similarly?

Comment 2 Curtis Regentin 2003-09-18 19:54:34 UTC
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 20:05:03 UTC
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-05 03:26:19 UTC
This is fixed with the 2.6 kernel in current releases.

Comment 5 efgh 2004-12-14 23:53:12 UTC
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.