-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mount: Fix updating user groups in master after its restart
The bug originated from clearing mount's group cache on master disconnected event and using the same cache to register user's groups in the master later on. The cache was already empty when attempting the registration so there were no groups to tell master about so the operation performed on the mounted filesystem failed. This fix changes the registration part in the client so that it uses client context to populate the cache and update credentials (groups) in master if the group cache is empty, for example due to disconnection from master. Context references were made non-const because updating groups in group cache requires assigning a new gid value in the client context. Fixes bug introduced by 7e7ad72 Change-Id: Idac2ebc74e73ca306462e07bd3b943c2efa73a0d
- Loading branch information
1 parent
cead0a0
commit d61a93e
Showing
9 changed files
with
434 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright 2013-2020 Lizard sp. z o.o. | ||
This file is part of LizardFS. | ||
LizardFS is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, version 3. | ||
LizardFS is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with LizardFS. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "common/platform.h" | ||
|
||
#include <cstdint> | ||
|
||
namespace user_groups { | ||
|
||
constexpr std::uint32_t kSecondaryGroupsBit = (std::uint32_t)1 << 31; | ||
|
||
constexpr bool isGroupCacheId(std::uint32_t groupsId) noexcept { | ||
return static_cast<bool>(groupsId & kSecondaryGroupsBit); | ||
} | ||
|
||
constexpr std::uint32_t encodeGroupCacheId(std::uint32_t groupsId) noexcept { | ||
return groupsId | kSecondaryGroupsBit; | ||
} | ||
|
||
constexpr std::uint32_t decodeGroupCacheId(std::uint32_t groupsId) noexcept { | ||
return groupsId & ~kSecondaryGroupsBit; | ||
} | ||
|
||
} // namespace user_groups |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.