From 9a93221475f5fab91ef510d77ca5d88b47140f8e Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Tue, 2 Apr 2013 16:26:43 -0700 Subject: [PATCH] LU-3057 llite: swap layout fixes - hang at sanity 56x and 56w 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 Change-Id: Ibdb30c78bf8642886afc7343544d7db3bcbe6726 Reviewed-on: http://review.whamcloud.com/5874 Reviewed-by: Alex Zhuravlev Tested-by: Hudson Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 18 ++++++++++++++---- lustre/lod/lod_object.c | 7 +++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index fe4f03c..01530a5 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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) diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 070b2b6..55067e0 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -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 { /* -- 1.8.3.1