@@ -82,7 +82,7 @@ func (s *peerS3Server) HealthHandler(w http.ResponseWriter, r *http.Request) {
82
82
83
83
func healBucketLocal (ctx context.Context , bucket string , opts madmin.HealOpts ) (res madmin.HealResultItem , err error ) {
84
84
globalLocalDrivesMu .RLock ()
85
- localDrives := globalLocalDrives
85
+ localDrives := cloneDrives ( globalLocalDrives )
86
86
globalLocalDrivesMu .RUnlock ()
87
87
88
88
// Initialize sync waitgroup.
@@ -206,7 +206,7 @@ func healBucketLocal(ctx context.Context, bucket string, opts madmin.HealOpts) (
206
206
207
207
func listBucketsLocal (ctx context.Context , opts BucketOptions ) (buckets []BucketInfo , err error ) {
208
208
globalLocalDrivesMu .RLock ()
209
- localDrives := globalLocalDrives
209
+ localDrives := cloneDrives ( globalLocalDrives )
210
210
globalLocalDrivesMu .RUnlock ()
211
211
212
212
quorum := (len (localDrives ) / 2 )
@@ -252,9 +252,15 @@ func listBucketsLocal(ctx context.Context, opts BucketOptions) (buckets []Bucket
252
252
return buckets , nil
253
253
}
254
254
255
+ func cloneDrives (drives []StorageAPI ) []StorageAPI {
256
+ newDrives := make ([]StorageAPI , len (drives ))
257
+ copy (newDrives , drives )
258
+ return newDrives
259
+ }
260
+
255
261
func getBucketInfoLocal (ctx context.Context , bucket string , opts BucketOptions ) (BucketInfo , error ) {
256
262
globalLocalDrivesMu .RLock ()
257
- localDrives := globalLocalDrives
263
+ localDrives := cloneDrives ( globalLocalDrives )
258
264
globalLocalDrivesMu .RUnlock ()
259
265
260
266
g := errgroup .WithNErrs (len (localDrives )).WithConcurrency (32 )
@@ -303,7 +309,7 @@ func getBucketInfoLocal(ctx context.Context, bucket string, opts BucketOptions)
303
309
304
310
func deleteBucketLocal (ctx context.Context , bucket string , opts DeleteBucketOptions ) error {
305
311
globalLocalDrivesMu .RLock ()
306
- localDrives := globalLocalDrives
312
+ localDrives := cloneDrives ( globalLocalDrives )
307
313
globalLocalDrivesMu .RUnlock ()
308
314
309
315
g := errgroup .WithNErrs (len (localDrives )).WithConcurrency (32 )
@@ -341,7 +347,7 @@ func deleteBucketLocal(ctx context.Context, bucket string, opts DeleteBucketOpti
341
347
342
348
func makeBucketLocal (ctx context.Context , bucket string , opts MakeBucketOptions ) error {
343
349
globalLocalDrivesMu .RLock ()
344
- localDrives := globalLocalDrives
350
+ localDrives := cloneDrives ( globalLocalDrives )
345
351
globalLocalDrivesMu .RUnlock ()
346
352
347
353
g := errgroup .WithNErrs (len (localDrives )).WithConcurrency (32 )
0 commit comments