Bug 216898 - mkfs.gfs2 needs to zero the first 16 blocks of file system
Summary: mkfs.gfs2 needs to zero the first 16 blocks of file system
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gfs2-utils
Version: 5.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Robert Peterson
QA Contact: GFS Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-22 16:20 UTC by Robert Peterson
Modified: 2010-01-12 03:36 UTC (History)
2 users (show)

Fixed In Version: RC
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-02-08 00:49:33 UTC
Target Upstream Version:
Embargoed:


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

Description Robert Peterson 2006-11-22 16:20:40 UTC
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):
RHEL5

How reproducible:
Always

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 18:37:53 UTC
Created attachment 141927 [details]
patch to fix the problem

Here's a patch to libgfs2/structures.c to fix the problem.

Comment 3 RHEL Program Management 2007-02-08 00:49:33 UTC
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.