From: Lai Siyao Date: Sun, 30 Aug 2020 16:59:40 +0000 (+0800) Subject: LU-13511 obdclass: don't initialize obj for zero FID X-Git-Tag: 2.13.57~165 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=22ea9767956c89aa08ef6d80ad04aaccde647755;p=fs%2Flustre-release.git LU-13511 obdclass: don't initialize obj for zero FID Object with zero FID is used in stripe allocation, and it's meaningless to initialize such object via lu_object_find_at(), return error early to avoid assertion in lu_object_put(). Signed-off-by: Lai Siyao Change-Id: Ia1bda3d01ff7552e94f31a9c928868652937d559 Reviewed-on: https://review.whamcloud.com/39792 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Stephane Thiell Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index dce91d5..e174dfa9 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -815,6 +815,13 @@ struct lu_object *lu_object_find_at(const struct lu_env *env, ENTRY; + /* FID is from disk or network, zero FID is meaningless, return error + * early to avoid assertion in lu_object_put. If a zero FID is wanted, + * it should be allocated via lu_object_anon(). + */ + if (fid_is_zero(f)) + RETURN(ERR_PTR(-EINVAL)); + /* * This uses standard index maintenance protocol: *