summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2013-09-22 11:08:14 +0800
committerSage Weil <sage@inktank.com>2013-11-23 11:01:02 -0800
commit99a9c273b94a087f8feaec6c5ffbe3205a2dbe51 (patch)
treec02a8c512356b2a9ae76e18558e5b59a75458868 /fs/ceph/caps.c
parent44c99757fae80e9db058e1f1d7419cf6472e9af1 (diff)
downloadop-kernel-dev-99a9c273b94a087f8feaec6c5ffbe3205a2dbe51.zip
op-kernel-dev-99a9c273b94a087f8feaec6c5ffbe3205a2dbe51.tar.gz
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 d2d6e40..3c0a4bd 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)
/* remove from session list */
spin_lock(&session->s_cap_lock);
- if (queue_release)
+ /*
+ * s_cap_reconnect is protected by s_cap_lock. no one changes
+ * s_cap_gen while session is in the reconnect state.
+ */
+ if (queue_release &&
+ (!session->s_cap_reconnect ||
+ cap->cap_gen == session->s_cap_gen))
__queue_cap_release(session, ci->i_vino.ino, cap->cap_id,
cap->mseq, cap->issue_seq);
OpenPOWER on IntegriCloud