]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: properly eval locks after importing inode
authorYan, Zheng <zyan@redhat.com>
Sat, 9 Dec 2017 06:09:24 +0000 (14:09 +0800)
committerYan, Zheng <zyan@redhat.com>
Sat, 9 Dec 2017 07:05:11 +0000 (15:05 +0800)
We should call Locker:eval() for all imported inodes who have non-zero
'wanted caps'. MDS does not properly handle following case.

- client open a inode for read, it send a cap message to MDS.a (the cap
  message updates 'wanted caps')
- MDS.a receive the cap message, the inode is non-auth and is ambiguous
  auth. MDS.a can not request 'wanted caps' from auth mds.
- MDS.a finishes importing the inode from. But no caps are imported and
  mds_caps_wanted map is empty.

The bug can cause read hang.

Fixes: http://tracker.ceph.com/issues/22357
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/Migrator.cc

index b09ecc74d25015a550d5550c65ab62f127833fac..b8379250d6f5995e7a4e50435521c41f76156769 100644 (file)
@@ -3051,7 +3051,7 @@ void Migrator::decode_import_inode_caps(CInode *in, bool auth_cap,
   if (auth_cap)
     ::decode(in->get_mds_caps_wanted(), blp);
   if (!cap_map.empty() ||
-      (auth_cap && !in->get_mds_caps_wanted().empty())) {
+      (auth_cap && (in->get_caps_wanted() & ~CEPH_CAP_PIN))) {
     peer_exports[in].swap(cap_map);
     in->get(CInode::PIN_IMPORTINGCAPS);
   }