return true;
}
+/* Mark an object as lost
+ */
+void PG::mark_obj_as_lost(ObjectStore::Transaction& t,
+ const sobject_t &lost_soid)
+{
+ // Wake anyone waiting for this object. Now that it's been marked as lost,
+ // we will just return an error code.
+ hash_map<sobject_t, list<class Message*> >::iterator wmo =
+ waiting_for_missing_object.find(lost_soid);
+ if (wmo != waiting_for_missing_object.end()) {
+ osd->take_waiters(wmo->second);
+ }
+
+ // Erase from the missing and missing_loc set.
+ missing.missing.erase(lost_soid);
+ missing_loc.erase(lost_soid);
+
+ // Tell the object store that this object is lost.
+ bufferlist b1;
+ int r = osd->store->getattr(coll_t(info.pgid), lost_soid, OI_ATTR, b1);
+ assert(r >= 0);
+ object_info_t oi(b1);
+ oi.lost = true;
+ oi.version.version++;
+ bufferlist b2;
+ oi.encode(b2);
+ t.setattr(coll_t(info.pgid), lost_soid, OI_ATTR, b2);
+}
+
class CompareSobjectPtrs {
public:
bool operator()(const sobject_t *a, const sobject_t *b) {
/* Mark all unfound objects as lost.
*/
-void PG::mark_all_unfound_as_lost()
+void PG::mark_all_unfound_as_lost(ObjectStore::Transaction& t)
{
dout(3) << __func__ << dendl;
dout(10) << __func__ << ": created event " << e << dendl;
- // Wake anyone waiting for this object. Now that it's been marked as lost,
- // we will just return an error code.
- hash_map<sobject_t, list<class Message*> >::iterator wmo =
- waiting_for_missing_object.find(lost_soid);
- if (wmo != waiting_for_missing_object.end()) {
- osd->take_waiters(wmo->second);
- }
-
- missing.missing.erase(lost_soid);
+ mark_obj_as_lost(t, lost_soid);
del.erase(d++);
}
void clear_prior();
bool prior_set_affected(OSDMap *map);
+
bool all_unfound_are_lost(const OSDMap* osdmap) const;
- void mark_all_unfound_as_lost();
+ void mark_obj_as_lost(ObjectStore::Transaction& t,
+ const sobject_t &lost_soid);
+ void mark_all_unfound_as_lost(ObjectStore::Transaction& t);
bool calc_min_last_complete_ondisk() {
eversion_t min = last_complete_ondisk;
dout(10) << "do_op " << *op << dendl;
if (finalizing_scrub && op->may_write()) {
+ dout(20) << __func__ << ": waiting for scrub" << dendl;
waiting_for_active.push_back(op);
return;
}
if ((op->may_read()) && (obc->obs.oi.lost)) {
// This object is lost. Reading from it returns an error.
+ dout(20) << __func__ << ": object " << obc->obs.oi.soid
+ << " is lost" << dendl;
osd->reply_op_error(op, -ENFILE);
return;
}
+ dout(25) << __func__ << ": object " << obc->obs.oi.soid
+ << " has oi of " << obc->obs.oi << dendl;
bool ok;
dout(10) << "do_op mode is " << mode << dendl;