From 62f26b7c41182509cea61848be2f35aa9968cd32 Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov Date: Thu, 28 Jan 2016 18:36:13 +0300 Subject: [PATCH] Make the recovery after a crash during snapshotting easier Added an upstream patch [1] which solves the problem. [1] https://github.com/ceph/ceph/commit/aba6746b850e9397ff25570f08d0af8847a7162c Closes-Bug: #1532967 Change-Id: I987cb9481507a02bf91c4bdd4e8669897c8fdde6 --- debian/changelog | 8 +++ ...le-unexpected-cached_removed_snaps-m.patch | 63 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 72 insertions(+) create mode 100644 debian/patches/PG-activate-handle-unexpected-cached_removed_snaps-m.patch diff --git a/debian/changelog b/debian/changelog index 08ec5bdb..ee0ba3d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +ceph (0.94.5-0u~u14.04+mos3) mos8.0; urgency=medium + + * Added an upstream patch which makes recovery after a crash during + snapshotting easier: https://github.com/ceph/ceph/commit/aba6746b850 + (LP: #1532967) + + -- Alexey Sheplyakov Thu, 28 Jan 2016 18:43:10 +0300 + ceph (0.94.5-0u~u14.04+mos2) mos8.0; urgency=low * Backport upstream patches which fix the ceph-disk vs udev generated diff --git a/debian/patches/PG-activate-handle-unexpected-cached_removed_snaps-m.patch b/debian/patches/PG-activate-handle-unexpected-cached_removed_snaps-m.patch new file mode 100644 index 00000000..f48cec1b --- /dev/null +++ b/debian/patches/PG-activate-handle-unexpected-cached_removed_snaps-m.patch @@ -0,0 +1,63 @@ +From dcbaa3a99bffe7de65d404d21ae447b33cd49282 Mon Sep 17 00:00:00 2001 +From: Alexey Sheplyakov +Date: Thu, 21 Jan 2016 09:42:09 +0300 +Subject: [PATCH] PG::activate(): handle unexpected cached_removed_snaps more + gracefully + +PGPool::update(): ditto + +Fixes: #14538 + +Signed-off-by: Alexey Sheplyakov + +(cherry-picked from commit aba6746b850e9397ff25570f08d0af8847a7162c) +--- + src/osd/PG.cc | 25 ++++++++++++++++++++++--- + 1 file changed, 22 insertions(+), 3 deletions(-) + +diff --git a/src/osd/PG.cc b/src/osd/PG.cc +index c6b1d27..c08ad5d 100644 +--- a/src/osd/PG.cc ++++ b/src/osd/PG.cc +@@ -158,8 +158,18 @@ void PGPool::update(OSDMapRef map) + name = map->get_pool_name(id); + if (pi->get_snap_epoch() == map->get_epoch()) { + pi->build_removed_snaps(newly_removed_snaps); +- newly_removed_snaps.subtract(cached_removed_snaps); +- cached_removed_snaps.union_of(newly_removed_snaps); ++ interval_set intersection; ++ intersection.intersection_of(newly_removed_snaps, cached_removed_snaps); ++ if (intersection == cached_removed_snaps) { ++ newly_removed_snaps.subtract(cached_removed_snaps); ++ cached_removed_snaps.union_of(newly_removed_snaps); ++ } else { ++ lgeneric_subdout(g_ceph_context, osd, 0) << __func__ ++ << " cached_removed_snaps shrank from " << cached_removed_snaps ++ << " to " << newly_removed_snaps << dendl; ++ cached_removed_snaps = newly_removed_snaps; ++ newly_removed_snaps.clear(); ++ } + snapc = pi->get_snap_context(); + } else { + newly_removed_snaps.clear(); +@@ -1550,7 +1560,16 @@ void PG::activate(ObjectStore::Transaction& t, + dout(20) << "activate - purged_snaps " << info.purged_snaps + << " cached_removed_snaps " << pool.cached_removed_snaps << dendl; + snap_trimq = pool.cached_removed_snaps; +- snap_trimq.subtract(info.purged_snaps); ++ interval_set intersection; ++ intersection.intersection_of(snap_trimq, info.purged_snaps); ++ if (intersection == info.purged_snaps) { ++ snap_trimq.subtract(info.purged_snaps); ++ } else { ++ dout(0) << "warning: info.purged_snaps (" << info.purged_snaps ++ << ") is not a subset of pool.cached_removed_snaps (" ++ << pool.cached_removed_snaps << ")" << dendl; ++ snap_trimq.subtract(intersection); ++ } + dout(10) << "activate - snap_trimq " << snap_trimq << dendl; + if (!snap_trimq.empty() && is_clean()) + queue_snap_trim(); +-- +1.9.1 + diff --git a/debian/patches/series b/debian/patches/series index c7a88511..55563bd1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -15,3 +15,4 @@ ceph-osd-prestart-path.patch fix-argparse-defaults.patch fix-cycles-arch.patch vivid-does-systemd.patch +PG-activate-handle-unexpected-cached_removed_snaps-m.patch -- 2.45.2