We only want to do a null snapflush if we _know_ there isn't another one
coming: that is, there aren't any outstanding issued excl/wr cap bits at
the client. The old test has the bitwise NOT backwards. We can also
limit the test to the bits we care about.
This (usually) reproduced a bug where:
- we write a big file
- snap it
- remove it. this makes the mds cow it.
- cp the snapped version.
- mds syncs the head
- client starts writeback
- (sometimes!) client sends other caps back to the mds
- mds does null flushsnap, not realizing a real one is still coming
The problem is that we may be rdlocking items with a different auth than
the main item we are modifying, so forwarding based on lock state is
inconsistent with our requirement that we be on the modified item's auth.
Either we can somehow mark whether the locked item is the "main thing" we
are operating on, or we can drop the forward behavior from the locker and
put any forwarding heuristics elsewhere. I'm opting for the latter.
Don't use pick_inode_snap is totally wrong (it depends on the current set
of snaps, etc.).. look up the inode directly via the ino and last snapid,
which we have. Fixes a failure at the assert.
Reported-by: Thomas Mueller <thomas@chaschperli.ch>
Signed-off-by: Sage Weil <sage@newdream.net>
We won't get a flushsnap when the client has EXCL/WR caps but no dirty
data. The MDS needs to release the snapped inode's locks when it gets a
normal update but no FLUSHSNAP.
This lets us issue the most leases/caps possible. It also ensure we can
issue caps in the snapped namespace when we are still on the head inode
(previously, releasing the rdlock twiddled the state, the client didn't
get say Frc, and hung indefinitely).
This mirrors the logic in cc8f5ac47c. Make
the renamed inode first match the destdn to avoid problems down the line.
Do this after we've (potentially) cowed the inode in the journal_cow_dentry
on srcdn.
We can get a dn->first that is greater than the parent dir's seq. Notably,
when we do something like
mkdir foo
mkdir foo/.snap/a
rmdir foo/.snap/a
rmdir foo
Here, the foo dentry has a high seq, and subsequent mkdir foo should make
sure we give the new foo dir inode the same seq (and not a lower one from
the parent). Otherwise, things get confused later on.
add_past_parent hack.
Adjusted pop_projected to invalidate caches if needed, and removed
project_past_parent's deletion of projected snaprealm.
Removed add_past_parent.
For now, delete the projected version of the inode so it matches (or fixes?)
old behavior. Once users have been fixed to use pop_projected_snaprealm et al,
remove that.
The problem is if we revoke caps, nothing is dirty, but we do writeback
because we are adjusting max_size. Then we have to wait for the log to
flush even though the revocation should proceed immediately. To move
things along, flush the log immediately.
This still isn't ideal.. it would be nice to allow the locking to continue
and adjust max_size in parallel, but that isn't always possible, and will
require some more thought.
This just avoids l=-1 from showing up in the logs, makes the logic a bit
cleaner (keeps missing and missing_loc in sync).
Signed-off-by: Sage Weil <sage@newdream.net>
Depend on libgoogle-perftools0, not libtcmalloc-minimal0, since we link
against libtcmalloc, not libtcmalloc-minimal. Duh.
Signed-off-by: Sage Weil <sage@newdream.net>
- If we are non-auth, stick with the snap, and the auth will do the
inference.
- If we are auth, the head had better exist, because our lock is
pinned in an unreadable state for some reason. Assert as much.