X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Fxattr_cache.c;h=64bcbc1a4bd6b52c0e3121b0f957e1dafa63fd2a;hb=0fab7dc89f4756538f8b67e7736abd6f225abae8;hp=f961f984f294e548c38aac8d484e5922eae25fd3;hpb=003df3c38fe74a092f75569793edd6ec5a387d5c;p=fs%2Flustre-release.git diff --git a/lustre/llite/xattr_cache.c b/lustre/llite/xattr_cache.c index f961f98..64bcbc1 100644 --- a/lustre/llite/xattr_cache.c +++ b/lustre/llite/xattr_cache.c @@ -24,6 +24,8 @@ /* * Copyright 2012 Xyratex Technology Limited * + * Copyright (c) 2013, 2014, Intel Corporation. + * * Author: Andrew Perepechko * */ @@ -34,7 +36,6 @@ #include #include #include -#include #include #include #include "llite_internal.h" @@ -327,13 +328,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. */