xfs
[Top] [All Lists]

Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO

To: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
Subject: Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO
From: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Date: Fri, 12 Jul 2013 09:50:11 -0500
Cc: XFS mailing list <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130712142751.GA11446@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Organization: IBM
References: <1373593665.20769.10.camel@xxxxxxxxxxxxxxxxxx> <20130712142751.GA11446@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: sekharan@xxxxxxxxxx
On Fri, 2013-07-12 at 11:27 -0300, Carlos Maiolino wrote:
> On Thu, Jul 11, 2013 at 08:47:45PM -0500, Chandra Seetharaman wrote:
> > 
> > mkfs doesn't initialize the quota inodes to NULLFSINO as it
> > does for the other internal inodes. This leads to check for two
> > values (0 and NULLFSINO) to make sure if a quota inode is
> > valid.
> > 
> > Solve that problem by initializing the values to NULLFSINO
> > if they are 0.
> > 
> > Note that these values are not written back to on-disk
> > superblock unless some quota is enabled on the filesystem.
> > 
> > Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
> > ---
> >  fs/xfs/xfs_mount.c |   12 ++++++++++++
> >  1 files changed, 12 insertions(+), 0 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> > index 2b0ba35..8b95933 100644
> > --- a/fs/xfs/xfs_mount.c
> > +++ b/fs/xfs/xfs_mount.c
> > @@ -572,6 +572,18 @@ out_unwind:
> >  static void
> >  xfs_sb_quota_from_disk(struct xfs_sb *sbp)
> >  {
> > +   /*
> > +    * older mkfs doesn't initialize quota inodes to NULLFSINO,
> > +    * which leads to two values for a quota inode to be invalid:
> > +    * 0 and NULLFSINO. Fix it.
> > +    */
> > +   if (sbp->sb_uquotino == 0)
> > +           sbp->sb_uquotino = NULLFSINO;
> > +   if (sbp->sb_gquotino == 0)
> > +           sbp->sb_gquotino = NULLFSINO;
> > +   if (sbp->sb_pquotino == 0)
> > +           sbp->sb_pquotino = NULLFSINO;
> > +
> >     if (sbp->sb_qflags & XFS_OQUOTA_ENFD)
> >             sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ?
> >                                     XFS_PQUOTA_ENFD : XFS_GQUOTA_ENFD;
> > -- 
> > 1.7.1
> > 
> Hi,
> 
> in this case, wouldn't be better to make mkfs initialize the quota inodes with
> NULLFSINO instead of need to convert it into kernel?

Hi Carlos,

Yes. I will send a patch for mkfs also (to initialize it to NULLFSINO).

We still need the kernel fix for the already existing filessytems.

Chadnra
> 


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