From f10f73ce33a60446890781c06d9e66ff548668c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Czern=C3=BD?= Date: Fri, 15 Oct 2021 17:11:22 +0200 Subject: [PATCH] B #5575: Fix onevm chown error msg on quota limit (#1528) (cherry picked from commit ad558f2f7d5bcc951c85ed81bae164bc8bcf7721) --- src/rm/RequestManagerChown.cc | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/rm/RequestManagerChown.cc b/src/rm/RequestManagerChown.cc index 00363359f4..fc58bb2f19 100644 --- a/src/rm/RequestManagerChown.cc +++ b/src/rm/RequestManagerChown.cc @@ -41,7 +41,7 @@ unique_ptr RequestManagerChown::get_and_quota( std::string memory, cpu; - auto object = pool->get(oid); + auto object = pool->get_ro(oid); if ( object == nullptr ) { @@ -174,15 +174,7 @@ unique_ptr RequestManagerChown::get_and_quota( } } - if (!error) - { - for (auto& it : quota_to_rback) - { - quota_rollback(it.second.get(), it.first, att_old); - } - - object = pool->get(oid); - } + object = pool->get(oid); // ------------------------------------------------------------------------- // Error or object deleted. Rollback chown quota operation. Add again usage @@ -192,25 +184,25 @@ unique_ptr RequestManagerChown::get_and_quota( { for (auto& it : quota_to_rback) { - if ( object == nullptr ) - { - quota_authorization(it.second.get(), it.first, att_old, att.resp_msg); - } - quota_rollback(it.second.get(), it.first, att_new); } - if ( object == 0 ) + if ( error ) + { + failure_response(AUTHORIZATION, att); + } + else { att.resp_id = oid; failure_response(NO_EXISTS, att); } - else - { - failure_response(AUTHORIZATION, att); - } - object = nullptr; + return nullptr; + } + + for (auto& it : quota_to_rback) + { + quota_rollback(it.second.get(), it.first, att_old); } return object;