]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix invalid access of mdr->dn[0].back() 31534/head
authorYan, Zheng <zyan@redhat.com>
Mon, 11 Nov 2019 15:28:16 +0000 (23:28 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 11 Nov 2019 15:32:23 +0000 (23:32 +0800)
Introduced by commit 79abdcb31af

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

index e7472abdf812e8bbd7392cb505aa076f322bb462..83106de5122c13fc3cfe3c0ec75763b6ac1be6ff 100644 (file)
@@ -9365,12 +9365,12 @@ void MDCache::request_forward(MDRequestRef& mdr, mds_rank_t who, int port)
          }
        case CEPH_MDS_OP_LOOKUP:
          {
-           CDentry* dn = mdr->dn[0].back();
-           if (dn) {
+           if (mdr->dn[0].size()) {
+             CDentry* dn = mdr->dn[0].back();
              auto it = dn->batch_ops.find(mask);
              if (it != dn->batch_ops.end()) {
-                it->second->forward(who);
-                dn->batch_ops.erase(it);
+               it->second->forward(who);
+               dn->batch_ops.erase(it);
              }
            }
            break;