diff options
author | Sage Weil <sage@newdream.net> | 2010-08-24 08:44:16 -0700 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-08-24 16:24:18 -0700 |
commit | 7d8cb26d7dcb911f110b7762bd5941e8f009d6c3 (patch) | |
tree | 2adf2f6303cc96ff14c951dc6966f68a0fc3cf25 /fs/ceph/snap.c | |
parent | 07a27e226d1ed210d2d4218bd0642b40f5405c6a (diff) | |
download | op-kernel-dev-7d8cb26d7dcb911f110b7762bd5941e8f009d6c3.zip op-kernel-dev-7d8cb26d7dcb911f110b7762bd5941e8f009d6c3.tar.gz |
ceph: maintain i_head_snapc when any caps are dirty, not just for data
We used to use i_head_snapc to keep track of which snapc the current epoch
of dirty data was dirtied under. It is used by queue_cap_snap to set up
the cap_snap. However, since we queue cap snaps for any dirty caps, not
just for dirty file data, we need to keep a valid i_head_snapc anytime
we have dirty|flushing caps. This fixes a NULL pointer deref in
queue_cap_snap when writing back dirty caps without data (e.g.,
snaptest-authwb.sh).
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/snap.c')
-rw-r--r-- | fs/ceph/snap.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 6bdbf3a..4868b9d 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -458,6 +458,8 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) CEPH_CAP_FILE_EXCL|CEPH_CAP_FILE_WR))) { struct ceph_snap_context *snapc = ci->i_head_snapc; + dout("queue_cap_snap %p cap_snap %p queuing under %p\n", inode, + capsnap, snapc); igrab(inode); atomic_set(&capsnap->nref, 1); @@ -489,7 +491,9 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) capsnap->dirty_pages = ci->i_wrbuffer_ref_head; ci->i_wrbuffer_ref_head = 0; capsnap->context = snapc; - ci->i_head_snapc = NULL; + ci->i_head_snapc = + ceph_get_snap_context(ci->i_snap_realm->cached_context); + dout(" new snapc is %p\n", ci->i_head_snapc); list_add_tail(&capsnap->ci_item, &ci->i_cap_snaps); if (used & CEPH_CAP_FILE_WR) { |