mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-05-06 14:47:49 +08:00
s3: fix potencial iam identities data race
This commit is contained in:
parent
59d1435d65
commit
5018b22f36
@ -5,6 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer"
|
"github.com/chrislusf/seaweedfs/weed/filer"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
@ -23,6 +24,8 @@ type Iam interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IdentityAccessManagement struct {
|
type IdentityAccessManagement struct {
|
||||||
|
m sync.Mutex
|
||||||
|
|
||||||
identities []*Identity
|
identities []*Identity
|
||||||
domain string
|
domain string
|
||||||
}
|
}
|
||||||
@ -131,9 +134,12 @@ func (iam *IdentityAccessManagement) loadS3ApiConfiguration(config *iam_pb.S3Api
|
|||||||
}
|
}
|
||||||
identities = append(identities, t)
|
identities = append(identities, t)
|
||||||
}
|
}
|
||||||
|
iam.m.Lock()
|
||||||
|
|
||||||
// atomically switch
|
// atomically switch
|
||||||
iam.identities = identities
|
iam.identities = identities
|
||||||
|
|
||||||
|
iam.m.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user