aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2015-07-19 21:50:58 -0400
committerIlya Dryomov <idryomov@gmail.com>2015-07-31 04:38:53 -0400
commitfc927cd32feca2acefd90a4ac317fa4f0a2e5955 (patch)
treed3b9294d5c7ed7f4fef3b261a2d7e4f27ca8a582 /fs/ceph
parentf6762cb2ca48e9052b5233c338fa254fa58d8981 (diff)
ceph: always re-send cap flushes when MDS recovers
commit e548e9b93d3e565e42b938a99804114565be1f81 makes the kclient only re-send cap flush once during MDS failover. If the kclient sends a cap flush after MDS enters reconnect stage but before MDS recovers. The kclient will skip re-sending the same cap flush when MDS recovers. This causes problem for newly created inode. The MDS handles cap flushes before replaying unsafe requests, so it's possible that MDS find corresponding inode is missing when handling cap flush. The fix is reverting to old behaviour: always re-send when MDS recovers Signed-off-by: Yan, Zheng <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/caps.c22
-rw-r--r--fs/ceph/super.h1
2 files changed, 5 insertions, 18 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index dc10c9dd36c1..ddd5e9471290 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1506,7 +1506,6 @@ static int __mark_caps_flushing(struct inode *inode,
1506 1506
1507 swap(cf, ci->i_prealloc_cap_flush); 1507 swap(cf, ci->i_prealloc_cap_flush);
1508 cf->caps = flushing; 1508 cf->caps = flushing;
1509 cf->kick = false;
1510 1509
1511 spin_lock(&mdsc->cap_dirty_lock); 1510 spin_lock(&mdsc->cap_dirty_lock);
1512 list_del_init(&ci->i_dirty_item); 1511 list_del_init(&ci->i_dirty_item);
@@ -2123,8 +2122,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc,
2123 2122
2124static int __kick_flushing_caps(struct ceph_mds_client *mdsc, 2123static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
2125 struct ceph_mds_session *session, 2124 struct ceph_mds_session *session,
2126 struct ceph_inode_info *ci, 2125 struct ceph_inode_info *ci)
2127 bool kick_all)
2128{ 2126{
2129 struct inode *inode = &ci->vfs_inode; 2127 struct inode *inode = &ci->vfs_inode;
2130 struct ceph_cap *cap; 2128 struct ceph_cap *cap;
@@ -2150,9 +2148,7 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
2150 2148
2151 for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) { 2149 for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) {
2152 cf = rb_entry(n, struct ceph_cap_flush, i_node); 2150 cf = rb_entry(n, struct ceph_cap_flush, i_node);
2153 if (cf->tid < first_tid) 2151 if (cf->tid >= first_tid)
2154 continue;
2155 if (kick_all || cf->kick)
2156 break; 2152 break;
2157 } 2153 }
2158 if (!n) { 2154 if (!n) {
@@ -2161,7 +2157,6 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
2161 } 2157 }
2162 2158
2163 cf = rb_entry(n, struct ceph_cap_flush, i_node); 2159 cf = rb_entry(n, struct ceph_cap_flush, i_node);
2164 cf->kick = false;
2165 2160
2166 first_tid = cf->tid + 1; 2161 first_tid = cf->tid + 1;
2167 2162
@@ -2181,8 +2176,6 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc,
2181{ 2176{
2182 struct ceph_inode_info *ci; 2177 struct ceph_inode_info *ci;
2183 struct ceph_cap *cap; 2178 struct ceph_cap *cap;
2184 struct ceph_cap_flush *cf;
2185 struct rb_node *n;
2186 2179
2187 dout("early_kick_flushing_caps mds%d\n", session->s_mds); 2180 dout("early_kick_flushing_caps mds%d\n", session->s_mds);
2188 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { 2181 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) {
@@ -2205,16 +2198,11 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc,
2205 if ((cap->issued & ci->i_flushing_caps) != 2198 if ((cap->issued & ci->i_flushing_caps) !=
2206 ci->i_flushing_caps) { 2199 ci->i_flushing_caps) {
2207 spin_unlock(&ci->i_ceph_lock); 2200 spin_unlock(&ci->i_ceph_lock);
2208 if (!__kick_flushing_caps(mdsc, session, ci, true)) 2201 if (!__kick_flushing_caps(mdsc, session, ci))
2209 continue; 2202 continue;
2210 spin_lock(&ci->i_ceph_lock); 2203 spin_lock(&ci->i_ceph_lock);
2211 } 2204 }
2212 2205
2213 for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) {
2214 cf = rb_entry(n, struct ceph_cap_flush, i_node);
2215 cf->kick = true;
2216 }
2217
2218 spin_unlock(&ci->i_ceph_lock); 2206 spin_unlock(&ci->i_ceph_lock);
2219 } 2207 }
2220} 2208}
@@ -2228,7 +2216,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc,
2228 2216
2229 dout("kick_flushing_caps mds%d\n", session->s_mds); 2217 dout("kick_flushing_caps mds%d\n", session->s_mds);
2230 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { 2218 list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) {
2231 int delayed = __kick_flushing_caps(mdsc, session, ci, false); 2219 int delayed = __kick_flushing_caps(mdsc, session, ci);
2232 if (delayed) { 2220 if (delayed) {
2233 spin_lock(&ci->i_ceph_lock); 2221 spin_lock(&ci->i_ceph_lock);
2234 __cap_delay_requeue(mdsc, ci); 2222 __cap_delay_requeue(mdsc, ci);
@@ -2261,7 +2249,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc,
2261 2249
2262 spin_unlock(&ci->i_ceph_lock); 2250 spin_unlock(&ci->i_ceph_lock);
2263 2251
2264 delayed = __kick_flushing_caps(mdsc, session, ci, true); 2252 delayed = __kick_flushing_caps(mdsc, session, ci);
2265 if (delayed) { 2253 if (delayed) {
2266 spin_lock(&ci->i_ceph_lock); 2254 spin_lock(&ci->i_ceph_lock);
2267 __cap_delay_requeue(mdsc, ci); 2255 __cap_delay_requeue(mdsc, ci);
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 860cc016e70d..2f2460d23a06 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -189,7 +189,6 @@ static inline void ceph_put_cap_snap(struct ceph_cap_snap *capsnap)
189struct ceph_cap_flush { 189struct ceph_cap_flush {
190 u64 tid; 190 u64 tid;
191 int caps; 191 int caps;
192 bool kick;
193 struct rb_node g_node; // global 192 struct rb_node g_node; // global
194 union { 193 union {
195 struct rb_node i_node; // inode 194 struct rb_node i_node; // inode