From cfb8e61a7cd12667ce3738bd9c9a4601b98c4bf9 Mon Sep 17 00:00:00 2001 From: huanwen ren Date: Tue, 17 Sep 2019 05:46:28 +0800 Subject: [PATCH] mds: mds returns -5 error when the deleted file does not exist For files that do not exist, we should set it to -ESTALE instead of -EIO, because this error code will be returned to the NFS client and transparently passed to the application layer. The application layer may handle -EIO and -ESTALE differently. And lead to misjudgment Fixes:https://tracker.ceph.com/issues/41868 Signed-off-by: huanwen ren --- src/mds/MDCache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 4e5fabd38b1a..dc414570a86f 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -8629,7 +8629,7 @@ void MDCache::_open_ino_backtrace_fetched(inodeno_t ino, bufferlist& bl, int err if (err == 0) { if (backtrace.ancestors.empty()) { dout(10) << " got empty backtrace " << dendl; - err = -EIO; + err = -ESTALE; } else if (!info.ancestors.empty()) { if (info.ancestors[0] == backtrace.ancestors[0]) { dout(10) << " got same parents " << info.ancestors[0] << " 2 times" << dendl; -- 2.47.3