mirror of
https://github.com/ceph/ceph
synced 2024-12-16 08:26:25 +00:00
osd: fix scrub scheduling for 0.0
The initial value for pair<utime_t,pg_t> can match pg 0.0, preventing it from being manually scrubbed. Fix! Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
389bed5d33
commit
26a63df97b
@ -3575,9 +3575,11 @@ void OSD::sched_scrub()
|
||||
//dout(20) << " " << last_scrub_pg << dendl;
|
||||
|
||||
pair<utime_t, pg_t> pos;
|
||||
while (service.next_scrub_stamp(pos, &pos)) {
|
||||
if (service.first_scrub_stamp(&pos)) {
|
||||
do {
|
||||
utime_t t = pos.first;
|
||||
pg_t pgid = pos.second;
|
||||
dout(30) << " " << pgid << " at " << t << dendl;
|
||||
|
||||
if (t > min) {
|
||||
dout(10) << " " << pgid << " at " << t
|
||||
@ -3597,7 +3599,7 @@ void OSD::sched_scrub()
|
||||
pg->scrubber.must_scrub)) {
|
||||
dout(10) << " " << pgid << " at " << t
|
||||
<< (pg->scrubber.must_scrub ? ", explicitly requested" : "")
|
||||
<< (t < max ? ", last_scrub > max" : "")
|
||||
<< (t < max ? ", last_scrub < max" : "")
|
||||
<< dendl;
|
||||
if (pg->sched_scrub()) {
|
||||
pg->unlock();
|
||||
@ -3606,6 +3608,7 @@ void OSD::sched_scrub()
|
||||
}
|
||||
pg->unlock();
|
||||
}
|
||||
} while (service.next_scrub_stamp(pos, &pos));
|
||||
}
|
||||
dout(20) << "sched_scrub done" << dendl;
|
||||
}
|
||||
|
@ -255,17 +255,29 @@ public:
|
||||
void unreg_last_pg_scrub(pg_t pgid, utime_t t) {
|
||||
Mutex::Locker l(sched_scrub_lock);
|
||||
pair<utime_t,pg_t> p(t, pgid);
|
||||
assert(last_scrub_pg.count(p));
|
||||
last_scrub_pg.erase(p);
|
||||
set<pair<utime_t,pg_t> >::iterator it = last_scrub_pg.find(p);
|
||||
assert(it != last_scrub_pg.end());
|
||||
last_scrub_pg.erase(it);
|
||||
}
|
||||
bool next_scrub_stamp(pair<utime_t, pg_t> after,
|
||||
bool first_scrub_stamp(pair<utime_t, pg_t> *out) {
|
||||
Mutex::Locker l(sched_scrub_lock);
|
||||
if (last_scrub_pg.size() == 0)
|
||||
return false;
|
||||
set< pair<utime_t, pg_t> >::iterator iter = last_scrub_pg.begin();
|
||||
*out = *iter;
|
||||
return true;
|
||||
}
|
||||
bool next_scrub_stamp(pair<utime_t, pg_t> next,
|
||||
pair<utime_t, pg_t> *out) {
|
||||
Mutex::Locker l(sched_scrub_lock);
|
||||
if (last_scrub_pg.size() == 0) return false;
|
||||
set< pair<utime_t, pg_t> >::iterator iter = last_scrub_pg.lower_bound(after);
|
||||
if (iter == last_scrub_pg.end()) return false;
|
||||
if (last_scrub_pg.size() == 0)
|
||||
return false;
|
||||
set< pair<utime_t, pg_t> >::iterator iter = last_scrub_pg.lower_bound(next);
|
||||
if (iter == last_scrub_pg.end())
|
||||
return false;
|
||||
++iter;
|
||||
if (iter == last_scrub_pg.end()) return false;
|
||||
if (iter == last_scrub_pg.end())
|
||||
return false;
|
||||
*out = *iter;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user