From ef272731215ccf0a4178ae01f2903077488ef895 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Fri, 17 Jun 2016 12:00:59 -0400 Subject: [PATCH] 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 --- src/mds/Server.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index d804a8ac68c2..02883b96fba7 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)) { -- 2.47.3