forked from TrueCloudLab/frostfs-node
[#1956] node: Lock shard's mode on its methods switch
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
33d279a3f2
commit
eea2892109
13 changed files with 94 additions and 22 deletions
|
@ -30,7 +30,10 @@ func (p *PutPrm) SetObject(obj *object.Object) {
|
|||
//
|
||||
// Returns ErrReadOnlyMode error if shard is in "read-only" mode.
|
||||
func (s *Shard) Put(prm PutPrm) (PutRes, error) {
|
||||
m := s.GetMode()
|
||||
s.m.RLock()
|
||||
defer s.m.RUnlock()
|
||||
|
||||
m := s.info.Mode
|
||||
if m.ReadOnly() {
|
||||
return PutRes{}, ErrReadOnlyMode
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue