Whamcloud - gitweb
LU-3254 llite: Update layout_gen only if layout change succeed 58/9858/2
authorJinshan Xiong <jinshan.xiong@intel.com>
Sun, 30 Mar 2014 02:14:05 +0000 (19:14 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 19 Apr 2014 06:24:00 +0000 (06:24 +0000)
Move layout generation update to ll_layout_conf() so that it will
change layout at LLITE only if layout update has succeeded.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I407d617be184b1c888d6b16b11f7e33bf10add80
Reviewed-on: http://review.whamcloud.com/9858
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c
lustre/llite/vvp_io.c
lustre/llite/vvp_object.c

index cc3ecaa..e0019c3 100644 (file)
@@ -3718,11 +3718,24 @@ int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf)
                LASSERT(lock != NULL);
                LASSERT(ldlm_has_layout(lock));
                if (result == 0) {
                LASSERT(lock != NULL);
                LASSERT(ldlm_has_layout(lock));
                if (result == 0) {
+                       struct lustre_md *md = conf->u.coc_md;
+                       __u32 gen = LL_LAYOUT_GEN_EMPTY;
+
                        /* it can only be allowed to match after layout is
                         * applied to inode otherwise false layout would be
                         * seen. Applying layout shoud happen before dropping
                         * the intent lock. */
                        ldlm_lock_allow_match(lock);
                        /* it can only be allowed to match after layout is
                         * applied to inode otherwise false layout would be
                         * seen. Applying layout shoud happen before dropping
                         * the intent lock. */
                        ldlm_lock_allow_match(lock);
+
+                       lli->lli_has_smd = lsm_has_objects(md->lsm);
+                       if (md->lsm != NULL)
+                               gen = md->lsm->lsm_layout_gen;
+
+                       CDEBUG(D_VFSTRACE,
+                              DFID ": layout version change: %u -> %u\n",
+                              PFID(&lli->lli_fid), ll_layout_version_get(lli),
+                              gen);
+                       ll_layout_version_set(lli, gen);
                }
        }
        RETURN(result);
                }
        }
        RETURN(result);
index 9a464f2..e95edcf 100644 (file)
@@ -792,7 +792,7 @@ static int vvp_io_write_start(const struct lu_env *env,
         ENTRY;
 
        if (!can_populate_pages(env, io, inode))
         ENTRY;
 
        if (!can_populate_pages(env, io, inode))
-               return 0;
+               RETURN(0);
 
         if (cl_io_is_append(io)) {
                 /*
 
         if (cl_io_is_append(io)) {
                 /*
index 35262e1..498d3b2 100644 (file)
@@ -144,26 +144,6 @@ static int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,
                 * a price themselves. */
                unmap_mapping_range(conf->coc_inode->i_mapping,
                                    0, OBD_OBJECT_EOF, 0);
                 * a price themselves. */
                unmap_mapping_range(conf->coc_inode->i_mapping,
                                    0, OBD_OBJECT_EOF, 0);
-
-               return 0;
-       }
-
-       if (conf->coc_opc != OBJECT_CONF_SET)
-               return 0;
-
-       if (conf->u.coc_md != NULL && conf->u.coc_md->lsm != NULL) {
-               CDEBUG(D_VFSTRACE, DFID ": layout version change: %u -> %u\n",
-                      PFID(&lli->lli_fid), lli->lli_layout_gen,
-                      conf->u.coc_md->lsm->lsm_layout_gen);
-
-               lli->lli_has_smd = lsm_has_objects(conf->u.coc_md->lsm);
-               ll_layout_version_set(lli, conf->u.coc_md->lsm->lsm_layout_gen);
-       } else {
-               CDEBUG(D_VFSTRACE, DFID ": layout nuked: %u.\n",
-                      PFID(&lli->lli_fid), lli->lli_layout_gen);
-
-               lli->lli_has_smd = false;
-               ll_layout_version_set(lli, LL_LAYOUT_GEN_EMPTY);
        }
        return 0;
 }
        }
        return 0;
 }