[LU-12383] lfs project inhert difference between ldiskfs and zfs Created: 04/Jun/19  Updated: 12/Jul/19  Resolved: 16/Jun/19

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.13.0
Fix Version/s: Lustre 2.13.0, Lustre 2.12.3

Type: Bug Priority: Critical
Reporter: Nathaniel Clark Assignee: Wang Shilong (Inactive)
Resolution: Fixed Votes: 0
Labels: quota

Issue Links:
Blocker
is blocking LU-12336 Update ZFS Version to 0.8.2 Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Regular files inherit the Project Inherit flag in ldiskfs, zfs they do not.

Given the following commands:

mkdir proj
lfs project -sp 1000 proj
touch proj/test
lfs project proj

ldiskfs output:

 1000 P proj/test 

ZFS 0.8.0 output:

 1000 - proj/test

 Both correctly set inherit on sub-directories.

 

This difference in behavior causes sanity-quota test_54 to fail for ZFS 0.8.0

https://testing.whamcloud.com/test_sets/afa8f438-81b8-11e9-869c-52540065bddc



 Comments   
Comment by Nathaniel Clark [ 05/Jun/19 ]

Is there a specification for behavior of the INHERIT bit on regular files?  It seems that it doesn't make sense for the inherit bit to be set on a regular file, just on sub-directories.

There would be three ways to fix this. 

  1. Alter ZFS (or osd-zfs) to set inherit bit on files created under directory with it set
  2. Change sanity-quota/test_54 to not care if bit is set on those files ("c1")
  3. Alter lfs project -c to not complain if inherit bit is "missing" from regular files

My initial impression is that, I'm not sure #1 is "correct".  #2 seems like a hack, so I think #3 is best option, since I don't feel like it makes sense for a regular file to have this bit set.

Comment by Andreas Dilger [ 05/Jun/19 ]

How does the inheritance of this flag work on native ext4 and XFS? To my thinking, it doesn't make sense to inherit this flag on regular files, only directories. That would imply the correct fix is a fourth option - not to inherit the flag in ldiskfs, and match the behavior of ZFS, but let's first see how other filesystems handle it.

Comment by Wang Shilong (Inactive) [ 06/Jun/19 ]

I just checked Upstream ext4 and xfs:

XFS only inherit inherit flag for Directory, but ext4 always inherit it for dirs/regular files.
To fix this problem, I'd prefer:

1) Alter lfs project -c to only complain if inherit bit is "missing" from Directory.
2) send a patch to upstream ext4 to keep consistent behavior with ext4 with xfs/zfs.

Notice, even we have inherit flag for regular files, it dose no harm as well.

Comment by Gerrit Updater [ 06/Jun/19 ]

Wang Shilong (wshilong@ddn.com) uploaded a new patch: https://review.whamcloud.com/35076
Subject: LU-12383 utils: only check project inherit bit for dir
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 745050395fdb431e24b4cc7c07f8cefa360bf6a4

Comment by Wang Shilong (Inactive) [ 06/Jun/19 ]

Following simple ext4 patch shall fix the problem:

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 1cb67859e051..ceb74093e138 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -421,7 +421,8 @@ struct flex_groups {
                           EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL)
 
 /* Flags that are appropriate for regular files (all but dir-specific ones). */
-#define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL | EXT4_CASEFOLD_FL))
+#define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL | EXT4_CASEFOLD_FL |\
+                          EXT4_PROJINHERIT_FL))
 
 /* Flags that are appropriate for non-directories/regular files. */
 #define EXT4_OTHER_FLMASK (EXT4_NODUMP_FL | EXT4_NOATIME_FL)
Comment by Wang Shilong (Inactive) [ 06/Jun/19 ]

FYI, I sent two Linux upstream patches to fix ext4 and f2fs:

http://patchwork.ozlabs.org/patch/1110877/
http://patchwork.ozlabs.org/patch/1110878/

Comment by Andreas Dilger [ 06/Jun/19 ]

Please also submit an ldiskfs patch for this, I have also reviewed the ext4 patch on the list.

Comment by Wang Shilong (Inactive) [ 11/Jun/19 ]

Andreas,

Since there won't be obvious errors with LU-12383 utils: only check project inherit bit for dir
Do you think we'd better include ldiskfs fix parts too?

Comment by Andreas Dilger [ 11/Jun/19 ]

I think it makes sense to include ldiskfs-side patches, so that we get fewer "corrupt" inodes on a filesystem, and hopefully they can mostly be aged out of the filesystem after the ldsiskfs patch has been around for some time.

We will also want a patch for e2fsck to detect and repair these errors on non-directory inodes without complaining too much.

Comment by Gerrit Updater [ 16/Jun/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35076/
Subject: LU-12383 utils: only check project inherit bit for dir
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: e4ad5c17c99e7ede5deabffe0bacdd851240eb86

Comment by Peter Jones [ 16/Jun/19 ]

Landed for 2.13

Comment by Li Xi [ 17/Jun/19 ]

Should we create another ticket to track the ldiskfs patch?

Comment by Peter Jones [ 17/Jun/19 ]

We can reopen this one if it seems likely to complete this work during the 2.13 cycle. If that is in doubt then, sure, let's have a new ticket linked to this one

Comment by Gerrit Updater [ 01/Jul/19 ]

Wang Shilong (wshilong@ddn.com) uploaded a new patch: https://review.whamcloud.com/35393
Subject: LU-12383 utils: only check project inherit bit for dir
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: b84e222d7075acc702a239ee4ece3c71e22576a0

Comment by Gerrit Updater [ 12/Jul/19 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35393/
Subject: LU-12383 utils: only check project inherit bit for dir
Project: fs/lustre-release
Branch: b2_12
Current Patch Set:
Commit: 1299c5d5f92a7086b48b721d35bfce9ded177b94

Generated at Sat Feb 10 02:52:06 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.