Previously, reset_last_warm_restart was only invoked when handle_create
was used. This misses cases where the pg is initialized via a Notify,
Log, or Info message. reset_last_warm_restart will now be called from
the Initial state exit handler in order to handle the other cases.
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
We instantiate the stray dirfrags without reading the fragstat off of disk
because it's faster, we know the dentry is unique, and we don't care about
the stats. It can lead to inconsistency between the dirfrag frag/rstat
and the inodes, though. Silently clean it up when we hit it; that's
simpler than not maintaining it at all for those directories.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Like loner_caps, xlocker_caps are additional caps to the any caps.
In practical terms, this only affects (currently) the LOCK_XLOCKDONE state
for the filelock, where it's less work than making sure what is in the any
column is also |'d onto the xlocker column. Easier to read :)
Signed-off-by: Sage Weil <sage@newdream.net>
If we are in xlockdone, only the client holding that xlock can adjus the
lock state (e.g., relock). Other clients have to wait until the xlock
cycle unwinds completely.
Fixes: #1417
Signed-off-by: Sage Weil <sage@newdream.net>
We were missing truncate_pending++ in O_TRUNC path. Use a common helper.
Pass old_size on O_TRUNC open. (This was the real bug we worked around in
79db9fc509933429f4a8f4aca6d3da5517c43d1f.)
Only do an actual truncate if old_size > 0.
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
Filter out section list to sections that define a given key or that
set a key to a given value.
This is useful to, for example, filter out sections mapped to the current
host.
Signed-off-by: Sage Weil <sage@newdream.net>
This allows us to (safely) do fsync vs sync optimizations. The old code
would write values to the final names and then sync(2), but a crash in
between could leave 0-length (non-temporary) files and crash.
Fixes: #1414
Signed-off-by: Sage Weil <sage@newdream.net>
This will commit a big batch of values safely. We push it down into
MonitorStore so we can avoid an fsync(2) per file.
Signed-off-by: Sage Weil <sage@newdream.net>
Do not dereference acting[0] unless we know it is still valid.
Take a reference when scheduling the transaction, and drop it in the
completion, to ensure that the PG isn't removed out from underneath us.
Fixes: #1379
Signed-off-by: Sage Weil <sage@newdream.net>