| 482 | } |
| 483 | |
| 484 | bool MgrStatMonitor::preprocess_statfs(MonOpRequestRef op) |
| 485 | { |
| 486 | op->mark_pgmon_event(__func__); |
| 487 | auto statfs = op->get_req<MStatfs>(); |
| 488 | auto session = op->get_session(); |
| 489 | |
| 490 | if (!session) |
| 491 | return true; |
| 492 | if (!session->is_capable("pg", MON_CAP_R)) { |
| 493 | dout(0) << "MStatfs received from entity with insufficient privileges " |
| 494 | << session->caps << dendl; |
| 495 | return true; |
| 496 | } |
| 497 | if (statfs->fsid != mon.monmap->fsid) { |
| 498 | dout(0) << __func__ << " on fsid " << statfs->fsid |
| 499 | << " != " << mon.monmap->fsid << dendl; |
| 500 | return true; |
| 501 | } |
| 502 | const auto& pool = statfs->data_pool; |
| 503 | if (pool && !mon.osdmon()->osdmap.have_pg_pool(*pool)) { |
| 504 | // There's no error field for MStatfsReply so just ignore the request. |
| 505 | // This is known to happen when a client is still accessing a removed fs. |
| 506 | dout(1) << __func__ << " on removed pool " << *pool << dendl; |
| 507 | return true; |
| 508 | } |
| 509 | dout(10) << __func__ << " " << *statfs |
| 510 | << " from " << statfs->get_orig_source() << dendl; |
| 511 | epoch_t ver = get_last_committed(); |
| 512 | auto reply = new MStatfsReply(statfs->fsid, statfs->get_tid(), ver); |
| 513 | reply->h.st = get_statfs(mon.osdmon()->osdmap, pool); |
| 514 | mon.send_reply(op, reply); |
| 515 | return true; |
| 516 | } |
| 517 | |
| 518 | void MgrStatMonitor::check_sub(Subscription *sub) |
| 519 | { |
nothing calls this directly
no test coverage detected