From f8a649c0f40f2f7c0a3b957403b5931f5bd4f688 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 9 Jan 2013 22:34:12 -0800 Subject: osd/ReplicatedPG: validate ino when scrubbing snap collections Signed-off-by: Sage Weil --- src/osd/PG.cc | 2 +- src/osd/PG.h | 2 +- src/osd/ReplicatedPG.cc | 5 ++++- src/osd/ReplicatedPG.h | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index bfcdf7e3d90..c38ab0c5fa2 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2687,7 +2687,7 @@ void PG::_scan_list(ScrubMap &map, vector &ls) osd->store->getattrs(coll, poid, o.attrs); if (poid.snap != CEPH_SNAPDIR && poid.snap != CEPH_NOSNAP) { // Check snap collections - check_snap_collections(poid, o.attrs, &o.snapcolls); + check_snap_collections(st.st_ino, poid, o.attrs, &o.snapcolls); } dout(25) << "_scan_list " << poid << dendl; } else { diff --git a/src/osd/PG.h b/src/osd/PG.h index 0354de800c7..d6dc5912c23 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -775,7 +775,7 @@ public: uint32_t nlinks, ostream &out) { return false; }; virtual void check_snap_collections( - const hobject_t &hoid, + ino_t hino, const hobject_t &hoid, const map &attrs, set *snapcolls) {}; void clear_scrub_reserved(); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8b24fc93b96..d6ff0d2917f 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -6682,6 +6682,7 @@ bool ReplicatedPG::_report_snap_collection_errors( } void ReplicatedPG::check_snap_collections( + ino_t hino, const hobject_t &hoid, const map &attrs, set *snapcolls) @@ -6694,7 +6695,9 @@ void ReplicatedPG::check_snap_collections( int r = osd->store->stat(coll_t(info.pgid, *i), hoid, &st); if (r == -ENOENT) { } else if (r == 0) { - snapcolls->insert(*i); + if (hino == st.st_ino) { + snapcolls->insert(*i); + } } else { assert(0); } diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 60aab4b022b..51eaebe0e5f 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -796,7 +796,7 @@ protected: uint32_t nlinks, ostream &out); virtual void check_snap_collections( - const hobject_t &hoid, + ino_t hino, const hobject_t &hoid, const map &attrs, set *snapcolls); -- cgit v1.2.1