Whamcloud - gitweb
LU-12616 obclass: fix MDS start/stop race
[fs/lustre-release.git] / lustre / lfsck / lfsck_bookmark.c
index 0b055db..0aa94fa 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2013, 2014, Intel Corporation.
+ * Copyright (c) 2013, 2017, Intel Corporation.
  */
 /*
  * lustre/lfsck/lfsck_bookmark.c
@@ -33,7 +33,6 @@
 #include <lu_object.h>
 #include <dt_object.h>
 #include <lustre_fid.h>
-#include <lustre/lustre_user.h>
 
 #include "lfsck_internal.h"
 
@@ -225,6 +224,11 @@ int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
                        dirty = true;
                }
 
+               if (bk->lb_param & LPF_DELAY_CREATE_OSTOBJ) {
+                       bk->lb_param &= ~LPF_DELAY_CREATE_OSTOBJ;
+                       dirty = true;
+               }
+
                if (bk->lb_param & LPF_FAILOUT) {
                        bk->lb_param &= ~LPF_FAILOUT;
                        dirty = true;
@@ -258,9 +262,19 @@ int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
                        dirty = true;
                }
 
+               if ((bk->lb_param & LPF_OST_ORPHAN) &&
+                   !(start->ls_flags & LPF_OST_ORPHAN)) {
+                       bk->lb_param &= ~LPF_OST_ORPHAN;
+                       dirty = true;
+               } else if (!(bk->lb_param & LPF_OST_ORPHAN) &&
+                          (start->ls_flags & LPF_OST_ORPHAN)) {
+                       bk->lb_param |= LPF_OST_ORPHAN;
+                       dirty = true;
+               }
+
                if ((start->ls_valid & LSV_CREATE_OSTOBJ) || reset) {
                        if ((bk->lb_param & LPF_CREATE_OSTOBJ) &&
-                           !(start->ls_valid & LSV_CREATE_OSTOBJ)) {
+                           !(start->ls_flags & LPF_CREATE_OSTOBJ)) {
                                bk->lb_param &= ~LPF_CREATE_OSTOBJ;
                                dirty = true;
                        } else if (!(bk->lb_param & LPF_CREATE_OSTOBJ) &&
@@ -272,7 +286,7 @@ int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
 
                if ((start->ls_valid & LSV_CREATE_MDTOBJ) || reset) {
                        if ((bk->lb_param & LPF_CREATE_MDTOBJ) &&
-                           !(start->ls_valid & LSV_CREATE_MDTOBJ)) {
+                           !(start->ls_flags & LPF_CREATE_MDTOBJ)) {
                                bk->lb_param &= ~LPF_CREATE_MDTOBJ;
                                dirty = true;
                        } else if (!(bk->lb_param & LPF_CREATE_MDTOBJ) &&
@@ -282,41 +296,43 @@ int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
                        }
                }
 
+               if ((start->ls_valid & LSV_DELAY_CREATE_OSTOBJ) || reset) {
+                       if ((bk->lb_param & LPF_DELAY_CREATE_OSTOBJ) &&
+                           !(start->ls_flags & LPF_DELAY_CREATE_OSTOBJ)) {
+                               bk->lb_param &= ~LPF_DELAY_CREATE_OSTOBJ;
+                               dirty = true;
+                       } else if (!(bk->lb_param & LPF_DELAY_CREATE_OSTOBJ) &&
+                                  start->ls_flags & LPF_DELAY_CREATE_OSTOBJ) {
+                               bk->lb_param |= LPF_DELAY_CREATE_OSTOBJ;
+                               dirty = true;
+                       }
+               }
+
                if ((start->ls_valid & LSV_ERROR_HANDLE) || reset) {
                        if ((bk->lb_param & LPF_FAILOUT) &&
-                           !(start->ls_valid & LSV_ERROR_HANDLE)) {
+                           !(start->ls_flags & LPF_FAILOUT)) {
                                bk->lb_param &= ~LPF_FAILOUT;
                                dirty = true;
-                       } else if (!(start->ls_flags & LPF_FAILOUT) &&
-                                  (bk->lb_param & LPF_FAILOUT)) {
-                               bk->lb_param &= ~LPF_FAILOUT;
+                       } else if (!(bk->lb_param & LPF_FAILOUT) &&
+                                  (start->ls_flags & LPF_FAILOUT)) {
+                               bk->lb_param |= LPF_FAILOUT;
                                dirty = true;
                        }
                }
 
                if ((start->ls_valid & LSV_DRYRUN) || reset) {
                        if ((bk->lb_param & LPF_DRYRUN) &&
-                          !(start->ls_valid & LSV_DRYRUN)) {
-                               bk->lb_param &= ~LPF_DRYRUN;
-                               dirty = true;
-                       } else if (!(start->ls_flags & LPF_DRYRUN) &&
-                                  (bk->lb_param & LPF_DRYRUN)) {
+                           !(start->ls_flags & LPF_DRYRUN)) {
                                bk->lb_param &= ~LPF_DRYRUN;
                                lfsck->li_drop_dryrun = 1;
                                dirty = true;
+                       } else if (!(bk->lb_param & LPF_DRYRUN) &&
+                                  (start->ls_flags & LPF_DRYRUN)) {
+                               bk->lb_param |= LPF_DRYRUN;
+                               dirty = true;
                        }
                }
 
-               if ((bk->lb_param & LPF_OST_ORPHAN) &&
-                   !(start->ls_flags & LPF_OST_ORPHAN)) {
-                       bk->lb_param &= ~LPF_OST_ORPHAN;
-                       dirty = true;
-               } else if (!(bk->lb_param & LPF_OST_ORPHAN) &&
-                          (start->ls_flags & LPF_OST_ORPHAN)) {
-                       bk->lb_param |= LPF_OST_ORPHAN;
-                       dirty = true;
-               }
-
                if (start->ls_valid & LSV_SPEED_LIMIT) {
                        if (__lfsck_set_speed(lfsck, start->ls_speed_limit))
                                dirty = true;
@@ -326,8 +342,7 @@ int lfsck_set_param(const struct lu_env *env, struct lfsck_instance *lfsck,
                }
 
                if (start->ls_valid & LSV_ASYNC_WINDOWS) {
-                       if (start->ls_async_windows < 1 ||
-                           start->ls_async_windows > LFSCK_ASYNC_WIN_MAX)
+                       if (start->ls_async_windows < 1)
                                return -EINVAL;
 
                        if (bk->lb_async_windows != start->ls_async_windows) {