From 5ac9f523ea263eeb747e2543a667a25de67d07b8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 15 Sep 2021 19:12:38 -0400 Subject: [PATCH] osd/PrimaryLogPG: drop ops when pool has EIO flag If the op doesn't have the SUPPORTSPOOLEIO flag (i.e., it is an old client), return with an explicit EIO. Signed-off-by: Sage Weil --- src/osd/PrimaryLogPG.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 6b1a3e52f45..fefe60c7477 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -2128,12 +2128,21 @@ void PrimaryLogPG::do_op(OpRequestRef& op) return; } int64_t poolid = get_pgid().pool(); - if (op->may_write()) { - - const pg_pool_t *pi = get_osdmap()->get_pg_pool(poolid); - if (!pi) { - return; + const pg_pool_t *pi = get_osdmap()->get_pg_pool(poolid); + if (!pi) { + return; + } + if (pi->has_flag(pg_pool_t::FLAG_EIO)) { + // drop op on the floor; the client will handle returning EIO + if (m->has_flag(CEPH_OSD_FLAG_SUPPORTSPOOLEIO)) { + dout(10) << __func__ << " discarding op due to pool EIO flag" << dendl; + } else { + dout(10) << __func__ << " replying EIO due to pool EIO flag" << dendl; + osd->reply_op_error(op, -EIO); } + return; + } + if (op->may_write()) { // invalid? if (m->get_snapid() != CEPH_NOSNAP) { -- 2.39.5