Whamcloud - gitweb
LU-5466 lfsck: typo in lfsck_del_target
[fs/lustre-release.git] / lustre / lfsck / lfsck_lib.c
index 247a608..46f75a4 100644 (file)
@@ -364,6 +364,7 @@ static int lfsck_create_lpf_local(const struct lu_env *env,
                                  struct dt_object_format *dof,
                                  const char *name)
 {
+       struct dt_insert_rec    *rec    = &lfsck_env_info(env)->lti_dt_rec;
        struct dt_device        *dev    = lfsck->li_bottom;
        struct lfsck_bookmark   *bk     = &lfsck->li_bookmark_ram;
        struct dt_object        *bk_obj = lfsck->li_bookmark_obj;
@@ -410,7 +411,9 @@ static int lfsck_create_lpf_local(const struct lu_env *env,
                GOTO(stop, rc);
 
        /* 4a. insert name into parent dir */
-       rc = dt_declare_insert(env, parent, (const struct dt_rec *)cfid,
+       rec->rec_type = S_IFDIR;
+       rec->rec_fid = cfid;
+       rc = dt_declare_insert(env, parent, (const struct dt_rec *)rec,
                               (const struct dt_key *)name, th);
        if (rc != 0)
                GOTO(stop, rc);
@@ -440,13 +443,15 @@ static int lfsck_create_lpf_local(const struct lu_env *env,
                GOTO(unlock, rc = -ENOTDIR);
 
        /* 1b.2. insert dot into child dir */
-       rc = dt_insert(env, child, (const struct dt_rec *)cfid,
+       rec->rec_fid = cfid;
+       rc = dt_insert(env, child, (const struct dt_rec *)rec,
                       (const struct dt_key *)dot, th, BYPASS_CAPA, 1);
        if (rc != 0)
                GOTO(unlock, rc);
 
        /* 1b.3. insert dotdot into child dir */
-       rc = dt_insert(env, child, (const struct dt_rec *)&LU_LPF_FID,
+       rec->rec_fid = &LU_LPF_FID;
+       rc = dt_insert(env, child, (const struct dt_rec *)rec,
                       (const struct dt_key *)dotdot, th, BYPASS_CAPA, 1);
        if (rc != 0)
                GOTO(unlock, rc);
@@ -464,7 +469,8 @@ static int lfsck_create_lpf_local(const struct lu_env *env,
                GOTO(stop, rc);
 
        /* 4b. insert name into parent dir */
-       rc = dt_insert(env, parent, (const struct dt_rec *)cfid,
+       rec->rec_fid = cfid;
+       rc = dt_insert(env, parent, (const struct dt_rec *)rec,
                       (const struct dt_key *)name, th, BYPASS_CAPA, 1);
        if (rc != 0)
                GOTO(stop, rc);
@@ -502,6 +508,7 @@ static int lfsck_create_lpf_remote(const struct lu_env *env,
                                   struct dt_object_format *dof,
                                   const char *name)
 {
+       struct dt_insert_rec    *rec    = &lfsck_env_info(env)->lti_dt_rec;
        struct lfsck_bookmark   *bk     = &lfsck->li_bookmark_ram;
        struct dt_object        *bk_obj = lfsck->li_bookmark_obj;
        const struct lu_fid     *cfid   = lfsck_dto2fid(child);
@@ -590,13 +597,16 @@ static int lfsck_create_lpf_remote(const struct lu_env *env,
                GOTO(unlock, rc = -ENOTDIR);
 
        /* 1b.2. insert dot into child dir */
-       rc = dt_insert(env, child, (const struct dt_rec *)cfid,
+       rec->rec_type = S_IFDIR;
+       rec->rec_fid = cfid;
+       rc = dt_insert(env, child, (const struct dt_rec *)rec,
                       (const struct dt_key *)dot, th, BYPASS_CAPA, 1);
        if (rc != 0)
                GOTO(unlock, rc);
 
        /* 1b.3. insert dotdot into child dir */
-       rc = dt_insert(env, child, (const struct dt_rec *)&LU_LPF_FID,
+       rec->rec_fid = &LU_LPF_FID;
+       rc = dt_insert(env, child, (const struct dt_rec *)rec,
                       (const struct dt_key *)dotdot, th, BYPASS_CAPA, 1);
        if (rc != 0)
                GOTO(unlock, rc);
@@ -632,7 +642,8 @@ static int lfsck_create_lpf_remote(const struct lu_env *env,
                RETURN(PTR_ERR(th));
 
        /* 5a. insert name into parent dir */
-       rc = dt_declare_insert(env, parent, (const struct dt_rec *)cfid,
+       rec->rec_fid = cfid;
+       rc = dt_declare_insert(env, parent, (const struct dt_rec *)rec,
                               (const struct dt_key *)name, th);
        if (rc != 0)
                GOTO(stop, rc);
@@ -647,7 +658,7 @@ static int lfsck_create_lpf_remote(const struct lu_env *env,
                GOTO(stop, rc);
 
        /* 5b. insert name into parent dir */
-       rc = dt_insert(env, parent, (const struct dt_rec *)cfid,
+       rc = dt_insert(env, parent, (const struct dt_rec *)rec,
                       (const struct dt_key *)name, th, BYPASS_CAPA, 1);
        if (rc != 0)
                GOTO(stop, rc);
@@ -1557,7 +1568,7 @@ static int lfsck_stop_notify(const struct lu_env *env,
                                             &lfsck->li_list_double_scan);
        if (com != NULL)
                lfsck_component_get(com);
-       spin_lock(&lfsck->li_lock);
+       spin_unlock(&lfsck->li_lock);
 
        if (com != NULL) {
                if (com->lc_ops->lfsck_stop_notify != NULL) {
@@ -2625,7 +2636,7 @@ void lfsck_del_target(const struct lu_env *env, struct dt_device *key,
 {
        struct lfsck_instance   *lfsck;
        struct lfsck_tgt_descs  *ltds;
-       struct lfsck_tgt_desc   *ltd    = NULL;
+       struct lfsck_tgt_desc   *ltd;
        struct list_head        *head;
 
        if (for_ost)
@@ -2644,6 +2655,7 @@ void lfsck_del_target(const struct lu_env *env, struct dt_device *key,
                }
        }
 
+       ltd = NULL;
        lfsck = __lfsck_instance_find(key, true, false);
        spin_unlock(&lfsck_instance_lock);
        if (unlikely(lfsck == NULL))
@@ -2675,7 +2687,7 @@ unlock:
                if (for_ost)
                        head = &lfsck->li_ost_descs.ltd_orphan;
                else
-                       head = &lfsck->li_ost_descs.ltd_orphan;
+                       head = &lfsck->li_mdt_descs.ltd_orphan;
 
                list_for_each_entry(ltd, head, ltd_orphan_list) {
                        if (ltd->ltd_tgt == tgt) {