Skip to content

Commit fc927cd

Browse files
ukernelidryomov
authored andcommitted
ceph: always re-send cap flushes when MDS recovers
commit e548e9b 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 <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent f6762cb commit fc927cd

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

fs/ceph/caps.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,6 @@ static int __mark_caps_flushing(struct inode *inode,
15061506

15071507
swap(cf, ci->i_prealloc_cap_flush);
15081508
cf->caps = flushing;
1509-
cf->kick = false;
15101509

15111510
spin_lock(&mdsc->cap_dirty_lock);
15121511
list_del_init(&ci->i_dirty_item);
@@ -2123,8 +2122,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc,
21232122

21242123
static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
21252124
struct ceph_mds_session *session,
2126-
struct ceph_inode_info *ci,
2127-
bool kick_all)
2125+
struct ceph_inode_info *ci)
21282126
{
21292127
struct inode *inode = &ci->vfs_inode;
21302128
struct ceph_cap *cap;
@@ -2150,9 +2148,7 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
21502148

21512149
for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) {
21522150
cf = rb_entry(n, struct ceph_cap_flush, i_node);
2153-
if (cf->tid < first_tid)
2154-
continue;
2155-
if (kick_all || cf->kick)
2151+
if (cf->tid >= first_tid)
21562152
break;
21572153
}
21582154
if (!n) {
@@ -2161,7 +2157,6 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc,
21612157
}
21622158

21632159
cf = rb_entry(n, struct ceph_cap_flush, i_node);
2164-
cf->kick = false;
21652160

21662161
first_tid = cf->tid + 1;
21672162

@@ -2181,8 +2176,6 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc,
21812176
{
21822177
struct ceph_inode_info *ci;
21832178
struct ceph_cap *cap;
2184-
struct ceph_cap_flush *cf;
2185-
struct rb_node *n;
21862179

21872180
dout("early_kick_flushing_caps mds%d\n", session->s_mds);
21882181
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,
22052198
if ((cap->issued & ci->i_flushing_caps) !=
22062199
ci->i_flushing_caps) {
22072200
spin_unlock(&ci->i_ceph_lock);
2208-
if (!__kick_flushing_caps(mdsc, session, ci, true))
2201+
if (!__kick_flushing_caps(mdsc, session, ci))
22092202
continue;
22102203
spin_lock(&ci->i_ceph_lock);
22112204
}
22122205

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-
22182206
spin_unlock(&ci->i_ceph_lock);
22192207
}
22202208
}
@@ -2228,7 +2216,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc,
22282216

22292217
dout("kick_flushing_caps mds%d\n", session->s_mds);
22302218
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);
22322220
if (delayed) {
22332221
spin_lock(&ci->i_ceph_lock);
22342222
__cap_delay_requeue(mdsc, ci);
@@ -2261,7 +2249,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc,
22612249

22622250
spin_unlock(&ci->i_ceph_lock);
22632251

2264-
delayed = __kick_flushing_caps(mdsc, session, ci, true);
2252+
delayed = __kick_flushing_caps(mdsc, session, ci);
22652253
if (delayed) {
22662254
spin_lock(&ci->i_ceph_lock);
22672255
__cap_delay_requeue(mdsc, ci);

fs/ceph/super.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ static inline void ceph_put_cap_snap(struct ceph_cap_snap *capsnap)
189189
struct ceph_cap_flush {
190190
u64 tid;
191191
int caps;
192-
bool kick;
193192
struct rb_node g_node; // global
194193
union {
195194
struct rb_node i_node; // inode

0 commit comments

Comments
 (0)