Whamcloud - gitweb
LU-3057 llite: swap layout fixes - hang at sanity 56x and 56w
authorJinshan Xiong <jinshan.xiong@intel.com>
Tue, 2 Apr 2013 23:26:43 +0000 (16:26 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 5 Apr 2013 18:47:35 +0000 (14:47 -0400)
Two issues will be fixed in this patch:
1. in ll_swap_layouts, ll_setattr() should be called with inode mutex
   held.
2. stripes should be reloaded after layout is swapped on the MDT.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ibdb30c78bf8642886afc7343544d7db3bcbe6726
Reviewed-on: http://review.whamcloud.com/5874
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c
lustre/lod/lod_object.c

index fe4f03c..01530a5 100644 (file)
@@ -1868,7 +1868,7 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
        __u32                    gid;
        __u64                    dv;
        struct ll_swap_stack    *llss = NULL;
-       int                      rc, rc1;
+       int                      rc;
 
        OBD_ALLOC_PTR(llss);
        if (llss == NULL)
@@ -1990,12 +1990,22 @@ putgl:
        }
 
        /* update time if requested */
-       rc = rc1 = 0;
-       if (llss->ia2.ia_valid != 0)
+       rc = 0;
+       if (llss->ia2.ia_valid != 0) {
+               mutex_lock(&llss->inode1->i_mutex);
                rc = ll_setattr(file1->f_dentry, &llss->ia2);
+               mutex_unlock(&llss->inode1->i_mutex);
+       }
+
+       if (llss->ia1.ia_valid != 0) {
+               int rc1;
 
-       if (llss->ia1.ia_valid != 0)
+               mutex_lock(&llss->inode2->i_mutex);
                rc1 = ll_setattr(file2->f_dentry, &llss->ia1);
+               mutex_unlock(&llss->inode2->i_mutex);
+               if (rc == 0)
+                       rc = rc1;
+       }
 
 free:
        if (llss != NULL)
index 070b2b6..55067e0 100644 (file)
@@ -528,10 +528,13 @@ static int lod_xattr_set(const struct lu_env *env,
                 * already have during req replay, declare_xattr_set()
                 * defines striping, then create() does the work
                */
-               if (fl & LU_XATTR_REPLACE)
+               if (fl & LU_XATTR_REPLACE) {
+                       /* free stripes, then update disk */
+                       lod_object_free_striping(env, lod_dt_obj(dt));
                        rc = dt_xattr_set(env, next, buf, name, fl, th, capa);
-               else
+               } else {
                        rc = lod_striping_create(env, dt, NULL, NULL, th);
+               }
                RETURN(rc);
        } else {
                /*