[lustre-devel] [PATCH 19/33] lustre: lmv: treat unknown hash type as sane type
James Simmons <[email protected]> Sun, 2 Feb 2025 15:46:19 -0500
| Newsgroups | org.lustre.lists.lustre-devel |
|---|---|
| Message-ID | <[email protected]> |
From: Lai Siyao <[email protected]> Directory migration failure may leave directory hash type as LMV_HASH_TYPE_UNKNOWN|LMV_HASH_FLAG_BAD_TYPE, which should be treated as sane hash type on existing directories, otherwise such directories can't be unlinked. WC-bug-id: https://jira.whamcloud.com/browse/LU-16717 Lustre-commit: 05cdb71ba68135701 ("LU-16717 mdt: treat unknown hash type as sane type") Signed-off-by: Lai Siyao <[email protected]> Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50796 Reviewed-by: Andreas Dilger <[email protected]> Reviewed-by: Hongchao Zhang <[email protected]> Reviewed-by: Oleg Drokin <[email protected]> Signed-off-by: James Simmons <[email protected]> --- fs/lustre/include/lustre_lmv.h | 4 ++-- include/uapi/linux/lustre/lustre_user.h | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/lustre/include/lustre_lmv.h b/fs/lustre/include/lustre_lmv.h index a2ef550e38d4..5e3dbc52e846 100644 --- a/fs/lustre/include/lustre_lmv.h +++ b/fs/lustre/include/lustre_lmv.h @@ -443,7 +443,7 @@ static inline bool lmv_is_sane(const struct lmv_mds_md_v1 *lmv) if (le32_to_cpu(lmv->lmv_stripe_count) == 0) goto insane; - if (!lmv_is_known_hash_type(le32_to_cpu(lmv->lmv_hash_type))) + if (!lmv_is_sane_hash_type(le32_to_cpu(lmv->lmv_hash_type))) goto insane; return true; @@ -465,7 +465,7 @@ static inline bool lmv_is_sane2(const struct lmv_mds_md_v1 *lmv) if (le32_to_cpu(lmv->lmv_stripe_count) == 0) goto insane; - if (!lmv_is_known_hash_type(le32_to_cpu(lmv->lmv_hash_type))) + if (!lmv_is_sane_hash_type(le32_to_cpu(lmv->lmv_hash_type))) goto insane; return true; diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h index c098d119f18c..4b49bb9c370a 100644 --- a/include/uapi/linux/lustre/lustre_user.h +++ b/include/uapi/linux/lustre/lustre_user.h @@ -794,6 +794,16 @@ static inline bool lmv_is_known_hash_type(__u32 type) #define LMV_HASH_FLAG_KNOWN 0xbe000000 +/* migration failure may leave hash type as + * LMV_HASH_TYPE_UNKNOWN|LMV_HASH_FLAG_BAD_TYPE, which should be treated as + * sane, so such directory can be accessed (resume migration or unlink). + */ +static inline bool lmv_is_sane_hash_type(__u32 type) +{ + return lmv_is_known_hash_type(type) || + type == (LMV_HASH_TYPE_UNKNOWN | LMV_HASH_FLAG_BAD_TYPE); +} + /* both SPLIT and MIGRATION are set for directory split */ static inline bool lmv_hash_is_splitting(__u32 hash) { -- 2.39.3 _______________________________________________ lustre-devel mailing list [email protected] http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org