ceph: introduce global empty snap context
authorYan, Zheng <zyan@redhat.com>
Thu, 6 Nov 2014 07:09:41 +0000 (15:09 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 20 Feb 2015 00:49:31 +0000 (00:49 +0000)
commit0950c54e08a39180da7527bbd89b05235f6efd3f
tree30ea52cd6226dd4df7a4321ebe1221200c9708f2
parentf7e7d869694bdbf4853f9a2ccb667d3bcfa5b240
ceph: introduce global empty snap context

commit 97c85a828f36bbfffe9d77b977b65a5872b6cad4 upstream.

Current snaphost code does not properly handle moving inode from one
empty snap realm to another empty snap realm. After changing inode's
snap realm, some dirty pages' snap context can be not equal to inode's
i_head_snap. This can trigger BUG() in ceph_put_wrbuffer_cap_refs()

The fix is introduce a global empty snap context for all empty snap
realm. This avoids triggering the BUG() for filesystem with no snapshot.

Fixes: http://tracker.ceph.com/issues/9928

Signed-off-by: Yan, Zheng <zyan@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@redhat.com>
[bwh: Backported to 3.2:
 - Adjust context
 - As we don't have ceph_create_snap_context(), open-code it in
   ceph_snap_init()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ceph/snap.c
fs/ceph/super.c
fs/ceph/super.h