Bug 1663502
| Summary: | xfs_quota project check results in "project inheritance flag is not set" error | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | sgardner | |
| Component: | xfsprogs | Assignee: | Eric Sandeen <esandeen> | |
| Status: | CLOSED ERRATA | QA Contact: | Zorro Lang <zlang> | |
| Severity: | low | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 7.7 | CC: | agaikwad, rhandlin, xzhou, zlang | |
| Target Milestone: | rc | Keywords: | Regression | |
| Target Release: | --- | |||
| Hardware: | All | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1664105 (view as bug list) | Environment: | ||
| Last Closed: | 2019-08-06 13:06:18 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1664105 | |||
This behavior was probably changed in the kernel by:
commit 9336e3a765b68d4a7fdd8256f393ebce95ecb0a7
Author: Dave Chinner <dchinner>
Date: Thu Oct 2 09:18:40 2014 +1000
xfs: project id inheritance is a directory only flag
xfs_set_diflags() allows it to be set on non-directory inodes, and
this flags errors in xfs_repair. Further, inode allocation allows
the same directory-only flag to be inherited to non-directories.
Make sure directory inode flags don't appear on other types of
inodes.
This fixes several xfstests scratch fileystem corruption reports
(e.g. xfs/050) now that xfstests checks scratch filesystems after
test completion.
Signed-off-by: Dave Chinner <dchinner>
Reviewed-by: Brian Foster <bfoster>
Signed-off-by: Dave Chinner <david>
which is present in v3.18 upstream, and was added to kernel-3.10.0-194.el7 in RHEL7.
Can you confirm which kernel you tested that did not lead to the problem?
I agree that this is inconsistent and that the check should not (no longer) be made in userspace for regular files.
>
> Can you confirm which kernel you tested that did not lead to the problem?
>
- Files created in RHEL7.0-z (3.10.0-123.20.1) and below, do NOT result in this behavior.
- Files created in RHEL7.1-ga (3.10.0-229)and higher, DO result in this behavior.
That definitely looks like the commit that caused the change.
Ok, I think we should mark this as a regression then, even though it wasn't exactly xfsprogs that regressed, the overall behavior did. Ack as it's a regression issue. proposed a patch here, sent to upstream https://marc.info/?l=linux-xfs&m=154668397419031&w=2 TL;DR: Just added a check to see if the file is REG or DIR. Snip : --- quota/project.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quota/project.c b/quota/project.c index e4e7a012..8c9be08b 100644 --- a/quota/project.c +++ b/quota/project.c @@ -99,6 +99,7 @@ check_project( { struct fsxattr fsx; int fd; + int isdir; if (recurse_depth >= 0 && data->level > recurse_depth) return -1; @@ -126,7 +127,8 @@ 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 & FS_XFLAG_PROJINHERIT)) + isdir = S_ISDIR(stat->st_mode); + if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT) && isdir) printf(_("%s - project inheritance flag is not set\n"), path); } -- 2.20.1 Upstream:
commit b136f48b19a5b8e788aceb4b80e97d6ae9edd0ea
Author: Achilles Gaikwad <agaikwad>
Date: Mon Jan 28 13:03:08 2019 -0600
xfs_quota: fix false error reporting of project inheritance flag is not set
After kernel commit:
9336e3a7 "xfs: project id inheritance is a directory only flag"
xfs stopped setting the project inheritance flag on regular files, but
userspace quota code still checks for it and will now issue the error:
"project inheritance flag is not set"
for every regular file during quotacheck. Fix this by only checking
for the flag on directories.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1663502
Reported-by: Steven Gardner <sgardner>
Signed-off-by: Achilles Gaikwad <agaikwad>
Reviewed-by: Darrick J. Wong <darrick.wong>
Signed-off-by: Eric Sandeen <sandeen>
built in xfsprogs-4.5.0-20.el7 Reproduced this bug on xfsprogs-4.5.0-19.el7:
# ./check xfs/507
FSTYP -- xfs (non-debug)
PLATFORM -- Linux/x86_64 ibm-x3550m3-05 3.10.0-1053.el7.x86_64
MKFS_OPTIONS -- -f -bsize=4096 /dev/sdb2
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sdb2 /mnt/scratch
xfs/507 2s ... - output mismatch (see /root/git/xfstests-zlang/results//xfs/507.out.bad)
--- tests/xfs/507.out 2019-06-19 05:38:42.821559996 -0400
+++ /root/git/xfstests-zlang/results//xfs/507.out.bad 2019-06-19 06:16:30.416770093 -0400
@@ -1,6 +1,8 @@
QA output created by 507
== The parent directory has Project inheritance bit by default ==
Checking project test (path [SCR_MNT]/dir)...
+[SCR_MNT]/dir/foo - project inheritance flag is not set
+[SCR_MNT]/dir/dir_inherit/foo - project inheritance flag is not set
Processed 1 ([PROJECTS_FILE] and cmdline) paths for project test with recursion depth infinite (-1).
...
(Run 'diff -u /root/git/xfstests-zlang/tests/xfs/507.out /root/git/xfstests-zlang/results//xfs/507.out.bad' to see the entire diff)
Ran: xfs/507
Failures: xfs/507
Failed 1 of 1 tests
Test passed on xfsprogs-4.5.0-20.el7
# ./check xfs/507
FSTYP -- xfs (non-debug)
PLATFORM -- Linux/x86_64 ibm-x3550m3-05 3.10.0-1053.el7.x86_64
MKFS_OPTIONS -- -f -bsize=4096 /dev/sdb2
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sdb2 /mnt/scratch
xfs/507 2s ... 2s
Ran: xfs/507
Passed all 1 tests
Note: the test case is still reviewing on upstream fstests@, it hasn't been merged.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2019:2216 |
Description of problem: When running xfs_quota project check command (xfs_quota -xc 'project -c <projid>' <projectDIR>. All files within quota directory will result in "project inheritance flag is not set" error in the output. Version-Release number of selected component (if applicable): Does not exist in RHEL7.0-z (3.10.0-123.20.1) First noticed in RHEL7.1-ga (3.10.0-229) How reproducible: EASILY Steps to Reproduce: 1. Make xfs filesystem. # mkfs.xfs /dev/vdb 2. Mount # mount -o pquota /dev/vdb /mnt 3. Verify project quota is enabled on mount # mount | grep vdb /dev/vdb on /mnt/test2 type xfs (rw,relatime,seclabel,attr2,inode64,prjquota) 4. Create/Edit /etc/projects to contain the project map. # cat /etc/projects 1:/mnt/p1 5. Create/Edit /etc/projid to contain the Project ID. # cat /etc/projid p1:1 6. Make the project directory # mkdir /mnt/p1 7. Setup the project quota # xfs_quota -xc 'project -s p1' /mnt Setting up project p1 (path /mnt/p1)... Processed 1 (/etc/projects and cmdline) paths for project p1 with recursion depth infinite (-1). 8. Set limits on the project. # xfs_quota -xc 'limit -p bsoft=1m bhard=2m p1' /mnt 9. Touch a random file in the project quota dir. # touch /mnt/p1/testfile 10. Check the project # xfs_quota -xc 'project -c p1' /mnt Checking project p1 (path /mnt/p1)... /mnt/p1/testfile - project inheritance flag is not set Processed 1 (/etc/projects and cmdline) paths for project p1 with recursion depth infinite (-1). 11. Verify that the quota is working.. Quota is working OK. # dd if=/dev/urandom of=/mnt/p1/testdd bs=1M dd: error writing ‘/mnt/test2/p2_multi1/testdd’: No space left on device 3+0 records in 2+0 records out 2097152 bytes (2.1 MB) copied, 0.0311358 s, 67.4 MB/s NOTE- New directories do not result in this error. ALL new files will result in this error. Actual results: /mnt/p1/testfile - project inheritance flag is not set Expected results: No "project inheritance flag is not set" error for any files. Additional info: I discovered that the change in behavior is in the kernel when new files are created within a quota directory. (haven't found the commit that changed the behavior) It does not matter which kernel you are booted into when running the quota setup or check. It only matters which kernel you are booted into when creating a new file. This means that the change is related to files inheriting the "FS_XFLAG_PROJINHERIT" xflag. *** But I believe that the files should never inherit this xflag. This should ONLY be inherited by directories. Define "FS_XFLAG_PROJINHERIT" - child created in this directory has parents project ID by default. Because of this, I don't think the change in the kernel behavior is actually the issue, this just exposed the actual bug which is in the xfs_quota check command itself. It's checking both files and directories for xflag "FS_XFLAG_PROJINHERIT" Here is the code section that creates this error. (project.c in the xfsprogs) ------------------------------------------------------------------------------------------------------------------ 94 check_project( 95 const char *path, 96 const struct stat *stat, 97 int flag, 98 struct FTW *data) 99 { 100 struct fsxattr fsx; 101 int fd; <snip> 125 if (fsx.fsx_projid != prid) 126 printf(_("%s - project identifier is not set" 127 " (inode=%u, tree=%u)\n"), 128 path, fsx.fsx_projid, (unsigned int)prid); 129 if (!(fsx.fsx_xflags & FS_XFLAG_PROJINHERIT)) 130 printf(_("%s - project inheritance flag is not set\n"), 131 path); ------------------------------------------------------------------------------------------------------------------ There is no logic in the code to ignore files in the 'FS_XFLAG_PROJINHERIT" section.