From 1d617eee2e8c32f7300cb2cb8dd37b3714a4699f Mon Sep 17 00:00:00 2001 From: Dan van der Ster Date: Thu, 10 Aug 2017 11:33:46 +0200 Subject: [PATCH] client: skip lookupname if writing to unlinked file When a client writes to an unlinked file, get_quota_root tries to resolve the filename via an MDS lookupname op. The op always results in -13 permission denied for path-restricted caps or -2 no such file or directory otherwise. More importantly, the repeated lookupname ops slow down buffered writes significantly. Don't do the lookupname for unlinked files; use the root_ancentor's quota instead. Fixes: http://tracker.ceph.com/issues/20945 Backport: jewel, luminous Signed-off-by: Dan van der Ster --- src/client/Client.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/Client.cc b/src/client/Client.cc index e461ab4a59e..b971a2bf5c5 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -13007,6 +13007,12 @@ Inode *Client::get_quota_root(Inode *in, const UserPerm& perms) if (cur == root_ancestor) break; + // deleted inode + if (cur->nlink == 0) { + cur = root_ancestor; + break; + } + MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPNAME); filepath path(cur->ino); req->set_filepath(path); -- 2.39.5