Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

b2: fix "fatal error: concurrent map writes" - fixes #8355

Nick Craig-Wood3daf62cf3d69
diff --git a/backend/b2/b2.go b/backend/b2/b2.go
index ad58383f9..357b6c6c8 100644
--- a/backend/b2/b2.go
+++ b/backend/b2/b2.go
@@ -300,14 +300,13 @@ type Fs struct {
// Object describes a b2 object
type Object struct {
- fs *Fs // what this object is part of
- remote string // The remote path
- id string // b2 id of the file
- modTime time.Time // The modified time of the object if known
- sha1 string // SHA-1 hash if known
- size int64 // Size of the object
- mimeType string // Content-Type of the object
- meta map[string]string // The object metadata if known - may be nil - with lower case keys
+ fs *Fs // what this object is part of
+ remote string // The remote path
+ id string // b2 id of the file
+ modTime time.Time // The modified time of the object if known
+ sha1 string // SHA-1 hash if known
+ size int64 // Size of the object
+ mimeType string // Content-Type of the object
}
// ------------------------------------------------------------
@@ -1605,9 +1604,6 @@ func (o *Object) decodeMetaDataRaw(ID, SHA1 string, Size int64, UploadTimestamp
if err != nil {
return err
}
- // For now, just set "mtime" in metadata
- o.meta = make(map[string]string, 1)
- o.meta["mtime"] = o.modTime.Format(time.RFC3339Nano)
return nil
}
@@ -1887,13 +1883,6 @@ func (o *Object) getOrHead(ctx context.Context, method string, options []fs.Open
Info: Info,
}
- // Embryonic metadata support - just mtime
- o.meta = make(map[string]string, 1)
- modTime, err := parseTimeStringHelper(info.Info[timeKey])
- if err == nil {
- o.meta["mtime"] = modTime.Format(time.RFC3339Nano)
- }
-
// When reading files from B2 via cloudflare using
// --b2-download-url cloudflare strips the Content-Length
// headers (presumably so it can inject stuff) so use the old
diff --git a/backend/b2/b2_internal_test.go b/backend/b2/b2_internal_test.go
index c470dcc4d..168f61233 100644
--- a/backend/b2/b2_internal_test.go
+++ b/backend/b2/b2_internal_test.go
@@ -258,12 +258,6 @@ func (f *Fs) internalTestMetadata(t *testing.T, size string, uploadCutoff string
assert.Equal(t, v, got, k)
}
- // mtime
- for k, v := range metadata {
- got := o.meta[k]
- assert.Equal(t, v, got, k)
- }
-
assert.Equal(t, mimeType, gotMetadata.ContentType, "Content-Type")
// Modification time from the x-bz-info-src_last_modified_millis header