From d9e893ca657ab64e20f29dffe7c3908332871d98 Mon Sep 17 00:00:00 2001 From: Vladimir Saveliev Date: Wed, 9 Jun 2010 16:55:27 +0400 Subject: [PATCH] b=11063 fix lock inversion unlock inode mutex before extent lock acquisition to avoid lock order inversion few misspells are fixed i=green i=vitaly --- lustre/liblustre/llite_lib.h | 2 +- lustre/liblustre/rw.c | 2 +- lustre/llite/file.c | 2 +- lustre/llite/llite_internal.h | 2 +- lustre/llite/llite_lib.c | 2 ++ 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index a40098a..b076c45 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -107,7 +107,7 @@ struct llu_inode_info { /* not for stat, change it later */ int lli_st_flags; unsigned long lli_st_generation; - /* the most recent attributes from mds, it is used for timestampts + /* the most recent attributes from mds, it is used for timestamps * only so far */ struct ost_lvb lli_lvb; }; diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index a6af277..2983452 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -274,7 +274,7 @@ int llu_glimpse_size(struct inode *inode) lov_stripe_lock(lli->lli_smd); inode_init_lvb(inode, &lvb); - /* merge timestamps the most resently obtained from mds with + /* merge timestamps the most recently obtained from mds with timestamps obtained from osts */ lvb = lli->lli_lvb; rc = obd_merge_lvb(sbi->ll_osc_exp, lli->lli_smd, &lvb, 0); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index c007815..16f0209 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -998,7 +998,7 @@ int ll_glimpse_size(struct inode *inode, int ast_flags) ll_inode_size_lock(inode, 1); inode_init_lvb(inode, &lvb); - /* merge timestamps the most resently obtained from mds with + /* merge timestamps the most recently obtained from mds with timestamps obtained from osts */ lvb.lvb_atime = lli->lli_lvb.lvb_atime; lvb.lvb_mtime = lli->lli_lvb.lvb_mtime; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 6c79825..0b11fe7 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -185,7 +185,7 @@ struct ll_inode_info { void *lli_opendir_key; struct ll_statahead_info *lli_sai; struct rw_semaphore lli_truncate_rwsem; - /* the most recent attributes from mds, it is used for timestampts + /* the most recent attributes from mds, it is used for timestamps * only so far */ struct ost_lvb lli_lvb; struct inode lli_vfs_inode; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 59a8140..46d09aa 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1545,6 +1545,7 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr) if (LTIME_S(attr->ia_mtime) < LTIME_S(attr->ia_ctime)){ struct ost_lvb xtimes; + UNLOCK_INODE_MUTEX(inode); /* setting mtime to past is performed under PW * EOF extent lock */ oinfo->oi_policy.l_extent.start = 0; @@ -1552,6 +1553,7 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr) rc = ll_extent_lock(NULL, inode, lsm, LCK_PW, &oinfo->oi_policy, &lockh, 0); + LOCK_INODE_MUTEX(inode); if (rc) { OBD_FREE_PTR(oinfo); RETURN(rc); -- 1.8.3.1