Bug 510845

Summary: man page for mount is incorrect about default xfs options
Product: [Fedora] Fedora Reporter: Cristian Ciupitu <cristian.ciupitu>
Component: util-linux-ngAssignee: Karel Zak <kzak>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: esandeen, kzak
Target Milestone: ---Keywords: EasyFix, Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-17 15:39:29 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:
Attachments:
Description Flags
patch for mount man page none

Description Cristian Ciupitu 2009-07-11 14:29:01 UTC
Description of problem:
The man page for mount says the following regarding mount options for xfs:
       attr2 / noattr2
              The options enable/disable (default is disabled for backward  compatibil-
              ity  on-disk) an "opportunistic" improvement to be made in the way inline
              extended attributes are stored on-disk.  When the new form  is  used  for
              the  first  time (by setting or removing extended attributes) the on-disk
              superblock feature bit field will be updated to reflect this format being
              in use.

The default is actually enabled, not disabled.

Version-Release number of selected component (if applicable):
util-linux-ng-2.14.2-9.fc11.x86_64

How reproducible:
Every time.

Steps to Reproduce:
1. Create an XFS partition
2. Run xfs_db on it
3. xfs_db> version
versionnum [0xb4b4+0x8] = V4,ATTR,NLINK,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2  (notice the ATTR2)
4. mount an XFS partition
5. search the partition in /proc/mounts
/dev/mapper/hermesVG-homeVol /home xfs rw,nosuid,nodev,relatime,attr2,nobarrier,logbufs=8,logbsize=256k,noquota 0 0  (notice the attr2)

Actual results:
The partition has attr2 enabled.

Expected results:
The man page should specify that attr2 is enabled by default:
       attr2 / noattr2
              The options enable/disable (default is enabled) an "opportunistic" impro-
              vement to be made in the way inline extended attributes are stored

Additional info:
I've attached a patch of the man page, that I hope is useful.

Comment 1 Cristian Ciupitu 2009-07-11 14:31:36 UTC
Created attachment 351345 [details]
patch for mount man page

Patch for specifying that attr2 is the default xfs mount option.

Comment 2 Karel Zak 2009-09-17 10:02:58 UTC
The mount.8 man page follows the kernel Documentation/fs/xfs.txt file.

I think the real "attr" setting depends on mkfs.xfs, it seems that this feature
is always enabled (by default) for all newly created xfs filesystems. You can
also change this setting by the attr= mkfs.xfs option. 

I guess that Linux kernel (by default) follows on-disk data (superblock feature
flags). Maybe the man page and Documentation/fs/xfs.txt should be be updated to
say something like "... by default attr2 depends mkfs.xfs version and setting".

Eric, any comment & suggestion?

Comment 3 Cristian Ciupitu 2009-09-17 11:16:51 UTC
(In reply to comment #2)
> Eric, any comment & suggestion?

I reported this issue only after I talked with Eric Sandeen about it. He's the one who taught me how to check if the attr2 attribute is enabled because I couldn't believe that the man page was incorrect (outdated).

Comment 4 Eric Sandeen 2009-09-17 15:01:17 UTC
Ugh it's kind of a mess ;)

I think the right way to look at it is that mkfs sets the initial default, and the mount option can override for newly created attrs.  If attr1 was mkfs'd and attr2 was a mount option and an attribute gets created, the fs is now an "attr2" fs, and will create attr2 attributes until/unless "noattr2" is specified.

But today, yes, attr2 is the default all the way around.

mkfs:
int
main(
...
        attrversion = 2;
...

kernel:

        /*
         * mkfs'ed attr2 will turn on attr2 mount unless explicitly
         * told by noattr2 to turn it off
         */
        if (xfs_sb_version_hasattr2(&mp->m_sb) &&
            !(mp->m_flags & XFS_MOUNT_NOATTR2))
                mp->m_flags |= XFS_MOUNT_ATTR2;

-Eric

Comment 5 Karel Zak 2009-09-17 15:39:29 UTC
Thanks Eric and Cristian.

The man page has been fixed in the upstream repository and should be available in F-12.