Bug 364741 - GFS2: gfs2_quota doesn't work unless lock table specified
Summary: GFS2: gfs2_quota doesn't work unless lock table specified
Keywords:
Status: CLOSED ERRATA
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: Chris Feist
QA Contact: GFS Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-11-02 21:35 UTC by Robert Peterson
Modified: 2010-01-12 03:40 UTC (History)
1 user (show)

Fixed In Version: RHBA-2008-0350
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-05-21 17:20:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch to fix the problem (26.56 KB, patch)
2007-11-08 15:22 UTC, Robert Peterson
no flags Details | Diff
Patch to fix the problem (try #2) (26.53 KB, patch)
2007-11-09 17:15 UTC, Robert Peterson
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2008:0350 0 normal SHIPPED_LIVE gfs2-utils bug fix update 2008-05-20 12:44:56 UTC

Description Robert Peterson 2007-11-02 21:35:54 UTC
Description of problem:
I was doing some poking around looking at how the gfs2 tools were
using sysfs, and I discovered that gfs2_quota was using it improperly.
The problem is that gfs2_quota tries to look in /sys/fs/gfs2/<lock table>
for information, but in a stand-alone gfs2 file system, the lock table
may be NULL.  In this case, the kernel uses the vfs s_id instead of the
lock table to name this sysfs directory.  The gfs2_tool overcomes this 
by using functions in util.c.  Really, all the userland tools that use
sysfs need to be doing the same thing.

We should take the functions from gfs2_tool's util.c and put them
into libgfs2 so that they can be linked in by gfs2_tool and gfs2_quota
and any other tools that need to access the sysfs files.

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

How reproducible:
Always

Steps to Reproduce:
1. mkfs.gfs2 /dev/sdb1
2. mount -tgfs2 /dev/sdb1 /mnt/hell
3. gfs2_quota check -f /mnt/hell
  
Actual results:
gfs2_quota: can't open file /sys/fs/gfs2//quota_sync: No such file or directory

Expected results:
Should not error out.  It should use /sys/fs/gfs2/sdb1/*, but it should
do so by using the standard functions from gfs2_tool's util.c.
Like gfs2_tool, we can't assume anything about the device name.
For example, the user can do: mknod /dev/xxx_yyy b 8 17 then mkfs and
mount /dev/xxx_yyy, and the sysfs file will still be in /sys/fs/gfs2/sdb1.

Additional info:
I've got other changes to gfs2_tool that affect this.  They need to be
done first.

Comment 1 RHEL Program Management 2007-11-05 17:14:56 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 2 Robert Peterson 2007-11-08 15:22:38 UTC
Created attachment 251611 [details]
Proposed patch to fix the problem

This is my first attempt at a patch.  Although the patch file is more
than 1000 lines, it's really not that much of a code change.  Basically,
the following is changed (in the order they appear in the patch):

1. Most of the gfs2 utils defined their own versions of IO functions.
   Functions die, do_lseek, do_read, and do_write were standardized and
   moved to a central place, libgfs2.h.  I made an exception for the
   lseek function in gfs2_fsck, which needs to not die on illegal seeks,
   since the file system might be corrupt.  The fsck version of that
   function was renamed.
2. All user space tools were standardized to use these common functions.
3. The same common IO functions referenced the sbd structure in libgfs2's
   buf.c, rather than the file handle, so I changed buf.c to use the
   standard functions.
4. All the functions from gfs2_tool's util.c were moved to libgfs2's
   misc.c which already contained similar functions (e.g. debugfs vs
   sysfs).  So gfs2_tool's util.c is no longer needed.
5. The functions inside gfs2_quota that were referencing the files in
   gfs2's sysfs directory were changed to use the simpler common
   functions that were moved from gfs2_tool to libgfs2.  These are the
   functions that figure out the proper directory within sysfs, even
   if the device does not match the vfs s_id and the lock table is NULL.
   So this is the most important part.

Comment 3 Robert Peterson 2007-11-09 17:15:48 UTC
Created attachment 253041 [details]
Patch to fix the problem (try #2)

Found and fixed a problem.  The previous version wasn't using the "user"
variable like it should have, in check.c's function set_list().

Comment 4 Robert Peterson 2007-11-13 17:09:32 UTC
I tested all the affected tools on roth-01.  Patch reviewed by Abhi.
I checked it in to the HEAD and RHEL5 branches of CVS for inclusion
in RHEL5.2.  Changing status to Modified.


Comment 7 errata-xmlrpc 2008-05-21 17:20:26 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0350.html



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