Whamcloud - gitweb
LU-3544 xattr: xattr data may be gone with lock held 93/10693/2
authorLai Siyao <lai.siyao@intel.com>
Wed, 11 Jun 2014 14:44:01 +0000 (22:44 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 20 Jun 2014 02:52:10 +0000 (02:52 +0000)
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 <lai.siyao@intel.com>
Change-Id: Id6fbbef339fea540728b181b2ae91799b8151fbd
Reviewed-on: http://review.whamcloud.com/10693
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/xattr_cache.c

index f961f98..d23808a 100644 (file)
@@ -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. */