Skip to content

Commit 3daf62c

Browse files
committed
b2: fix "fatal error: concurrent map writes" - fixes rclone#8355
This was caused by the embryonic metadata support. Since this isn't actually visible externally, this patch removes it for the time being.
1 parent 0ef495f commit 3daf62c

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

backend/b2/b2.go

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,13 @@ type Fs struct {
300300

301301
// Object describes a b2 object
302302
type Object struct {
303-
fs *Fs // what this object is part of
304-
remote string // The remote path
305-
id string // b2 id of the file
306-
modTime time.Time // The modified time of the object if known
307-
sha1 string // SHA-1 hash if known
308-
size int64 // Size of the object
309-
mimeType string // Content-Type of the object
310-
meta map[string]string // The object metadata if known - may be nil - with lower case keys
303+
fs *Fs // what this object is part of
304+
remote string // The remote path
305+
id string // b2 id of the file
306+
modTime time.Time // The modified time of the object if known
307+
sha1 string // SHA-1 hash if known
308+
size int64 // Size of the object
309+
mimeType string // Content-Type of the object
311310
}
312311

313312
// ------------------------------------------------------------
@@ -1605,9 +1604,6 @@ func (o *Object) decodeMetaDataRaw(ID, SHA1 string, Size int64, UploadTimestamp
16051604
if err != nil {
16061605
return err
16071606
}
1608-
// For now, just set "mtime" in metadata
1609-
o.meta = make(map[string]string, 1)
1610-
o.meta["mtime"] = o.modTime.Format(time.RFC3339Nano)
16111607
return nil
16121608
}
16131609

@@ -1887,13 +1883,6 @@ func (o *Object) getOrHead(ctx context.Context, method string, options []fs.Open
18871883
Info: Info,
18881884
}
18891885

1890-
// Embryonic metadata support - just mtime
1891-
o.meta = make(map[string]string, 1)
1892-
modTime, err := parseTimeStringHelper(info.Info[timeKey])
1893-
if err == nil {
1894-
o.meta["mtime"] = modTime.Format(time.RFC3339Nano)
1895-
}
1896-
18971886
// When reading files from B2 via cloudflare using
18981887
// --b2-download-url cloudflare strips the Content-Length
18991888
// headers (presumably so it can inject stuff) so use the old

backend/b2/b2_internal_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,6 @@ func (f *Fs) internalTestMetadata(t *testing.T, size string, uploadCutoff string
258258
assert.Equal(t, v, got, k)
259259
}
260260

261-
// mtime
262-
for k, v := range metadata {
263-
got := o.meta[k]
264-
assert.Equal(t, v, got, k)
265-
}
266-
267261
assert.Equal(t, mimeType, gotMetadata.ContentType, "Content-Type")
268262

269263
// Modification time from the x-bz-info-src_last_modified_millis header

0 commit comments

Comments
 (0)