From nobody@FreeBSD.org  Sun Feb  1 13:46:22 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BFEA816A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Feb 2004 13:46:22 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8C30343D1D
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  1 Feb 2004 13:46:17 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id i11LkHdL027252
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 1 Feb 2004 13:46:17 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id i11LkG4H027249;
	Sun, 1 Feb 2004 13:46:16 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200402012146.i11LkG4H027249@www.freebsd.org>
Date: Sun, 1 Feb 2004 13:46:16 -0800 (PST)
From: Bart Kus <eo@shell-server.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Kernel improperly identifies partition size of concat (grown) vinum volume
X-Send-Pr-Version: www-2.0

>Number:         62228
>Category:       kern
>Synopsis:       [vinum] Kernel improperly identifies partition size of concat (grown) vinum volume
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    le
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 01 13:50:17 PST 2004
>Closed-Date:    Sat Nov 26 16:35:42 GMT 2005
>Last-Modified:  Sat Nov 26 16:35:42 GMT 2005
>Originator:     Bart Kus
>Release:        FreeBSD 5.2.1-RC i386
>Organization:
>Environment:
FreeBSD XXXXXXXXXX.XX.shawcable.net 5.2.1-RC FreeBSD 5.2.1-RC #0: Sun Feb  1 14:50:20 CST 2004     eo@XXXXXXX.XX.shawcable.net:/usr/obj/usr/src/sys/GENERIC  i386
>Description:

      I've ran 4.x on this machine a long time.  I started a
org-concat vinum volume with a single 60GB drive.  Then I added a
120GB, performed a growfs.  Then I added a 160GB and performed another
growfs.  The total (formatted) partition size should be over 300GB now
(and was recognized as such by the 4.9 kernel when mounted).

Then I upgraded to FreeBSD-5.  Vinum recognizes the volume as:

vinum -> l
3 drives:
D ibm1                  State: up       /dev/ad7s1e     A: 0/58644 MB (0%)
D wd1                   State: up       /dev/ad6s1e     A: 0/114470 MB (0%)
D wd2                   State: up       /dev/ad2s1e     A: 0/152625 MB (0%)

1 volumes:
V media                 State: up       Plexes:       1 Size:        318 GB

1 plexes:
P media.p0            C State: up       Subdisks:     3 Size:        318 GB

3 subdisks:
S media.p0.s2           State: up       D: wd2          Size:        149 GB
S media.p0.s0           State: up       D: ibm1         Size:         57 GB
S media.p0.s1           State: up       D: wd1          Size:        111 GB

However, the kernel only sees the volume as:

/dev/vinum/media 171823499 146003951 25819548    85%    /usr/local/media
aka:
/dev/vinum/media   164G   139G    25G    85%    /usr/local/media

164G was the exact size of the partition before the 2nd growfs
operation in 4.9-space (60GB+120GB, formatted).

One might suppose I just need to re-run growfs, however the file
system hasn't lost a single file.  In fact, the file system currently
holds more than 164GB of data (and still has room to allow for
writing):

su-2.05b# cd /usr/local/media
su-2.05b# du -sk
195785335       .
su-2.05b# dd if=/dev/zero of=bigfile bs=1024k count=100
100+0 records in
100+0 records out
104857600 bytes transferred in 6.362625 secs (16480242 bytes/sec)

Why was this mis-reporting problem given a priority of high and
severity of serious?  Because:

su-2.05b# cd
su-2.05b# umount /usr/local/media
su-2.05b# fsck /dev/vinum/media 
** /dev/vinum/media
** Last Mounted on /usr/local/media
** Phase 1 - Check Blocks and Sizes
fsck: /dev/vinum/media: Segmentation fault
su-2.05b# ls -l *.core
-rw-------  1 root  wheel  22872064 Feb  1 15:37 fsck_ufs.core

So now I'm left without the ability to fix up the file system should
anything happen (power outage).  fsck doesn't seem to corrupt the file
system before it crashes at least.

Furthermore, I'm not sure if this is normal:

su-2.05b# disklabel /dev/vinum/media
disklabel: /dev/vinum/media: no valid label found

But in any case, I  suspect fsck's and disklabel's weird behaviour can
be attributed to  the original problem of mis-reading  the file system
data in the kernel.

>How-To-Repeat:

      Not sure exactly, but try: Grow a concat-organized vinum volume
      twice under 4.9, mount volume under FreeBSD-5.2*.  (Perhaps
      exceed 300GB partition size?)

>Fix:
      
>Release-Note:
>Audit-Trail:

From: Lukas Ertl <le@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, eo@shell-server.com
Cc: le@FreeBSD.org
Subject: Re: kern/62228: Kernel improperly identifies partition size of concat
 (grown) vinum volume
