xfs
[Top] [All Lists]

Re: [PATCH 3/3] xfs: null unused quota inodes when quota is on

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH 3/3] xfs: null unused quota inodes when quota is on
From: Arkadiusz MiÅkiewicz <arekm@xxxxxxxx>
Date: Fri, 11 Jul 2014 17:30:10 +0200
Cc: Dave Chinner <david@xxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maven.pl; s=maven; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=qWQ9JKUSPe0TBorpeFsDSZ/y+AUQH20nbIGWGiRRmXk=; b=cstjF8N19AbDTSLlLAiynoqqVfXCRM/hsB6khI688ANPkS+OgMxOgg4yFf30yozO4x ebq8t7j2jxo5ZqQGGmC976lqVWchxr4c8t0grlJ0Xhxo5twvmwFyee/tP+fECMkbufJc 3Gwf1w8o1XbZjHYvyOUSKjK3rgMGlc9A9Byv0=
In-reply-to: <201407111722.48507.arekm@xxxxxxxx>
References: <1405034779-2028-1-git-send-email-david@xxxxxxxxxxxxx> <1405034779-2028-4-git-send-email-david@xxxxxxxxxxxxx> <201407111722.48507.arekm@xxxxxxxx>
User-agent: KMail/1.13.7 (Linux/3.16.0-rc4-00120-g85d90fa-dirty; KDE/4.13.2; x86_64; ; )
On Friday 11 of July 2014, Arkadiusz MiÅkiewicz wrote:
> On Friday 11 of July 2014, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > 
> > When quota is on, it is expected that unused quota inodes have a
> > value of NULLFSINO. The changes to support a separate project quota
> > in 3.12 broken this rule for non-project quota inode enabled
> > filesystem, as the code now refuses to write the group quota inode
> > if neither group or project quotas are enabled. This regression was
> > introduced by commit d892d58 ("xfs: Start using pquotaino from the
> > superblock").
> > 
> > In this case, we should be writing NULLFSINO rather than nothing to
> > ensure that we leave the group quota inode in a valid state while
> > quotas are enabled.
> > 
> > Failure to do so doesn't cause a current kernel to break - the
> > separate project quota inodes introduced translation code to always
> > treat a zero inode as NULLFSINO. This was introduced by commit
> > 0102629 ("xfs: Initialize all quota inodes to be NULLFSINO") with is
> > also in 3.12 but older kernels do not do this and hence taking a
> > filesystem back to an older kernel can result in quotas failing
> > initialisation at mount time. When that happens, we see this in
> > dmesg:
> > 
> > [ 1649.215390] XFS (sdb): Mounting Filesystem
> > [ 1649.316894] XFS (sdb): Failed to initialize disk quotas.
> > [ 1649.316902] XFS (sdb): Ending clean mount
> > 
> > By ensuring that we write NULLFSINO to quota inodes that aren't
> > active, we avoid this problem.
> > 
> > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> > ---
> > 
> >  fs/xfs/xfs_sb.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_sb.c b/fs/xfs/xfs_sb.c
> > index c3453b1..9a58699 100644
> > --- a/fs/xfs/xfs_sb.c
> > +++ b/fs/xfs/xfs_sb.c
> > @@ -483,10 +483,16 @@ xfs_sb_quota_to_disk(
> > 
> >     }
> >     
> >     /*
> > 
> > -    * GQUOTINO and PQUOTINO cannot be used together in versions
> > -    * of superblock that do not have pquotino. from->sb_flags
> > -    * tells us which quota is active and should be copied to
> > -    * disk.
> > +    * GQUOTINO and PQUOTINO cannot be used together in versions of
> > +    * superblock that do not have pquotino. from->sb_flags tells us which
> > +    * quota is active and should be copied to disk. If neither are 
active,
> > +    * make sure we write NULLFSINO to the sb_gquotino field as a quota
> > +    * inode value of "0" is invalid when the XFS_SB_VERSION_QUOTA feature
> > +    * bit is set.
> > +    *
> > +    * Note that we don't need to handle the sb_uquotino or sb_pquotino
> > here +       * as they do not require any translation. Hence the main sb
> > field loop +         * will write them appropriately from the in-core
> > superblock.
> > 
> >      */
> >     
> >     if ((*fields & XFS_SB_GQUOTINO) &&
> >     
> >                             (from->sb_qflags & XFS_GQUOTA_ACCT))
> > 
> > @@ -494,6 +500,8 @@ xfs_sb_quota_to_disk(
> > 
> >     else if ((*fields & XFS_SB_PQUOTINO) &&
> >     
> >                             (from->sb_qflags & XFS_PQUOTA_ACCT))
> >             
> >             to->sb_gquotino = cpu_to_be64(from->sb_pquotino);
> > 
> > +   else
> > +           to->sb_gquotino = cpu_to_be64(NULLFSINO);
> > 
> >     *fields &= ~(XFS_SB_PQUOTINO | XFS_SB_GQUOTINO);
> >  
> >  }
> 
> Tested-by: Arkadiusz MiÅkiewicz <arekm@xxxxxxxx>
> 
> 3.16.0-rc4-00120-g85d90fa + patch
> 
> $ truncate -s 50M 50M-image
> $ mkfs.xfs -f 50M-image
> meta-data=50M-image              isize=256    agcount=2, agsize=6400 blks
>          =                       sectsz=512   attr=2, projid32bit=1
>          =                       crc=0        finobt=0
> data     =                       bsize=4096   blocks=12800, imaxpct=25
>          =                       sunit=0      swidth=0 blks
> naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
> log      =internal log           bsize=4096   blocks=853, version=2
>          =                       sectsz=512   sunit=0 blks, lazy-count=1
> realtime =none                   extsz=4096   blocks=0, rtextents=0
> $ xfs_db 50M-image  -c "sb 0" -c "print" |grep quot
> uquotino = 0
> gquotino = 0
> pquotino = 0
> $ sudo mount 50M-image /media/floppy/ -o usrquota
> [sudo] password for arekm:
> $ dmesg|tail -n 4
> [   98.413877] XFS (loop0): Mounting V4 Filesystem
> [   98.445950] XFS (loop0): Ending clean mount
> [   98.445987] XFS (loop0): Quotacheck needed: Please wait.
> [   98.469666] XFS (loop0): Quotacheck: Done.
> $ sudo umount /media/floppy/
> ]$ xfs_db 50M-image  -c "sb 0" -c "print" |grep quot
> uquotino = 131
> gquotino = null
> pquotino = 0
> 
> and it properly mounted on 3.10.46 with usrquota,grpquota

