Bug 851246 - [xfs/xfsprogs] xfs_admin can't turn on the support for projid32bit option on lvm devices
[xfs/xfsprogs] xfs_admin can't turn on the support for projid32bit option on ...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: xfsprogs (Show other bugs)
7.0
All Linux
unspecified Severity high
: rc
: ---
Assigned To: Eric Sandeen
BaseOS QE - Apps
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-23 11:01 EDT by Boris Ranto
Modified: 2012-09-12 05:30 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-12 05:30:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Boris Ranto 2012-08-23 11:01:18 EDT
Description of problem:
The xfs_admin program can't turn on the support for projid32bit option on lvm device.

Version-Release number of selected component (if applicable):
kernel-3.3.0-0.20.el7.x86_64
xfsprogs-3.1.8-4.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Get an lvm device and create xfs fs on it with -i projid32bit=0
mkfs.xfs /dev/mapper/some_lvm_device -i projid32bit=0
2. Use xfs_admin to turn on the projid32bit option
xfs_admin -p /dev/mapper/some_lvm_device
3. Mount and try to set 32bit project quota id
mount /dev/mapper/some_lvm_device /mnt -opquota
cd /mnt; touch file
xfs_quota -x -c "project -s -p file 2123456789" /mnt
xfs_io -r -c lsproj file
  
Actual results:
The project quota id fails to assign with 'xfs_quota: cannot set project on file: Invalid argument'

Expected results:
Project quota id will be assigned appropriately. The xfs_io will properly report the projid.

Additional info:
This works properly for loop devices.

An example run:
[root@intel-waimeabay-hedt-01 ~]# mkfs.xfs -f /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch -i projid32bit=0
meta-data=/dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch isize=256    agcount=4, agsize=655360 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=2621440, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@intel-waimeabay-hedt-01 ~]# xfs_admin -p /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch 
writing all SBs
versionnum [0xb4a4+0x8a] = V4,NLINK,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT
[root@intel-waimeabay-hedt-01 ~]# mount /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch /mnt/ -opquota
[root@intel-waimeabay-hedt-01 ~]# cd /mnt/;touch file
[root@intel-waimeabay-hedt-01 mnt]# xfs_quota -x -c "project -s -p file 2123456789" /mnt
Setting up project 2123456789 (path file)...
xfs_quota: cannot set project on file: Invalid argument
Processed 1 (/etc/projects and cmdline) paths for project 2123456789 with recursion depth infinite (-1).
[root@intel-waimeabay-hedt-01 mnt]# xfs_io -r -c lsproj file
projid = 0
Comment 1 Eric Sandeen 2012-08-27 14:46:32 EDT
For some reason I haven't been able to get a rhel7 machine provisioned & reserved.  Do you have one I could log into and look at for a while?

Thanks,
-Eric
Comment 2 Boris Ranto 2012-08-27 15:34:03 EDT
Sure, I've sent you e-mail with the login information to the machine I used for the testing.

Boris
Comment 3 Eric Sandeen 2012-08-27 16:18:48 EDT
Well this is strange; xfs_admin does turn it on, as you can see from the results, or from a later check of the features:

# xfs_db -c version /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch 
versionnum [0xb4a4+0x8a] = V4,NLINK,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT

and it does get mounted w/ prjquota properly:

# grep xfscratch /proc/mounts 
/dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch /mnt xfs rw,seclabel,relatime,attr2,prjquota 0 0

but it is failing in here:

        /*
         * Disallow 32bit project ids when projid32bit feature is not enabled.
         */
        if ((mask & FSX_PROJID) && (fa->fsx_projid > (__uint16_t)-1) &&
                        !xfs_sb_version_hasprojid32bit(&ip->i_mount->m_sb)) {
                return XFS_ERROR(EINVAL);
        }

due to xfs_sb_version_hasprojid32bit failing.

It's somehow getting lost or cleared.  If I do a bunch of syncs & drop caches before the mount, then it works.

xfs_admin is simply doing buffered IO to the lvm device to write the superblocks, and no sync that I can see.  Still, this is odd.
Comment 4 Eric Sandeen 2012-08-27 16:54:18 EDT
Somehow buffered IO to the LVM device seems to be getting lost:

# xfs_db -r -c version  /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch 
versionnum [0xb4a4+0x8a] = V4,NLINK,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT

# echo 3 > /proc/sys/vm/drop_caches 

# xfs_db -r -c version  /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch 
versionnum [0xb4e4+0xa] = V4,NLINK,QUOTA,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT
Comment 5 Eric Sandeen 2012-08-27 17:24:30 EDT
I couldn't reproduce this on RHEL6, FWIW.
Comment 6 Dave Chinner 2012-08-29 00:17:13 EDT
(In reply to comment #4)
> Somehow buffered IO to the LVM device seems to be getting lost:
> 
> # xfs_db -r -c version  /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch 
> versionnum [0xb4a4+0x8a] =
> V4,NLINK,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT
> 
> # echo 3 > /proc/sys/vm/drop_caches 
> 
> # xfs_db -r -c version  /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch 
> versionnum [0xb4e4+0xa] =
> V4,NLINK,QUOTA,ALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT

Strange. I'm unable to reproduce this on a 3.5 kernel on my local test host on DM volumes. How are you setting the projid bit?

$ sudo xfs_db -r -c version /dev/mapper/fast
versionnum [0xb5e4+0xa] = V4,NLINK,QUOTA,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT
dave@deranged:~$ sudo xfs_admin -p /dev/mapper/fast
writing all SBs
versionnum [0xb5e4+0x8a] = V4,NLINK,QUOTA,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT
dave@deranged:~$ sudo xfs_db -r -c version /dev/mapper/fast
versionnum [0xb5e4+0x8a] = V4,NLINK,QUOTA,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT
dave@deranged:~$ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
dave@deranged:~$ sudo xfs_db -r -c version /dev/mapper/fast
versionnum [0xb5e4+0x8a] = V4,NLINK,QUOTA,ALIGN,DALIGN,DIRV2,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT
dave@deranged:~$ sudo mount -o inode64,nobarrier,logbsize=262144,pquota /dev/mapper/fast /mnt/fast
dave@deranged:~$ dmesg |tail -2
[448392.052558] XFS (dm-8): Mounting Filesystem
[448392.104471] XFS (dm-8): Ending clean mount

And when I use the xfs_db "write" command to just change the features2 field and then immediately mount, I get the:

XFS (dm-8): correcting sb_features alignment problem

message in dmesg indicating it saw the change immediately. i.e. I cannot reproduce this on a DM volume on a 3.5 kernel. Hence I'd suggest trying to reproduce this on the above machine on a 3.5 kernel and seeing if the problem is reproducable...
Comment 7 Dave Chinner 2012-08-29 00:19:42 EDT
FWIW, this:

> [root@intel-waimeabay-hedt-01 ~]# mount
> /dev/mapper/vg_intel--waimeabay--hedt--01-xfscratch /mnt/ -opquota
> [root@intel-waimeabay-hedt-01 ~]# cd /mnt/;touch file
> [root@intel-waimeabay-hedt-01 mnt]# xfs_quota -x -c "project -s -p file
> 2123456789" /mnt
> Setting up project 2123456789 (path file)...
> xfs_quota: cannot set project on file: Invalid argument
> Processed 1 (/etc/projects and cmdline) paths for project 2123456789 with
> recursion depth infinite (-1).
> [root@intel-waimeabay-hedt-01 mnt]# xfs_io -r -c lsproj file
> projid = 0

also looks like user error by trying to set a directory quota on a path that is not defined in /etc/projects. i.e. the "-p file" parameter to the command is invalid. Do:

# echo 2123456789:/mnt >> /etc/projects
# xfs_quota -x -c "project -s -p /mnt 2123456789" /mnt

and the project id on /mnt/file will be set appropriately as the -s command applies the project ID recursively to all files below /mnt. Please confirm that this works - it does on my systems running xfsprogs 3.1.7 and a 3.5 kernel on an LVM volume.
Comment 8 Boris Ranto 2012-09-12 05:30:51 EDT
This is fixed in the latest kernel brew build.

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