]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix fuse client can't read or write data due its caps is invalid 25479/head
authorYunfeiGuan <yunfeiguan@xtaotech.com>
Wed, 26 Sep 2018 09:01:38 +0000 (17:01 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 8 Jan 2019 03:42:53 +0000 (11:42 +0800)
We can't do read or write if we don't have Fr or Fw. Similarly, if the
caps is invalid, we can't read or wirte either.

What's worse, the mds don't konw our cap gen is invalid and think client
inode's caps is right. Thus will lead client application hung all the time.

Fixes: http://tracker.ceph.com/issues/36189
Signed-off-by: Guan yunfei <yunfei.guan@xtaotech.com>
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/client/Client.cc

index ccff5acdcdd1c6ce12a76f9ac82f6521c9d69e31..a9c019752fb9921de26c1cf5c837c2f7c669f720 100644 (file)
@@ -2794,8 +2794,13 @@ void Client::send_reconnect(MetaSession *session)
       cap.seq = 0;  // reset seq.
       cap.issue_seq = 0;  // reset seq.
       cap.mseq = 0;  // reset seq.
-      cap.issued = cap.implemented;
-
+      // cap gen should catch up with session cap_gen
+      if (cap.gen < session->cap_gen) {
+       cap.gen = session->cap_gen;
+       cap.issued = cap.implemented = CEPH_CAP_PIN;
+      } else {
+       cap.issued = cap.implemented;
+      }
       snapid_t snap_follows = 0;
       if (!in->cap_snaps.empty())
        snap_follows = in->cap_snaps.begin()->first;