Actually there is a problem with different options, so likely more fixes is 
needed. gquotinode doesn't get allocated if mounted with grpquota:

3.16git+patch:
[arekm@t400 test]$ rm 50M-image 
[arekm@t400 test]$ truncate -s 50M 50M-image
[arekm@t400 test]$ mkfs.xfs -f 50M-image 
meta-data=50M-image              isize=256    agcount=2, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=12800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$ xfs_db 50M-image  -c "sb 0" -c "print" |grep quot
uquotino = 0
gquotino = 0
pquotino = 0
$ sudo mount 50M-image /media/floppy/ -o grpquota
$ sudo umount /media/floppy/
$ xfs_db 50M-image  -c "sb 0" -c "print" |grep quot
uquotino = null
gquotino = null
pquotino = 0


but on 3.10.46 gquotino is allocated:

$ rm 50M-image 
$ truncate -s 50M 50M-image
$ mkfs.xfs 50M-image 
meta-data=50M-image              isize=256    agcount=2, agsize=6400 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=12800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
$ xfs_db 50M-image  -c "sb 0" -c "print" |grep quot
uquotino = 0
gquotino = 0
pquotino = 0
$ sudo mount 50M-image /media/floppy/ -o grpquota
$ sudo umount /media/floppy/
$ xfs_db 50M-image  -c "sb 0" -c "print" |grep quot
uquotino = null
gquotino = 131
pquotino = 0


-- 
Arkadiusz MiÅkiewicz, arekm / maven.pl

<Prev in Thread] Current Thread [Next in Thread>