Bug 216898 - mkfs.gfs2 needs to zero the first 16 blocks of file system
mkfs.gfs2 needs to zero the first 16 blocks of file system
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gfs2-utils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Robert Peterson
GFS Bugs
Depends On:
  Show dependency treegraph
Reported: 2006-11-22 11:20 EST by Robert Peterson
Modified: 2010-01-11 22:36 EST (History)
2 users (show)

See Also:
Fixed In Version: RC
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-02-07 19:49:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to fix the problem (648 bytes, patch)
2006-11-22 13:37 EST, Robert Peterson
no flags Details | Diff

  None (edit)
Description Robert Peterson 2006-11-22 11:20:40 EST
Description of problem:
If you run mkfs.gfs2 on an existing file system, the first 16 blocks
of the file system are not being zeroed, and they should be.
If we don't, the leftover data in the new file system may be
misinterpreted as what it was prior to mkfs.gfs2.

For example, vfat and xfs both store their superblock at block 0.
If we don't zero it out, someone could try to mount the gfs2 
file system as the old type which will most likely panic the kernel.
Worse yet, someone could run mkfs.gfs2 on a raw device that used to 
be part of an lvm volume, and they might in theory confuse lvm.

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

How reproducible:

Steps to Reproduce:
1. mkfs.vfat /dev/bobs_vg/lvol7
2. mkfs.gfs2 -t bob_cluster2:lv7 -p lock_dlm -j 2 /dev/bobs_vg/lvol7
3. mkfs.gfs2 -t bob_cluster2:lv7 -p lock_dlm -j 2 /dev/bobs_vg/lvol7
Actual results:
On the second call to mkfs.gfs2, it says:
This will destroy any data on /dev/bobs_vg/lvol7.
  It appears to contain a vfat filesystem.

Are you sure you want to proceed? [y/n] 

Expected results:
Should only be recognized as gfs2, not vfat:

This will destroy any data on /dev/bobs_vg/lvol7.
  It appears to contain a gfs2 filesystem.

Are you sure you want to proceed? [y/n] 

Additional info:
Problem is in libgfs2, structures.c, function build_sb.
The buffers for blocks 0 - 15 are not being updated.
Comment 1 Robert Peterson 2006-11-22 13:37:53 EST
Created attachment 141927 [details]
patch to fix the problem

Here's a patch to libgfs2/structures.c to fix the problem.
Comment 3 RHEL Product and Program Management 2007-02-07 19:49:33 EST
A package has been built which should help the problem described in 
this bug report. This report is therefore being closed with a resolution 
of CURRENTRELEASE. You may reopen this bug report if the solution does 
not work for you.

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