From: Fan Yong Date: Tue, 2 Sep 2014 11:06:03 +0000 (+0800) Subject: LU-5833 lfsck: handle lfsck_open_dir() return-value properly X-Git-Tag: 2.6.91~70 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f935a36c035a20433669997f7d70b35073dff5f2 LU-5833 lfsck: handle lfsck_open_dir() return-value properly Inside the lfsck_prep(), the returned value from lfsck_open_dir() should be handled properly before returning to the caller directly. For example: positive number from lfsck_open_dir() means the end of current directory, but if continuously return such value to the lfsck_prep()'s caller, then the whole LFSCK first-stage scanning will be regarded as done by wrong. Test-Parameters: mdsfilesystemtype=zfs mdtfilesystemtype=zfs ostfilesystemtype=zfs testlist=sanity-lfsck Signed-off-by: Fan Yong Change-Id: I9e5c32b8594a65f1b605196373034ace6c9d1881 Reviewed-on: http://review.whamcloud.com/12533 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger --- diff --git a/lustre/lfsck/lfsck_engine.c b/lustre/lfsck/lfsck_engine.c index 3508103..cda9180e 100644 --- a/lustre/lfsck/lfsck_engine.c +++ b/lustre/lfsck/lfsck_engine.c @@ -551,6 +551,9 @@ static int lfsck_prep(const struct lu_env *env, struct lfsck_instance *lfsck, pos->lp_dir_cookie = 0; rc = lfsck_open_dir(env, lfsck, pos->lp_dir_cookie); + if (rc > 0) + /* The end of the directory. */ + rc = 0; } GOTO(out, rc);