Whamcloud - gitweb
LU-5833 lfsck: handle lfsck_open_dir() return-value properly 33/12533/3
authorFan Yong <fan.yong@intel.com>
Tue, 2 Sep 2014 11:06:03 +0000 (19:06 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Nov 2014 19:16:40 +0000 (19:16 +0000)
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 <fan.yong@intel.com>
Change-Id: I9e5c32b8594a65f1b605196373034ace6c9d1881
Reviewed-on: http://review.whamcloud.com/12533
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/lfsck/lfsck_engine.c

index 3508103..cda9180 100644 (file)
@@ -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);