]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds: force client flush snap data before truncating objects 11994/head
authorYan, Zheng <zyan@redhat.com>
Tue, 15 Nov 2016 12:59:54 +0000 (20:59 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 15 Nov 2016 13:52:06 +0000 (21:52 +0800)
commit9c65920e7f6febe294e25a67473693ce6f9adfa7
tree117f997f9ff4e862521c2fb5e71884a3f144fccf
parent238fd2ad37d77532698d3a254e102f16951126c0
mds: force client flush snap data before truncating objects

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>
src/mds/Locker.cc
src/mds/MDCache.cc
src/mds/ScatterLock.h
src/mds/SimpleLock.h
src/mds/locks.c
src/mds/locks.h