Whamcloud - gitweb
LU-13481 dne: improve temp file name check 39/38539/2
authorLai Siyao <lai.siyao@whamcloud.com>
Fri, 8 May 2020 04:28:52 +0000 (12:28 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 20 May 2020 08:25:47 +0000 (08:25 +0000)
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 <lai.siyao@whamcloud.com>
Change-Id: Ie36e6e15c1e593f47f4d3fab7f8c567d1d587f28
Reviewed-on: https://review.whamcloud.com/38539
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
lustre/include/lu_object.h

index 585b1ca..0a9ed50 100644 (file)
@@ -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.
         */
         * 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;
                return false;
 
        return true;