From 65004d3fbfd0b9b67f6b04256a0affea639de66f Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 13 Jan 2020 11:24:15 +0800 Subject: [PATCH] mds: process re-sent async dir operations at clientreplay stage Signed-off-by: "Yan, Zheng" --- src/include/ceph_fs.h | 1 + src/mds/Locker.cc | 4 ++-- src/mds/Server.cc | 2 +- src/messages/MClientRequest.h | 10 +++++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 47094e1cc0ed2..f7bf65c066248 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -526,6 +526,7 @@ union ceph_mds_request_args_legacy { #define CEPH_MDS_FLAG_REPLAY 1 /* this is a replayed op */ #define CEPH_MDS_FLAG_WANT_DENTRY 2 /* want dentry in reply */ +#define CEPH_MDS_FLAG_ASYNC 4 /* request is async */ struct ceph_mds_request_head_legacy { __le64 oldest_client_tid; diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 7c5c0488ffff2..79ec9dc4711f9 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -2186,8 +2186,8 @@ Capability* Locker::issue_new_caps(CInode *in, Session *session = mdr->session; bool new_inode = (mdr->alloc_ino || mdr->used_prealloc_ino); - // if replay, try to reconnect cap, and otherwise do nothing. - if (new_inode && mdr->client_request->is_replay()) + // if replay or async, try to reconnect cap, and otherwise do nothing. + if (new_inode && mdr->client_request->is_queued_for_replay()) return mds->mdcache->try_reconnect_cap(in, session); // my needs diff --git a/src/mds/Server.cc b/src/mds/Server.cc index a1ec18ba67670..4094c11ac7ac4 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -262,7 +262,7 @@ void Server::dispatch(const cref_t &m) return; } bool queue_replay = false; - if (req->is_replay()) { + if (req->is_replay() || req->is_async()) { dout(3) << "queuing replayed op" << dendl; queue_replay = true; if (req->head.ino && diff --git a/src/messages/MClientRequest.h b/src/messages/MClientRequest.h index d565f204ac509..29c60ddcb7cee 100644 --- a/src/messages/MClientRequest.h +++ b/src/messages/MClientRequest.h @@ -132,6 +132,9 @@ public: bool is_replay() const { return get_flags() & CEPH_MDS_FLAG_REPLAY; } + bool is_async() const { + return get_flags() & CEPH_MDS_FLAG_ASYNC; + } // normal fields void set_stamp(utime_t t) { stamp = t; } @@ -155,6 +158,9 @@ public: void set_replayed_op() { head.flags = head.flags | CEPH_MDS_FLAG_REPLAY; } + void set_async_op() { + head.flags = head.flags | CEPH_MDS_FLAG_ASYNC; + } utime_t get_stamp() const { return stamp; } ceph_tid_t get_oldest_client_tid() const { return head.oldest_client_tid; } @@ -267,7 +273,9 @@ public: out << " " << stamp; if (head.num_retry) out << " RETRY=" << (int)head.num_retry; - if (get_flags() & CEPH_MDS_FLAG_REPLAY) + if (is_async()) + out << " ASYNC"; + if (is_replay()) out << " REPLAY"; if (queued_for_replay) out << " QUEUED_FOR_REPLAY"; -- 2.39.5