diff options
author | Yan, Zheng <zyan@redhat.com> | 2016-07-05 04:45:21 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-07-27 21:00:43 -0400 |
commit | 13c2b57d81ec27716b9c943fd4077264b9804e55 (patch) | |
tree | cc818793a1c35b548c4f57ec0dcf47c66fbc55bf /fs/ceph/caps.c | |
parent | 0e2943878942aee7100c94d0d40c49087dac12cb (diff) |
ceph: avoid sending duplicated cap flush message
make ceph_kick_flushing_caps() ignore inodes whose cap flushes
have already been re-sent by ceph_early_kick_flushing_caps()
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 0ac604719663..f12d59d26a04 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2107,8 +2107,11 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
2107 | */ | 2107 | */ |
2108 | if ((cap->issued & ci->i_flushing_caps) != | 2108 | if ((cap->issued & ci->i_flushing_caps) != |
2109 | ci->i_flushing_caps) { | 2109 | ci->i_flushing_caps) { |
2110 | ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; | ||
2110 | __kick_flushing_caps(mdsc, session, ci, | 2111 | __kick_flushing_caps(mdsc, session, ci, |
2111 | oldest_flush_tid); | 2112 | oldest_flush_tid); |
2113 | } else { | ||
2114 | ci->i_ceph_flags |= CEPH_I_KICK_FLUSH; | ||
2112 | } | 2115 | } |
2113 | 2116 | ||
2114 | spin_unlock(&ci->i_ceph_lock); | 2117 | spin_unlock(&ci->i_ceph_lock); |
@@ -2119,6 +2122,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
2119 | struct ceph_mds_session *session) | 2122 | struct ceph_mds_session *session) |
2120 | { | 2123 | { |
2121 | struct ceph_inode_info *ci; | 2124 | struct ceph_inode_info *ci; |
2125 | struct ceph_cap *cap; | ||
2122 | u64 oldest_flush_tid; | 2126 | u64 oldest_flush_tid; |
2123 | 2127 | ||
2124 | dout("kick_flushing_caps mds%d\n", session->s_mds); | 2128 | dout("kick_flushing_caps mds%d\n", session->s_mds); |
@@ -2129,7 +2133,18 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
2129 | 2133 | ||
2130 | list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { | 2134 | list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { |
2131 | spin_lock(&ci->i_ceph_lock); | 2135 | spin_lock(&ci->i_ceph_lock); |
2132 | __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); | 2136 | cap = ci->i_auth_cap; |
2137 | if (!(cap && cap->session == session)) { | ||
2138 | pr_err("%p auth cap %p not mds%d ???\n", | ||
2139 | &ci->vfs_inode, cap, session->s_mds); | ||
2140 | spin_unlock(&ci->i_ceph_lock); | ||
2141 | continue; | ||
2142 | } | ||
2143 | if (ci->i_ceph_flags & CEPH_I_KICK_FLUSH) { | ||
2144 | ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; | ||
2145 | __kick_flushing_caps(mdsc, session, ci, | ||
2146 | oldest_flush_tid); | ||
2147 | } | ||
2133 | spin_unlock(&ci->i_ceph_lock); | 2148 | spin_unlock(&ci->i_ceph_lock); |
2134 | } | 2149 | } |
2135 | } | 2150 | } |
@@ -2154,6 +2169,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
2154 | oldest_flush_tid = __get_oldest_flush_tid(mdsc); | 2169 | oldest_flush_tid = __get_oldest_flush_tid(mdsc); |
2155 | spin_unlock(&mdsc->cap_dirty_lock); | 2170 | spin_unlock(&mdsc->cap_dirty_lock); |
2156 | 2171 | ||
2172 | ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH; | ||
2157 | __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); | 2173 | __kick_flushing_caps(mdsc, session, ci, oldest_flush_tid); |
2158 | spin_unlock(&ci->i_ceph_lock); | 2174 | spin_unlock(&ci->i_ceph_lock); |
2159 | } else { | 2175 | } else { |