From: Sam Lang Date: Fri, 12 Apr 2013 16:08:35 +0000 (-0500) Subject: client: Fix inode remove from snaprealm race X-Git-Tag: v0.61~197 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a84ddbd30ef3cc105053f272819c2f1ea2be0d2;p=ceph.git client: Fix inode remove from snaprealm race This is a follow on fix to b5ce4d0. Always remove the inode from the snaprealm's list of inodes_with_caps before the snaprealm ref is decremented (and the snaprealm potentially gets freed). Fixes #4694. Signed-off-by: Sam Lang Reviewed-by: Greg Farnum --- diff --git a/src/client/Client.cc b/src/client/Client.cc index aae22ffa980d..3bc8c5bfa9a0 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1948,9 +1948,9 @@ void Client::send_reconnect(MetaSession *session) in->exporting_mseq = 0; if (!in->is_any_caps()) { ldout(cct, 10) << " removing last cap, closing snaprealm" << dendl; + in->snaprealm_item.remove_myself(); put_snap_realm(in->snaprealm); in->snaprealm = 0; - in->snaprealm_item.remove_myself(); } } } @@ -3257,8 +3257,8 @@ void Client::handle_snap(MClientSnap *m) // queue for snap writeback queue_cap_snap(in, in->snaprealm->get_snap_context().seq); - put_snap_realm(in->snaprealm); in->snaprealm_item.remove_myself(); + put_snap_realm(in->snaprealm); to_move.push_back(in); } }