From: huanwen ren Date: Mon, 16 Sep 2019 21:46:28 +0000 (+0800) Subject: mds: mds returns -5 error when the deleted file does not exist X-Git-Tag: v15.1.0~1426^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cfb8e61a7cd12667ce3738bd9c9a4601b98c4bf9;p=ceph.git 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 --- 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;