From: Namjae Jeon Date: Tue, 13 May 2014 05:26:59 +0000 (+1000) Subject: fsstress: fix incorrect if condition check for collapse range mode X-Git-Tag: v2022.05.01~3146 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=995a459e7a0dc2389ed706af2cb25bc547065ff5;p=users%2Fhch%2Fxfstests-dev.git fsstress: fix incorrect if condition check for collapse range mode There is if condition to be block aligned for off and len of Collapse range. But off and len for all fallocate opearion can be aligned by incorrect if condition check. Signed-off-by: Namjae Jeon Signed-off-by: Ashish Sangwan Reviewed-by: Lukas Czerner Signed-off-by: Dave Chinner --- diff --git a/ltp/fsstress.c b/ltp/fsstress.c index 29fc250d1..b56fe5c6a 100644 --- a/ltp/fsstress.c +++ b/ltp/fsstress.c @@ -2230,7 +2230,7 @@ do_fallocate(int opno, long r, int mode) * Collapse range requires off and len to be block aligned, make it * more likely to be the case. */ - if (FALLOC_FL_COLLAPSE_RANGE && (opno % 2)) { + if ((mode & FALLOC_FL_COLLAPSE_RANGE) && (opno % 2)) { off = ((off + stb.st_blksize - 1) & ~(stb.st_blksize - 1)); len = ((len + stb.st_blksize - 1) & ~(stb.st_blksize - 1)); }