From d69578eab1611ac685e2ed493a3fc91130523495 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Mon, 21 Aug 2023 11:44:32 +0200 Subject: [PATCH] LU-17043 enc: fix osd lookup cache for long encrypted names Fix osd lookup cache to support files with long encrypted names. Those encrypted names can be up to 256 bytes, not NUL terminated. Lustre-change: https://review.whamcloud.com/52016 Lustre-commit: TBD (from 51a526bfa61bb5391a7ac33108e264f590cd3f0c) Fixes: 07a7befdc1 ("LU-16405 osd: lookup cache") Signed-off-by: Sebastien Buisson Change-Id: Ica2329c8a0990395307a14fe9bb9d43db3b364ed Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52017 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- lustre/osd-ldiskfs/osd_handler.c | 2 +- lustre/osd-ldiskfs/osd_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 2c783bf..56ecce2 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -7857,7 +7857,7 @@ void osd_olc_save(const struct lu_env *env, struct osd_object *obj, entry->lce_obj.lco_gen = obj->oo_inode->i_generation; entry->lce_obj.lco_version = iversion; - LASSERT(ln->ln_namelen <= LDISKFS_NAME_LEN); + LASSERT(ln->ln_namelen <= LDISKFS_NAME_LEN + 1); entry->lce_namelen = ln->ln_namelen; memcpy(entry->lce_name, ln->ln_name, ln->ln_namelen); memcpy(&entry->lce_fid, rec, sizeof(entry->lce_fid)); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 09ad631..72c1d72 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -664,7 +664,7 @@ struct osd_lookup_cache_entry { struct lu_fid lce_fid; short lce_rc; short lce_namelen; - char lce_name[LDISKFS_NAME_LEN]; + char lce_name[LDISKFS_NAME_LEN + 1]; }; #define OSD_LOOKUP_CACHE_MAX 3 -- 1.8.3.1