Date: Wed, 4 Feb 2004 00:16:36 +0100 (CET)

 > su-2.05b# cd
 > su-2.05b# umount /usr/local/media
 > su-2.05b# fsck /dev/vinum/media
 > ** /dev/vinum/media
 > ** Last Mounted on /usr/local/media
 > ** Phase 1 - Check Blocks and Sizes
 > fsck: /dev/vinum/media: Segmentation fault
 > su-2.05b# ls -l *.core
 > -rw-------  1 root  wheel  22872064 Feb  1 15:37 fsck_ufs.core
 
 Would it be possible for you to get a backtrace out of that?
 
 > Furthermore, I'm not sure if this is normal:
 >
 > su-2.05b# disklabel /dev/vinum/media
 > disklabel: /dev/vinum/media: no valid label found
 
 That's normal, vinum doesn't fake disklabels anymore.
 
 regards,
 le
 
 -- 
 Lukas Ertl                           http://mailbox.univie.ac.at/~le/
 le@FreeBSD.org                       http://people.freebsd.org/~le/

From: Bart Kus <eo@shell-server.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/62228: Kernel improperly identifies partition size of concat
 (grown) vinum volume
Date: Fri, 6 Feb 2004 10:29:03 -0600 (CST)

 Here's a trace of the core dump:
 
 #0  0x08052021 in pass1 () at /usr/src/sbin/fsck_ffs/pass1.c:83
 83                              setbmap(i);
 (gdb) bt
 #0  0x08052021 in pass1 () at /usr/src/sbin/fsck_ffs/pass1.c:83
 #1  0x08051203 in checkfilesys (filesys=0xbfbfedad "/dev/vinum/media")
     at /usr/src/sbin/fsck_ffs/main.c:349
 #2  0x08050ab0 in main (argc=0, argv=0xbfbfecd0)
     at /usr/src/sbin/fsck_ffs/main.c:162
 #3  0x08049166 in _start (ap=0xbfbfeda4 "fsck_ffs")
     at /usr/src/lib/csu/i386-elf/crt1.c:104
 (gdb) list
 78                      if (c == 0) {
 79                              i = cgbase(&sblock, c);
 80                      } else
 81                              i = cgsblock(&sblock, c);
 82                      for (; i < cgd; i++)
 83                              setbmap(i);
 84              }
 85              i = sblock.fs_csaddr;
 86              cgd = i + howmany(sblock.fs_cssize, sblock.fs_fsize);
 87              for (; i < cgd; i++)
 (gdb) print i
 $1 = 179277840
 (gdb) print cgd
 $2 = 179279224
 (gdb) print c
 $3 = 3979
 
 Please let me know if any other info can be provided.
 
 I seem to have exhausted the file system now, btw, by copying about 1GB to
 it.  Kernel messages are:
 
 <loop>
 bad block 198877168, ino 43535234
 pid 96177 (ftpd), uid 1001 inumber 43535234 on /usr/local/media: bad block
 </loop>
 
 This is getting bad.  I'm gonna have to re-install 4.9 soon to run an fsck
 and fix this thing up.
 
 		--Bart
 

From: Bart Kus <eo@shell-server.com>
To: freebsd-gnats-submit@FreeBSD.org, eo@shell-server.com
Cc:  
Subject: Re: kern/62228: Kernel improperly identifies partition size of concat
 (grown) vinum volume
Date: Thu, 05 Feb 2004 11:49:00 -0600

 #0  0x08052021 in pass1 () at /usr/src/sbin/fsck_ffs/pass1.c:83
 83                              setbmap(i);
 (gdb) bt
 #0  0x08052021 in pass1 () at /usr/src/sbin/fsck_ffs/pass1.c:83
 #1  0x08051203 in checkfilesys (filesys=0xbfbfedad "/dev/vinum/media") 
 at /usr/src/sbin/fsck_ffs/main.c:349
 #2  0x08050ab0 in main (argc=0, argv=0xbfbfecd0) at 
 /usr/src/sbin/fsck_ffs/main.c:162
 #3  0x08049166 in _start (ap=0xbfbfeda4 "fsck_ffs") at 
 /usr/src/lib/csu/i386-elf/crt1.c:104
 (gdb) list
 78                      if (c == 0) {
 79                              i = cgbase(&sblock, c);
 80                      } else
 81                              i = cgsblock(&sblock, c);
 82                      for (; i < cgd; i++)
 83                              setbmap(i);
 84              }
 85              i = sblock.fs_csaddr;
 86              cgd = i + howmany(sblock.fs_cssize, sblock.fs_fsize);
 87              for (; i < cgd; i++)
 (gdb) print i
 $1 = 179277840
 (gdb) print cgd
 $2 = 179279224
 (gdb) print c
 $3 = 3979
 
 
 I'm not sure what other info I can offer...but am willing to do almost 
 anything once!
 
 
         --Bart
 
Responsible-Changed-From-To: freebsd-bugs->grog 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sun Feb 8 20:52:35 PST 2004 
Responsible-Changed-Why:  
Assign to vinum author 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62228 
Responsible-Changed-From-To: grog->le 
Responsible-Changed-By: grog 
Responsible-Changed-When: Wed Feb 11 13:57:52 PST 2004 
Responsible-Changed-Why:  
le is looking at Vinum PRs now. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62228 
State-Changed-From-To: open->closed 
State-Changed-By: le 
State-Changed-When: Sat Nov 26 16:35:04 GMT 2005 
State-Changed-Why:  
Since 'classic' vinum isn't supported anymore, close this PR. 

If the described behaviour still exists on newer systems, a new PR can be 
opened. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=62228 
>Unformatted:

Greg Lehey, 12 Februrary 2004

Clean up long lines.
Assign to le.
