Skip to content

Commit

Permalink
ceph: fix queuing inode to mdsdir's snaprealm
Browse files Browse the repository at this point in the history
During MDS failovers, MClientSnap message may cause kclient to move
some inodes from root directory's snaprealm to mdsdir's snaprealm
and queue snapshots for these inodes. For a FS has never created any
snapshot, both root directory's snaprealm and mdsdir's snaprealm
share the same snapshot contexts (both are ceph_empty_snapc). This
confuses ceph_put_wrbuffer_cap_refs(), make it unable to distinguish
snapshot buffers from head buffers.

The fix is do not use ceph_empty_snapc as snaprealm's cached context.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
  • Loading branch information
Yan, Zheng authored and Ilya Dryomov committed Sep 8, 2015
1 parent 6893162 commit 2307863
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions fs/ceph/snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,6 @@ static int build_snap_context(struct ceph_snap_realm *realm)
return 0;
}

if (num == 0 && realm->seq == ceph_empty_snapc->seq) {
ceph_get_snap_context(ceph_empty_snapc);
snapc = ceph_empty_snapc;
goto done;
}

/* alloc new snap context */
err = -ENOMEM;
if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64))
Expand Down Expand Up @@ -381,7 +375,6 @@ static int build_snap_context(struct ceph_snap_realm *realm)
realm->ino, realm, snapc, snapc->seq,
(unsigned int) snapc->num_snaps);

done:
ceph_put_snap_context(realm->cached_context);
realm->cached_context = snapc;
return 0;
Expand Down

0 comments on commit 2307863

Please sign in to comment.