From: Patrick Donnelly Date: Fri, 17 Jun 2016 16:00:59 +0000 (-0400) Subject: mds: improve comments for ENOTEMPTY checks X-Git-Tag: v11.0.0~95^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef272731215ccf0a4178ae01f2903077488ef895;p=ceph-ci.git mds: improve comments for ENOTEMPTY checks There are two checks in the code for ENOTEMPTY, clarify that the first check is doing a fast check without locks. Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index d804a8ac68c..02883b96fba 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -6099,7 +6099,7 @@ void Server::handle_client_rename(MDRequestRef& mdr) return; } - // non-empty dir? + // non-empty dir? do trivial fast unlocked check, do another check later with read locks if (oldin->is_dir() && _dir_is_nonempty_unlocked(mdr, oldin)) { respond_to_request(mdr, -ENOTEMPTY); return; @@ -6309,6 +6309,7 @@ void Server::handle_client_rename(MDRequestRef& mdr) if (!check_access(mdr, srci, MAY_WRITE)) return; + // with read lock, really verify oldin is empty if (oldin && oldin->is_dir() && _dir_is_nonempty(mdr, oldin)) {