Bug 720668

Summary: GFS2: mkfs.gfs2 doesn't work on regular files
Product: Red Hat Enterprise Linux 6 Reporter: Andrew Price <anprice>
Component: clusterAssignee: Andrew Price <anprice>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: low Docs Contact:
Priority: low    
Version: 6.2CC: adas, agk, bmarzins, ccaulfie, cluster-maint, fdinitto, lhh, rpeterso, swhiteho, teigland
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cluster-3.0.12.1-7.el6 Doc Type: Bug Fix
Doc Text:
Cause: mkfs.gfs2 treated regular files as if they were block devices Consequence: Attempting to create a GFS2 file system on a regular file would cause mkfs.gfs2 to fail with a "not a block device" error message. Fix: Additional checks were added so that mkfs.gfs2 does not call block device-specific functions on regular files. Result: GFS2 file systems can now be created on regular files, although this is a feature intended to aid testing and is not a recommended use of GFS2.
Story Points: ---
Clone Of: 719943 Environment:
Last Closed: 2011-12-06 14:52:33 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:
Bug Depends On: 719943, 720935    
Bug Blocks:    
Attachments:
Description Flags
Patch for RHEL6 (unchanged from upstream) swhiteho: review+

Description Andrew Price 2011-07-12 12:48:05 UTC
+++ This bug was initially created as a clone of Bug #719943 +++

Description of problem:

$ dd if=/dev/null of=sparse-file bs=1 count=0 seek=1T
$ ./mkfs.gfs2 -t foo:bar sparse-file 
../../gfs2/libgfs2/libgfs2.h: sparse-file is not a block device

--- Additional comment from anprice on 2011-07-11 10:26:52 EDT ---

Created attachment 512229 [details]
Patch to handle regular files

--- Additional comment from anprice on 2011-07-11 12:22:20 EDT ---

Created attachment 512257 [details]
Patch to handle regular files, v2

--- Additional comment from anprice on 2011-07-11 12:54:36 EDT ---

Patch v2 is now in gfs2-utils.git. Closing as UPSTREAM.

Comment 1 Andrew Price 2011-07-19 10:32:46 UTC
Created attachment 513757 [details]
Patch for RHEL6 (unchanged from upstream)

Upstream patch applies cleanly to the RHEL6 branch.

Comment 2 Steve Whitehouse 2011-07-19 10:39:25 UTC
Comment on attachment 513757 [details]
Patch for RHEL6 (unchanged from upstream)

Looks good to me. Just need to get it posted. Would be good to get the tunegfs2 bugs resolved at the same time, too.

Comment 3 Andrew Price 2011-07-19 10:50:55 UTC
Testing with the above patch:

$ dd if=/dev/null of=sparse-file bs=1 count=0 seek=1T
0+0 records in
0+0 records out
0 bytes (0 B) copied, 9.119e-06 s, 0.0 kB/s
$ ./mkfs.gfs2 -t c:g sparse-file 
This will destroy any data on sparse-file.
It appears to contain: data

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

Device:                    sparse-file
Blocksize:                 4096
Device Size                1024.00 GB (268435456 blocks)
Filesystem Size:           1024.00 GB (268435454 blocks)
Journals:                  1
Resource Groups:           4096
Locking Protocol:          "lock_dlm"
Lock Table:                "c:g"
UUID:                      41aecb85-6fab-2649-7018-9a9ea46907f4

$ fsck.gfs2 sparse-file 
Initializing fsck
Validating Resource Group index.
Level 1 rgrp check: Checking if all rgrp and rindex values are good.
(level 1 passed)
Starting pass1
Pass1 complete      
Starting pass1b
Pass1b complete
Starting pass1c
Pass1c complete
Starting pass2
Pass2 complete      
Starting pass3
Pass3 complete      
Starting pass4
Pass4 complete      
Starting pass5
Pass5 complete      
gfs2_fsck complete

Comment 4 Andrew Price 2011-07-19 11:00:57 UTC
Thanks, Steve. The patch is now in the RHEL6 branch of cluster.git so setting to POST.

Comment 7 Nate Straz 2011-10-18 14:37:24 UTC
Verified against gfs2-utils-3.0.12.1-23.el6.x86_64

Comment 8 Andrew Price 2011-10-27 12:40:44 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:
mkfs.gfs2 treated regular files as if they were block devices
Consequence:
Attempting to create a GFS2 file system on a regular file would cause mkfs.gfs2 to fail with a "not a block device" error message.
Fix:
Additional checks were added so that mkfs.gfs2 does not call block device-specific functions on regular files.
Result:
GFS2 file systems can now be created on regular files, although this is a feature intended to aid testing and is not a recommended use of GFS2.

Comment 9 errata-xmlrpc 2011-12-06 14:52:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1516.html