New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mds: force client flush snap data before truncating objects #11994
Conversation
Snapshot data get lost if following sequence of events happen - client writes data to a file - make a snapshot - truncate the file - mds truncate file objects using the newest snap context - client flushes snap data using the old snap context OSD first handles MDS's truncate request, it updates object's snap context. When handling client's write request, OSD finds that object's snap context is newer than request's snap context. So it uses the newer one and treats the data as if they were written after the snapshot. The fix is avoid touching file objects while clients may have unflushed snap data. Before truncating file objects, MDS checks if clients may have unflushed snap data. If client have, MDS set filelock to a special unstable state, the state revokes Fb capability. MDS starts truncating file objects after the Fb capability get revoked. Fixes: http://tracker.ceph.com/issues/17193 Signed-off-by: Yan, Zheng <zyan@redhat.com>
/subscribe |
jenkins test this please (eio, now ignored in master) |
jenkins test this please (tox bug, now fixed in master) |
My test branch had a failure in a snapshot test:
|
unrelated bug http://tracker.ceph.com/issues/17990 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good.
if (in->filelock.is_stable()) { | ||
in->auth_pin(&in->filelock); | ||
} else { | ||
assert(in->filelock.get_state() == LOCK_XLOCKSNAP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we still need to auth_pin() the file here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOCK_XLOCKSNAP is unstable state, it was already auth pinned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Greg Farnum gfarnum@redhat.com
if (in->filelock.is_stable()) { | ||
in->auth_pin(&in->filelock); | ||
} else { | ||
assert(in->filelock.get_state() == LOCK_XLOCKSNAP); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Should build a test for this too @ukernel — we don't have much white box testing around recovery or snapshots. |
Snapshot data get lost if following sequence of events happen
OSD first handles MDS's truncate request, it updates object's snap
context. When handling client's write request, OSD finds that
object's snap context is newer than request's snap context. So
it uses the newer one and treats the data as if they were
written after the snapshot.
The fix is avoid touching file objects while clients may have
unflushed snap data. Before truncating file objects, MDS checks
if clients may have unflushed snap data. If client have, MDS
set filelock to a special unstable state, the state revokes Fb
capability. MDS starts truncating file objects after the Fb
capability get revoked.
Fixes: http://tracker.ceph.com/issues/17193
Signed-off-by: Yan, Zheng zyan@redhat.com