[LU-11739] Don't inherit default layout from root for new subdirectories Created: 07/Dec/18 Updated: 20/Oct/20 Resolved: 04/Oct/19 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.12.0, Lustre 2.10.6 |
| Fix Version/s: | Lustre 2.13.0, Lustre 2.10.7, Lustre 2.12.4 |
| Type: | Improvement | Priority: | Critical |
| Reporter: | Andreas Dilger | Assignee: | Jian Yu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||||||||||||||||||||||||||||||
| Description |
|
There is no need to inherit the default directory layout from the root directory when subdirectories are created therein. This consumes xattr space on the subdirectories, and makes it more complex to change the filesystem default layout in the future. Instead, it should be possible to check if the parent directory is the root directory and not copy the default layout xattr to the new subdirectory. |
| Comments |
| Comment by Jian Yu [ 31/Dec/18 ] |
|
The change needs to be made in lod_ah_init() in lustre/lod/lod_object.c. I'm creating the patch. |
| Comment by Gerrit Updater [ 03/Jan/19 ] |
|
Jian Yu (yujian@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/33956 |
| Comment by Andreas Dilger [ 08/Jan/19 ] |
|
In all cases, new subdirectories under root should not explicitly inherit the file layout from the root (we cannot specify the default file layout at the same time the directory is created, so your 1b) case above cannot happen, unless the default file layout is explicitly specified after the directory is created). This avoids the case where the filesystem-wide default layout is set on the root directory of a new filesystem, and then every subdirectory created in the filesystem explicitly inherits this filesystem-wide layout. Then, if the filesystem-wide "default" layout changes, none of the new files created use this new default because every parent directory already has an old explicitly inherited layout that is being used instead. We need the explicit inheritance behaviour for subdirectories because we can't walk the whole directory tree on every file create to find if some parent-of-parent has a default file layout that we should be inheriting. However, we should consider whether an explicit layout should be inherited from a parent directory that is exactly the same as the filesystem default layout? On the plus side, always inheriting the parent layout avoids some overhead to compare an explicit parent directory layout against the filesystem-wide default layout. On the minus side, this continues the issue that currently exists with explicitly-inherited default layouts. If we don't explicitly inherit a layout from the parent that matches the filesystem-wide default, it would slowly improve existing filesystems by preventing the spread of explicit-but-fs-default layouts. In such cases, it might make sense to add a tunable to control the "inherit filesystem-wide default file layout from parent" behaviour (e.g. lod.*.stripe_inherit_default or similar, but default the tunable to be off (which is IMHO the better long-term solution), and allow it to be enabled if this is the wrong choice for some reason. |
| Comment by Jian Yu [ 13/Jan/19 ] |
|
Hi Andreas, Before adding the implementation of lod.*.stripe_inherit_default, I did some tests to verify patch https://review.whamcloud.com/33956. Here are the test results: # getfattr -n trusted.lov /mnt/lustre /mnt/lustre: trusted.lov: No such attribute # mkdir /mnt/lustre/olddir # getfattr -n trusted.lov /mnt/lustre/olddir /mnt/lustre/olddir: trusted.lov: No such attribute # lfs setstripe -S 8M /mnt/lustre # getfattr -n trusted.lov /mnt/lustre getfattr: Removing leading '/' from absolute path names # file: mnt/lustre trusted.lov=0s0AvRCwEAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAA//8= # mkdir /mnt/lustre/newdir # getfattr -n trusted.lov /mnt/lustre/newdir /mnt/lustre/newdir: trusted.lov: No such attribute <------ newdir didn't inherit root directory default layout # lfs setstripe -p pool /mnt/lustre # getfattr -n trusted.lov /mnt/lustre getfattr: Removing leading '/' from absolute path names # file: mnt/lustre trusted.lov=0s0AvTCwEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//9wb29sAAAAAAAAAAAAAAAA # mkdir /mnt/lustre/newdir_pool # getfattr -n trusted.lov /mnt/lustre/newdir_pool /mnt/lustre/newdir_pool: trusted.lov: No such attribute <------ newdir_pool didn't inherit root directory default layout # lfs setstripe -S 4M -p pool /mnt/lustre/newdir_pool # getfattr -n trusted.lov /mnt/lustre/newdir_pool getfattr: Removing leading '/' from absolute path names # file: mnt/lustre/newdir_pool trusted.lov=0s0AvTCwEAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAA//9wb29sAAAAAAAAAAAAAAAA # mkdir /mnt/lustre/newdir_pool/subdir # getfattr -n trusted.lov /mnt/lustre/newdir_pool/subdir getfattr: Removing leading '/' from absolute path names # file: mnt/lustre/newdir_pool/subdir trusted.lov=0s0AvTCwEAAAAEAAAAAAAAAAEEAAACAAAAAABAAAAA//9wb29sAAAAAAAAAAAAAAAA <------ subdir inherited non-root parent directory default layout Could you please take a look at the above test results to see if they are as expected? Thank you. |
| Comment by Andreas Dilger [ 13/Jan/19 ] |
|
Yes, I think this looks correct. |
| Comment by Patrick Farrell (Inactive) [ 22/Jan/19 ] |
|
There are references here to some sort of file system wide default layout. I wasn't aware that was a possibility - Is there (or could someone give |
| Comment by Andreas Dilger [ 22/Jan/19 ] |
|
The old-style "filesystem wide" plain defaults (used in case everything else fails) are stored in the lov_descriptor for the filesystem from the mkfs.lustre --param lov.stripesize and similar options. They can also be set via lctl conf_param on the MGS. However, for quite a few releases, the more common interface for setting the filesystem-wide default is to use "lfs setstripe" as root to set a default layout on the root directory of the filesystem. This allows complex default layouts (e.g. pools, PFL, FLR, etc) to be set for the filesystem. This is mentioned in the man page for lfs-setstripe.1:
However, I note that this text needs to be updated to reflect that the filesystem default layout will not be explicitly copied to subdirectories under the root directory and their children to ensure that the filesystem default layout continues to be applied to those directories if the default is changed. |
| Comment by Patrick Farrell (Inactive) [ 22/Jan/19 ] |
|
Thanks, Andreas - Nice to have the background here. |
| Comment by Jinshan Xiong [ 26/Jan/19 ] |
|
I think system-wide default layout needs a new way of definition. For example, we can use one bit in the layout to specify that a directory should apply system default layout(like a layout pointer). This patch makes root directory different from the other directories, which seems confusing from my point of view. |
| Comment by Andreas Dilger [ 27/Jan/19 ] |
|
Actually, it isn't really different than other directories in that they do inherit the layout from the parent, they just don't make a copy. That avoids copying the current default layout all the way from the root directory down to all the subdirectories and then if the default changes there are a thousand copies of the old default around the filesystem. |
| Comment by Gerrit Updater [ 30/Jan/19 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/33956/ |
| Comment by Gerrit Updater [ 30/Jan/19 ] |
|
Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/34135 |
| Comment by Gerrit Updater [ 30/Jan/19 ] |
|
Jian Yu (yujian@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/34139 |
| Comment by Peter Jones [ 30/Jan/19 ] |
|
Landed for 2.13 |
| Comment by Gerrit Updater [ 23/Feb/19 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/34139/ |
| Comment by Gerrit Updater [ 19/Mar/19 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/34135/ |
| Comment by Lai Siyao [ 09/May/19 ] |
|
This patch looks wrong to me: in lod_ah_init(), if parent directory is ROOT, it skips reading default layout, which means subdirs under ROOT don't follow default layout, while in my understanding it need to read default layout anyway, and then use it to decide child layout, but it doesn't inherit this default layout (by clearing it after use). |
| Comment by Andreas Dilger [ 18/May/19 ] |
|
Lai, could you please put your comments in the form of a test case, to verify if this is working or broken. If it is broken, then we can use your patch to verify it is working when it is fixed. |
| Comment by Lai Siyao [ 22/May/19 ] |
|
Okay, I'll work on it after vacation. |
| Comment by Gerrit Updater [ 12/Jun/19 ] |
|
Lai Siyao (lai.siyao@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/35204 |
| Comment by Andreas Dilger [ 30/Sep/19 ] |
|
There is a patch that has not been landed yet. |
| Comment by Gerrit Updater [ 04/Oct/19 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/35204/ |
| Comment by Peter Jones [ 04/Oct/19 ] |
|
Landed for 2.13 |
| Comment by Gerrit Updater [ 04/Oct/19 ] |
|
Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36370 |
| Comment by Gerrit Updater [ 21/Nov/19 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36370/ |