staging/lustre/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.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-on: http://review.whamcloud.com/12952
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Lai Siyao 2015-03-25 21:53:26 -04:00 committed by Greg Kroah-Hartman
parent 3ce08cd7a2
commit d6abc59ec8

View File

@ -295,13 +295,18 @@ static int ll_xattr_find_get_lock(struct inode *inode,
mutex_lock(&lli->lli_xattrs_enq_lock); mutex_lock(&lli->lli_xattrs_enq_lock);
/* Try matching first. */ /* inode may have been shrunk and recreated, so data is gone, match lock
mode = ll_take_md_lock(inode, MDS_INODELOCK_XATTR, &lockh, 0, LCK_PR); * only when data exists. */
if (mode != 0) { if (ll_xattr_cache_valid(lli)) {
/* fake oit in mdc_revalidate_lock() manner */ /* Try matching first. */
oit->d.lustre.it_lock_handle = lockh.cookie; mode = ll_take_md_lock(inode, MDS_INODELOCK_XATTR, &lockh, 0,
oit->d.lustre.it_lock_mode = mode; LCK_PR);
goto out; 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. */ /* Enqueue if the lock isn't cached locally. */