Skip to content

Commit 6203fe1

Browse files
committed
mon: block osd pool mksnap for fs pools
Commit 23db15d disabled pool snaps for the rados mksnap path. But ceph osd pool mksnap was an alternate way that pool snaps could be created. This commit disables pool snaps via this alternate path as well. NOTE: Pool-level snaps and fs-level snaps can't co-exist since snap IDs are likely to clash between the two different mechanisms and can result in unintentional data loss when either of the snaps are deleted. Fixes: https://tracker.ceph.com/issues/59552 Signed-off-by: Milind Changire <[email protected]>
1 parent e87b2e0 commit 6203fe1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/mon/OSDMonitor.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13033,6 +13033,12 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
1303313033
if (pp->snap_exists(snapname.c_str())) {
1303413034
ss << "pool " << poolstr << " snap " << snapname << " already exists";
1303513035
} else {
13036+
if (const auto& fsmap = mon.mdsmon()->get_fsmap(); fsmap.pool_in_use(pool)) {
13037+
dout(20) << "pool-level snapshots have been disabled for pools "
13038+
"attached to an fs - poolid:" << pool << dendl;
13039+
err = -EOPNOTSUPP;
13040+
goto reply;
13041+
}
1303613042
pp->add_snap(snapname.c_str(), ceph_clock_now());
1303713043
pp->set_snap_epoch(pending_inc.epoch);
1303813044
ss << "created pool " << poolstr << " snap " << snapname;

0 commit comments

Comments
 (0)