kern/150858: GEOM_LABEL is not compatible with newfs -r flag
Konstantin Kukushkin
dark at ramtel.ru
Wed Sep 22 12:00:13 UTC 2010
>Number: 150858
>Category: kern
>Synopsis: GEOM_LABEL is not compatible with newfs -r flag
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Sep 22 12:00:12 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Konstantin Kukushkin
>Release: 8.1-STABLE
>Organization:
Rambler
>Environment:
FreeBSD dash.local 8.1-STABLE FreeBSD 8.1-STABLE #0: Wed Sep 22 13:18:16 MSD 2010 root at dash.local:/var/tmp/obj/usr/src/sys/EEE8 i386
>Description:
For any provider, GEOM_LABEL strictly checks that ufs occupied all its
space. But filesystem can be smaller, in case if newfs(8) was run with
-r flag. So, GEOM_LABEL is not compatible with newfs -r flag.
When check is more permissive (as in attached patch) all work OK:
[pts/0] root at dash:/usr/home/dark# uname -rp
8.1-STABLE i386
[pts/0] root at dash:/usr/home/dark# ll /dev/ufsid/
total 0
crw-r----- 1 root operator 0, 93 22 ÓÅÎ 17:24 4992d90831a79611
[pts/0] root at dash:/usr/home/dark# mdconfig -s 32m
md0
[pts/0] root at dash:/usr/home/dark# newfs -r 4 -U /dev/md0
/dev/md0: 32.0MB (65532 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 8.00MB, 512 blks, 1024 inodes.
with soft updates
super-block backups (for fsck -b #) at:
160, 16544, 32928, 49312
[pts/0] root at dash:/usr/home/dark# ll /dev/ufsid/
total 0
crw-r----- 1 root operator 0, 93 22 ÓÅÎ 17:24 4992d90831a79611
crw-r----- 1 root operator 0, 118 22 ÓÅÎ 13:38 4c99ce860db39b88
[pts/0] root at dash:/usr/home/dark# glabel status
Name Status Components
ntfs/sys N/A ada0s1
msdosfs/SYS N/A ada0s2
msdosfs/BIOS N/A ada0s3
ntfs/BIG N/A ada1s2
ufsid/4992d90831a79611 N/A ada1s1a
ufsid/4c99ce860db39b88 N/A md0
>How-To-Repeat:
radius# uname -rp
8.1-20100726-SNAP i386
radius# ll /dev/ufsid/
total 0
crw-r----- 1 root operator 0, 98 21 ÓÅÎ 22:01 4c98f1c148b0469b
crw-r----- 1 root operator 0, 99 21 ÓÅÎ 22:01 4c98f1c978a6bb52
radius# mdconfig -s 32m
md0
radius# newfs -r 4 -U /dev/md0
/dev/md0: 32.0MB (65532 sectors) block size 16384, fragment size 2048
using 4 cylinder groups of 8.00MB, 512 blks, 1024 inodes.
with soft updates
super-block backups (for fsck -b #) at:
160, 16544, 32928, 49312
radius# ll /dev/ufsid/
total 0
crw-r----- 1 root operator 0, 98 21 ÓÅÎ 22:01 4c98f1c148b0469b
crw-r----- 1 root operator 0, 99 21 ÓÅÎ 22:01 4c98f1c978a6bb52
radius# glabel status
Name Status Components
ufsid/4c98f1c148b0469b N/A ada2d
ufsid/4c98f1c978a6bb52 N/A ada3d
>Fix:
Use attached patch.
Patch attached with submission follows:
--- /sys/geom/label/g_label_ufs.c.orig 2010-07-11 23:06:52.000000000 +0400
+++ /sys/geom/label/g_label_ufs.c 2010-09-22 12:21:23.000000000 +0400
@@ -83,10 +83,10 @@
continue;
/* Check for magic and make sure things are the right size */
if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 &&
- pp->mediasize / fs->fs_fsize == fs->fs_old_size) {
+ pp->mediasize / fs->fs_fsize >= fs->fs_old_size) {
/* Valid UFS1. */
} else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 &&
- pp->mediasize / fs->fs_fsize == fs->fs_size) {
+ pp->mediasize / fs->fs_fsize >= fs->fs_size) {
/* Valid UFS2. */
} else {
g_free(fs);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list