Here is the test result on Lustre 2.10.5_ddn6 and master branch:
The result is different from the description part of this ticket. Actually, running "lfs getstripe" on newly created directory after setting pool name on its parent directory can still show the pool name. Only the directory created before setting pool name on its parent directory has pool name printing issue.
While running "lfs getstripe", the following codes produced the different outputs for "/mnt/lustre" and "/mnt/lustre/olddir":
__u32 magic = *(__u32 *)¶m->fp_lmd->lmd_lmm;
if (magic == LOV_USER_MAGIC_V1) { <------ "/mnt/lustre/olddir" had LOV_USER_MAGIC_V1
lov_dump_user_lmm_v1v3(...);
} else { <------ "/mnt/lustre" had LOV_USER_MAGIC_V3
char pool_name[LOV_MAXPOOLNAME + 1];
struct lov_user_ost_data_v1 *objects;
struct lov_user_md_v3 *lmmv3 = (void *)¶m->fp_lmd->lmd_lmm;
snprintf(pool_name, sizeof(pool_name), "%s",
lmmv3->lmm_pool_name);
objects = lmmv3->lmm_objects;
lov_dump_user_lmm_v1v3(...);
}
After running "lfs setstripe -p OLD" on "/mnt/lustre", its magic was changed from LOV_USER_MAGIC_V1 to LOV_USER_MAGIC_V3 in lod_xattr_set(). However, the previously created "/mnt/lustre/olddir" still had magic of LOV_USER_MAGIC_V1 and was not changed.
Hi Andreas,
As per your suggestions, fetching default layout for a directory will be done in lfs_getstripe()->...->cb_getstripe(). If get_lmd_info() returns -ENODATA for a directory that does not have trusted.lov xattr, cb_getstripe() should get the lov_user_md data from ROOT FID, and then print the layout information in llapi_lov_dump_user_lmm().