All of lore.kernel.org
 help / color / mirror / Atom feed
* Subject: [PATCH v2] xfs: Initialize all quota inodes to be NULLFSINO
@ 2013-07-19 22:32 Chandra Seetharaman
  2013-07-22 19:08 ` Ben Myers
  0 siblings, 1 reply; 2+ messages in thread
From: Chandra Seetharaman @ 2013-07-19 22:32 UTC (permalink / raw)
  To: XFS mailing list

Change from previous version:
 - Added the additional comments that Dave wanted.

-------------
mkfs doesn't initialize the quota inodes to NULLFSINO as it does for the
other internal inodes. This leads to two in-core values (0 and NULLFSINO)
to be checked against, to make sure if a quota inode is valid.

Solve that problem by initializing the in-core values of all quotaino
values to NULLFSINO if they are 0 in the disk.

Note that these values are not written back to on-disk superblock unless
some quota is enabled on the filesystem. Even in that case sb_pquotino is
written to disk only if the on-disk superblock supports pquotino

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
 fs/xfs/xfs_mount.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 2b0ba35..7263e1b 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -572,6 +572,24 @@ out_unwind:
 static void
 xfs_sb_quota_from_disk(struct xfs_sb *sbp)
 {
+	/*
+	 * 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.
+	 */
+	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] 2+ messages in thread

* Re: Subject: [PATCH v2] xfs: Initialize all quota inodes to be NULLFSINO
  2013-07-19 22:32 Subject: [PATCH v2] xfs: Initialize all quota inodes to be NULLFSINO Chandra Seetharaman
@ 2013-07-22 19:08 ` Ben Myers
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Myers @ 2013-07-22 19:08 UTC (permalink / raw)
  To: Chandra Seetharaman; +Cc: XFS mailing list

On Fri, Jul 19, 2013 at 05:32:55PM -0500, Chandra Seetharaman wrote:
> Change from previous version:
>  - Added the additional comments that Dave wanted.
> 
> -------------
> mkfs doesn't initialize the quota inodes to NULLFSINO as it does for the
> other internal inodes. This leads to two in-core values (0 and NULLFSINO)
> to be checked against, to make sure if a quota inode is valid.
> 
> Solve that problem by initializing the in-core values of all quotaino
> values to NULLFSINO if they are 0 in the disk.
> 
> Note that these values are not written back to on-disk superblock unless
> some quota is enabled on the filesystem. Even in that case sb_pquotino is
> written to disk only if the on-disk superblock supports pquotino
> 
> Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>

Reviewed-by: Ben Myers <bpm@sgi.com>

Applied.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-22 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-19 22:32 Subject: [PATCH v2] xfs: Initialize all quota inodes to be NULLFSINO Chandra Seetharaman
2013-07-22 19:08 ` Ben Myers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.