Skip to content

Commit d2386e8

Browse files
committed
mds: Fix invalid access of mdr->dn[0].back()
See ceph#31534 for a similar fix. Fixes: https://tracker.ceph.com/issues/69059 Signed-off-by: Anoop C S <[email protected]>
1 parent 5a2a3a6 commit d2386e8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mds/Server.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,7 +4167,7 @@ void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup)
41674167

41684168
if (r < 0) {
41694169
// fall-thru. let rdlock_path_pin_ref() check again.
4170-
} else if (is_lookup) {
4170+
} else if (is_lookup && mdr->dn[0].size()) {
41714171
CDentry* dn = mdr->dn[0].back();
41724172
mdr->pin(dn);
41734173
auto em = dn->batch_ops.emplace(std::piecewise_construct, std::forward_as_tuple(mask), std::forward_as_tuple());
@@ -4274,7 +4274,7 @@ void Server::handle_client_getattr(const MDRequestRef& mdr, bool is_lookup)
42744274
// reply
42754275
dout(10) << "reply to stat on " << *req << dendl;
42764276
mdr->tracei = ref;
4277-
if (is_lookup)
4277+
if (is_lookup && mdr->dn[0].size())
42784278
mdr->tracedn = mdr->dn[0].back();
42794279
respond_to_request(mdr, 0);
42804280
}

0 commit comments

Comments
 (0)