This way when we're confident it works right, we can
remove the set<Context*> and just rely on ref counting.
Further optimizations would include using a spinlock
rather than a mutex, or possibly even just switching
sub_[created|existing]_count to be atomics.
Signed-off-by: Greg Farnum <gregf@hq.newdream.net>
Previously, C_Gather wasn't thread safe at all,
and there was an issue with creating subs while some
subs were being finished.
These issues are now fixed.
Signed-off-by: Greg Farnum <gregf@hq.newdream.net>
JournalingObjectStore::commit_start should handle the case where journal is
null. This will occur if the user doesn't configure a journal.
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
This comes up when an ESesssion close is followed by an EMetaBlob that
uses a prealloc_ino. That isn't supposed to happen (it's probably a corner
case with session timeout vs a request waiting on locks that didn't
get killed/canceled?). But tolerate it during replay just the same.
Works around #708.
Signed-off-by: Sage Weil <sage@newdream.net>
Rewriting the completion handling to be simpler, clearer, so that it is
easier to maintain a strict completion ordering invariant.
This also fixes an ordering bug: When restarting journal, we defer
initially until we get a committed_thru from the previous commit and then
do all those completions. That same logic needs to also apply to new items
submitted during that commit interval. This was broken before, but the
simpler structure fixes it. Fixes#666.
Tested-by: Jim Schutt <jaschut@sandia.gov>
Signed-off-by: Sage Weil <sage@newdream.net>
Previously, activate would queue_snap_trim() for replicas if snap_trimq
ended up non-empty, guaranteeing a crash for any replica starting up
while purged_snaps lagged behind pool->cached_removed_snaps.
This should fix#702.
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
_rollback_to calls _delete_head before cloning the clone into place.
_delete_head sets the object info size to 0. _rollback_to now resets
the size to match the rolled back object. Previously, this bug
manifested as a failed assert in scrub when checking the object sizes.
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
Previously, get_object_context and get_snapset_context did not register
the resulting objects. In some cases, these objects would not get
registered and multiple copies would end up created. This caused a bug
in find_object_context where get_snapset_context could return an object
distinct from the one referenced by the object returned from
get_object_context.
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
Currently, an OSD bug is causing snap_trimq to contain some snaps
already in purged_snaps. This work around should let kvmtest
come back up. A real fix is still needed.
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
Previously, _rollback_to assumed that the rollback was a noop if
ctx->clone_obc was set and it's prior version matches head's version.
However, this broke in sequences like:
Write "snap1 contents" to oid "blah"
create snapshot "snap1"
Write "snap2 contents" to oid "blah"
create snapshot "snap2"
rollback oid "blah" to snapshot "snap1"
In this case, make_writeable would have just cloned head to the snap2
clone, but the relevant clone is actually "snap1". _rollback_to now
verifies that the most recent clone is the correct one before assuming
that head is already correct.
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
Previously, writefull and _delete_head would remove the last
entry from snapset.clone_overlap. Now, the last entry becomes
an empty interval_set. clone_overlap should contain one entry
per clone.
The missing entries previously caused a bug in _rollback_to where
iter would be clone_overlap.end().
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
Previosly, _scrub checked:
assert(p->second.size == snapset.clone_size[curclone])
curclone was, however, an index into snapset.clones rather than a
snapid_t. For clarity, curclone is now an iterator.
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>
If primary or a replica has a mistrimmed pg log, we need to generate the
backlog during peering. This sucks, because the PG won't go active for
a long time, but it's what happens when there's a bug in the code that
mis-trims the PG log!
Signed-off-by: Sage Weil <sage@newdream.net>
If a replica has last_complete < log.tail and no backlog, send enough log
for them to get back into a consistent state.
Signed-off-by: Sage Weil <sage@newdream.net>
If we are auth for the root inode, load it's initial value off of disk. We
may not see it in the log if it has not been modified. If it has, this
is useless but fast/harmless. This only occurs for brand-new filesystems
where the mds is immediately restarted.
Fixes#671.
Signed-off-by: Sage Weil <sage@newdream.net>
Previously we left the mutex locked, which is obviously bad bad bad!
I believe this was the cause of #673.
Signed-off-by: Greg Farnum <gregf@hq.newdream.net>
We only want to wake up if we are at the front of the line, in order to
preserve journal submission pipeline ordering.
This fixes, among other things, messages in the log like
2010-12-21 10:38:42.515974 7f0861486700 journal op_submit_finish 5364 expected 5370, OUT OF ORDER
and bug #666.
Signed-off-by: Sage Weil <sage@newdream.net>
- We don't want to purge file content on directories
- Don't fall over if a file has a zero period
Reported-by: Paul Komkoff <i@stingr.net>
Signed-off-by: Sage Weil <sage@newdream.net>
It seems that we have not been zeroing
PG::Info::History:last_epoch_clean when the History structure is
created. This led to some very interesting log output (and bugs!)
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
Normally we shouldn't ever have a last_complete < log.tail (&& !backlog).
But maybe we do (old bugs, whatever; see #590). In that case, the primary
can compensate by sending more log info to the replica.
Signed-off-by: Sage Weil <sage@newdream.net>
The predirty_journal_parents() calls wrlock_start() with nowait=true
because it has a journal entry open and we don't want to trigger a nested
scatterlock change that needs to journal something again (either
via scatter_writebehind or scatter_start). (MDLog can only handle a single
log entry open at once because building multiple at once would require very
very very careful ordering of predirty() calls and versions.)
We were already check for the simple_lock() case (which may call
writebehind); fix up the check to also cover the scatter_mix() (which may
call scatter_start) case.
Fixes this crash:
mds/MDLog.h: In function 'void MDLog::start_entry(LogEvent*)':
mds/MDLog.h:191: FAILED assert(cur_event == __null)
ceph version 0.24~rc (commit:fe10300317383ec29948d7dbe3cb31b3aa277e3c)
1: (CInode::finish_scatter_update(ScatterLock*, CDir*, unsigned long, unsigned long)+0x804) [0x606e14]
2: (CInode::start_scatter(ScatterLock*)+0xaa) [0x60dc1a]
3: (Locker::scatter_mix(ScatterLock*, bool*)+0x1ca) [0x589a9a]
4: (Locker::wrlock_start(SimpleLock*, MDRequest*, bool)+0x165) [0x597d65]
5: (MDCache::predirty_journal_parents(Mutation*, EMetaBlob*, CInode*, CDir*, int, int, snapid_t)+0x153e) [0x55a70e]
6: (Locker::scatter_writebehind(ScatterLock*)+0x42d) [0x58553d]
7: (Locker::simple_lock(SimpleLock*, bool*)+0x7ab) [0x58beeb]
8: (Locker::scatter_nudge(ScatterLock*, Context*, bool)+0x3ad) [0x58c49d]
9: (Locker::scatter_tick()+0x28a) [0x58c98a]
10: (MDS::tick()+0x4e4) [0x4b26a4]
11: (SafeTimer::timer_thread()+0x22c) [0x6d164c]
12: (SafeTimerThread::entry()+0xd) [0x6d34bd]
13: (Thread::_entry_func(void*)+0xa) [0x4943da]
14: /lib/libpthread.so.0 [0x7fc87810b73a]
15: (clone()+0x6d) [0x7fc876dad69d]
Signed-off-by: Sage Weil <sage@newdream.net>
It was only waiting for items in the op_queue to complete. The goal is
to wait for anything we've called queue_transactions(&osr,...) on. If we
do writeahead journaling, though, there might be new ops that are still
journaling but not yet submitted to the fs that are missed.
This adds a journal queue to the OpSequencer, and uses it in the writeahead
case only.
Signed-off-by: Sage Weil <sage@newdream.net>
common_init: avoid (mismatched) heap allocation
ConfFile::_parse: avoid memory leak on error path
ConfFile: NULL filename if not set, rather than leaving it undefined
Signed-off-by: Colin McCabe <colinm@hq.newdream.net>
This avoids two races:
- we just completed recovery by pushing objects to the replica, and the
replica starts scanning before those writes reach the fs.
- we just trimmed to something after last_update_applied.
Signed-off-by: Sage Weil <sage@newdream.net>
sub_op_scrub must set finalizing_scrub on the replica
before waiting for last_update_applied to catch up to
info.last_update.
Signed-off-by: Samuel Just <samuelj@hq.newdream.net>