aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2013-09-21 23:08:14 -0400
committerSage Weil <sage@inktank.com>2013-11-23 14:01:02 -0500
commit99a9c273b94a087f8feaec6c5ffbe3205a2dbe51 (patch)
treec02a8c512356b2a9ae76e18558e5b59a75458868 /fs/ceph/caps.c
parent44c99757fae80e9db058e1f1d7419cf6472e9af1 (diff)
ceph: handle race between cap reconnect and cap release
When a cap get released while composing the cap reconnect message. We should skip queuing the release message if the cap hasn't been added to the cap reconnect message. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index d2d6e40e7345..3c0a4bd74996 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -909,7 +909,13 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
909 909
910 /* remove from session list */ 910 /* remove from session list */
911 spin_lock(&session->s_cap_lock); 911 spin_lock(&session->s_cap_lock);
912 if (queue_release) 912 /*
913 * s_cap_reconnect is protected by s_cap_lock. no one changes
914 * s_cap_gen while session is in the reconnect state.
915 */
916 if (queue_release &&
917 (!session->s_cap_reconnect ||
918 cap->cap_gen == session->s_cap_gen))
913 __queue_cap_release(session, ci->i_vino.ino, cap->cap_id, 919 __queue_cap_release(session, ci->i_vino.ino, cap->cap_id,
914 cap->mseq, cap->issue_seq); 920 cap->mseq, cap->issue_seq);
915 921