]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds: force client flush snap data before truncating objects 12324/head
authorYan, Zheng <zyan@redhat.com>
Tue, 15 Nov 2016 12:59:54 +0000 (20:59 +0800)
committerLoic Dachary <ldachary@redhat.com>
Mon, 5 Dec 2016 15:32:50 +0000 (16:32 +0100)
commite1af490200fcdf6b3f8fb48bc96278f739c2438b
tree081fcb26b25b09a32316551d8aae46197b482449
parent828ac74961a450913d38308c1e37974a29c2539c
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>
(cherry picked from commit 9c65920e7f6febe294e25a67473693ce6f9adfa7)
src/mds/Locker.cc
src/mds/MDCache.cc
src/mds/ScatterLock.h
src/mds/SimpleLock.h
src/mds/locks.c
src/mds/locks.h