* [PATCH] xfs: Initialize all quota inodes to be NULLFSINO @ 2013-07-12 1:47 Chandra Seetharaman 2013-07-12 14:27 ` Carlos Maiolino 2013-07-13 2:13 ` Dave Chinner 0 siblings, 2 replies; 8+ messages in thread From: Chandra Seetharaman @ 2013-07-12 1:47 UTC (permalink / raw) To: XFS mailing list 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@us.ibm.com> --- 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 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO 2013-07-12 1:47 [PATCH] xfs: Initialize all quota inodes to be NULLFSINO Chandra Seetharaman @ 2013-07-12 14:27 ` Carlos Maiolino 2013-07-12 14:50 ` Chandra Seetharaman 2013-07-13 2:13 ` Dave Chinner 1 sibling, 1 reply; 8+ messages in thread From: Carlos Maiolino @ 2013-07-12 14:27 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: XFS mailing list 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@us.ibm.com> > --- > 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? -- Carlos _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO 2013-07-12 14:27 ` Carlos Maiolino @ 2013-07-12 14:50 ` Chandra Seetharaman 0 siblings, 0 replies; 8+ messages in thread From: Chandra Seetharaman @ 2013-07-12 14:50 UTC (permalink / raw) To: Carlos Maiolino; +Cc: XFS mailing list 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@us.ibm.com> > > --- > > 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 > _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO 2013-07-12 1:47 [PATCH] xfs: Initialize all quota inodes to be NULLFSINO Chandra Seetharaman 2013-07-12 14:27 ` Carlos Maiolino @ 2013-07-13 2:13 ` Dave Chinner 2013-07-15 22:54 ` Chandra Seetharaman 1 sibling, 1 reply; 8+ messages in thread From: Dave Chinner @ 2013-07-13 2:13 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: XFS mailing list 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@us.ibm.com> > --- > 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; There coment needs to point out that this is changing the in-memory superblock value right here, so we don't need to make changing sb_pquotino dependent on the superblock having support for this feature. Cheers, Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO 2013-07-13 2:13 ` Dave Chinner @ 2013-07-15 22:54 ` Chandra Seetharaman 2013-07-16 0:23 ` Dave Chinner 0 siblings, 1 reply; 8+ messages in thread From: Chandra Seetharaman @ 2013-07-15 22:54 UTC (permalink / raw) To: Dave Chinner; +Cc: XFS mailing list On Sat, 2013-07-13 at 12:13 +1000, Dave Chinner 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@us.ibm.com> > > --- > > 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; > > There coment needs to point out that this is changing the in-memory > superblock value right here, so we don't need to make changing > sb_pquotino dependent on the superblock having support for this > feature. But, we are not just changing just for sb_pquotino, right ? Since we are changing all the fields independent of superblock supporting sb_pquotino, I thought the comment should be generic. > > Cheers, > > Dave. _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO 2013-07-15 22:54 ` Chandra Seetharaman @ 2013-07-16 0:23 ` Dave Chinner 2013-07-17 21:42 ` Chandra Seetharaman 0 siblings, 1 reply; 8+ messages in thread From: Dave Chinner @ 2013-07-16 0:23 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: XFS mailing list On Mon, Jul 15, 2013 at 05:54:45PM -0500, Chandra Seetharaman wrote: > On Sat, 2013-07-13 at 12:13 +1000, Dave Chinner 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@us.ibm.com> > > > --- > > > 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; > > > > There coment needs to point out that this is changing the in-memory > > superblock value right here, so we don't need to make changing > > sb_pquotino dependent on the superblock having support for this > > feature. > > But, we are not just changing just for sb_pquotino, right ? Sure, but those other two fields are always present in the superblock... > Since we are changing all the fields independent of superblock > supporting sb_pquotino, I thought the comment should be generic. So why is it safe to modify this when sb_pquotino isn't valid in the superblock (i.e. v4 superblock) and the only valid on-disk value for an unused section of the superblock is zero? That's what the comment needs to explain. Cheers, Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO 2013-07-16 0:23 ` Dave Chinner @ 2013-07-17 21:42 ` Chandra Seetharaman 2013-07-18 3:43 ` Dave Chinner 0 siblings, 1 reply; 8+ messages in thread From: Chandra Seetharaman @ 2013-07-17 21:42 UTC (permalink / raw) To: Dave Chinner; +Cc: XFS mailing list On Tue, 2013-07-16 at 10:23 +1000, Dave Chinner wrote: > On Mon, Jul 15, 2013 at 05:54:45PM -0500, Chandra Seetharaman wrote: > > On Sat, 2013-07-13 at 12:13 +1000, Dave Chinner 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@us.ibm.com> > > > > --- > > > > 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; > > > > > > There coment needs to point out that this is changing the in-memory > > > superblock value right here, so we don't need to make changing > > > sb_pquotino dependent on the superblock having support for this > > > feature. > > > > But, we are not just changing just for sb_pquotino, right ? > > Sure, but those other two fields are always present in the > superblock... > > > Since we are changing all the fields independent of superblock > > supporting sb_pquotino, I thought the comment should be generic. > > So why is it safe to modify this when sb_pquotino isn't valid in the > superblock (i.e. v4 superblock) and the only valid on-disk value for > an unused section of the superblock is zero? > > That's what the comment needs to explain. How about this: /* * older mkfs doesn't initialize quota inodes to NULLFSINO * This leads to in-core values having two different values * for a quota inode to be invalid: 0 and NULLFSINO. * Change it to a single value NULLFSINO. * * Note that this change affect only the in-core values. * These values are not written back to disk unless any * quota information is written to the disk. Even in that * case, sb_pquotino field is not written to disk unless * the superblock supports pquotino. */ > Cheers, > > Dave. _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfs: Initialize all quota inodes to be NULLFSINO 2013-07-17 21:42 ` Chandra Seetharaman @ 2013-07-18 3:43 ` Dave Chinner 0 siblings, 0 replies; 8+ messages in thread From: Dave Chinner @ 2013-07-18 3:43 UTC (permalink / raw) To: Chandra Seetharaman; +Cc: XFS mailing list On Wed, Jul 17, 2013 at 04:42:10PM -0500, Chandra Seetharaman wrote: > On Tue, 2013-07-16 at 10:23 +1000, Dave Chinner wrote: > > On Mon, Jul 15, 2013 at 05:54:45PM -0500, Chandra Seetharaman wrote: > > > On Sat, 2013-07-13 at 12:13 +1000, Dave Chinner 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@us.ibm.com> > > > > > --- > > > > > 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; > > > > > > > > There coment needs to point out that this is changing the in-memory > > > > superblock value right here, so we don't need to make changing > > > > sb_pquotino dependent on the superblock having support for this > > > > feature. > > > > > > But, we are not just changing just for sb_pquotino, right ? > > > > Sure, but those other two fields are always present in the > > superblock... > > > > > Since we are changing all the fields independent of superblock > > > supporting sb_pquotino, I thought the comment should be generic. > > > > So why is it safe to modify this when sb_pquotino isn't valid in the > > superblock (i.e. v4 superblock) and the only valid on-disk value for > > an unused section of the superblock is zero? > > > > That's what the comment needs to explain. > > How about this: > > /* > * older mkfs doesn't initialize quota inodes to NULLFSINO > * This leads to in-core values having two different values > * for a quota inode to be invalid: 0 and NULLFSINO. > * Change it to a single value NULLFSINO. > * > * Note that this change affect only the in-core values. > * These values are not written back to disk unless any > * quota information is written to the disk. Even in that > * case, sb_pquotino field is not written to disk unless > * the superblock supports pquotino. > */ Nice explanation. Expand it out to 80 columns and it's golden :) Cheers, Dave. -- Dave Chinner david@fromorbit.com _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-07-18 3:43 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-12 1:47 [PATCH] xfs: Initialize all quota inodes to be NULLFSINO Chandra Seetharaman 2013-07-12 14:27 ` Carlos Maiolino 2013-07-12 14:50 ` Chandra Seetharaman 2013-07-13 2:13 ` Dave Chinner 2013-07-15 22:54 ` Chandra Seetharaman 2013-07-16 0:23 ` Dave Chinner 2013-07-17 21:42 ` Chandra Seetharaman 2013-07-18 3:43 ` Dave Chinner
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox