From 51e57496838381b5d7fdecf228e042e9660c21b6 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Fri, 8 May 2020 12:28:52 +0800 Subject: [PATCH] LU-13481 dne: improve temp file name check Previously if all but two characters in file name suffix are digit, it's not treated as temp file, as is too strict if suffix length is short, e.g. 6. Change it to allow one character, and this non-digit character should not be the starting character. Test-Parameters: trivial testlist=sanity env=ONLY=33h,ONLY_REPEAT=500 Signed-off-by: Lai Siyao Change-Id: Ie36e6e15c1e593f47f4d3fab7f8c567d1d587f28 Reviewed-on: https://review.whamcloud.com/38539 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Hongchao Zhang --- lustre/include/lu_object.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 585b1ca..0a9ed50 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1377,7 +1377,8 @@ static inline bool lu_name_is_temp_file(const char *name, int namelen, * About 0.07% of randomly-generated names will slip through, * but this avoids 99.93% of cross-MDT renames for those files. */ - if (digit >= suffixlen - 2 || upper == suffixlen || lower == suffixlen) + if ((digit >= suffixlen - 1 && !isdigit(name[namelen - suffixlen])) || + upper == suffixlen || lower == suffixlen) return false; return true; -- 1.8.3.1