From: Lai Siyao Date: Wed, 11 Jun 2014 14:44:01 +0000 (+0800) Subject: LU-3544 xattr: xattr data may be gone with lock held X-Git-Tag: 2.6.0-RC1~72 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F10693%2F2;p=fs%2Flustre-release.git LU-3544 xattr: xattr data may be gone with lock held Xattr cached data may be gone, but lock still held, in this case, refetch xattr from server, otherwise client will return error. Test-Parameters: alwaysuploadlogs envdefinitions=SLOW=yes testlist=parallel-scale-nfs,parallel-scale-nfs Signed-off-by: Lai Siyao Change-Id: Id6fbbef339fea540728b181b2ae91799b8151fbd Reviewed-on: http://review.whamcloud.com/10693 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/xattr_cache.c b/lustre/llite/xattr_cache.c index f961f98..d23808a 100644 --- a/lustre/llite/xattr_cache.c +++ b/lustre/llite/xattr_cache.c @@ -327,13 +327,18 @@ static int ll_xattr_find_get_lock(struct inode *inode, ENTRY; mutex_lock(&lli->lli_xattrs_enq_lock); - /* Try matching first. */ - mode = ll_take_md_lock(inode, MDS_INODELOCK_XATTR, &lockh, 0, LCK_PR); - if (mode != 0) { - /* fake oit in mdc_revalidate_lock() manner */ - oit->d.lustre.it_lock_handle = lockh.cookie; - oit->d.lustre.it_lock_mode = mode; - goto out; + /* inode may have been shrunk and recreated, so data is gone, match lock + * only when data exists. */ + if (ll_xattr_cache_valid(lli)) { + /* Try matching first. */ + mode = ll_take_md_lock(inode, MDS_INODELOCK_XATTR, &lockh, 0, + LCK_PR); + if (mode != 0) { + /* fake oit in mdc_revalidate_lock() manner */ + oit->d.lustre.it_lock_handle = lockh.cookie; + oit->d.lustre.it_lock_mode = mode; + goto out; + } } /* Enqueue if the lock isn't cached locally. */