From 4a84ddbd30ef3cc105053f272819c2f1ea2be0d2 Mon Sep 17 00:00:00 2001 From: Sam Lang Date: Fri, 12 Apr 2013 11:08:35 -0500 Subject: [PATCH] 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 --- src/client/Client.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index aae22ffa980..3bc8c5bfa9a 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); } } -- 2.47.3