All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: xfs-oss <xfs@oss.sgi.com>
Cc: nscott@redhat.com, Dave Chinner <dchinner@redhat.com>
Subject: [PATCH] xfs_quota: XFS_XFLAG_PROJINHERIT is only for dirs
Date: Fri, 12 Oct 2012 11:19:55 -0500	[thread overview]
Message-ID: <5078432B.6050501@redhat.com> (raw)

xfs_quota has long set XFS_XFLAG_PROJINHERIT on all files,
and tested for presence on all files.  However, Dave's semi-recent
xfs_repair update is now flagging this as an error:

bd5683f xfs_repair: validate inode di_flags field

       if (flags & (XFS_DIFLAG_RTINHERIT |
                    XFS_DIFLAG_EXTSZINHERIT |
                    XFS_DIFLAG_PROJINHERIT |
                    XFS_DIFLAG_NOSYMLINKS)) {
               /* must be a directory */
               if (di_mode && !S_ISDIR(di_mode)) {
                       do_warn(_(
               "directory flags set on non-directory inode %llu"),
                               lino);

In tests 050, 107, 134, 244, 261 and 287, inserting a _check_scratch_fs
will cause them to fail due to repair finding these errors.

On the one hand, quota has set this flag everywhere for many years.  On
the other hand, an *INHERIT flag makes no sense on a non-dir.  So I think
the right way to go is to tell quota to stop setting (and checking for)
the flag unconditionally, and do it only for S_ISDIR.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

note: A little unsure of the new check in check_project.  Should we just
leave that to repair?

diff --git a/quota/project.c b/quota/project.c
index a2c7046..7042015 100644
--- a/quota/project.c
+++ b/quota/project.c
@@ -126,8 +126,11 @@ check_project(
 			printf(_("%s - project identifier is not set"
 				 " (inode=%u, tree=%u)\n"),
 				path, fsx.fsx_projid, (unsigned int)prid);
-		if (!(fsx.fsx_xflags & XFS_XFLAG_PROJINHERIT))
-			printf(_("%s - project inheritance flag is not set\n"),
+		if (S_ISDIR(stat->st_mode) && !(fsx.fsx_xflags & XFS_XFLAG_PROJINHERIT))
+			printf(_("%s - project inheritance flag is not set on dir\n"),
+				path);
+		if (!S_ISDIR(stat->st_mode) && (fsx.fsx_xflags & XFS_XFLAG_PROJINHERIT))
+			printf(_("%s - project inheritance flag is set on non-dir\n"),
 				path);
 	}
 	if (fd != -1)
@@ -219,7 +222,8 @@ setup_project(
 	}
 
 	fsx.fsx_projid = prid;
-	fsx.fsx_xflags |= XFS_XFLAG_PROJINHERIT;
+	if (S_ISDIR(stat->st_mode))
+		fsx.fsx_xflags |= XFS_XFLAG_PROJINHERIT;
 	if (xfsctl(path, fd, XFS_IOC_FSSETXATTR, &fsx) < 0) {
 		exitcode = 1;
 		fprintf(stderr, _("%s: cannot set project on %s: %s\n"),

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

             reply	other threads:[~2012-10-12 16:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-12 16:19 Eric Sandeen [this message]
2012-10-13 15:52 ` [PATCH] xfs_quota: XFS_XFLAG_PROJINHERIT is only for dirs Christoph Hellwig
2012-10-13 21:22   ` Eric Sandeen
2012-10-13 23:34   ` Dave Chinner
2012-10-14  0:05     ` Eric Sandeen
2012-10-14  0:14       ` Dave Chinner
2012-10-16 20:17         ` Ben Myers
2012-10-16 20:34           ` Dave Chinner
2012-10-17 15:54           ` Eric Sandeen
2012-10-23 12:34         ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5078432B.6050501@redhat.com \
    --to=sandeen@redhat.com \
    --cc=dchinner@redhat.com \
    --cc=nscott@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.