fs: if `fs.json` is empty ignore it while reading metadata. (#3634)

This is needed so that we don't send wrong errors
on previously failed PutObject() which would have
left a stale `fs.json` entry.
master
Harshavardhana 8 years ago committed by GitHub
parent c753b5dfeb
commit dafdc74605
  1. 5
      cmd/fs-v1.go

@ -506,9 +506,14 @@ func (fs fsObjects) getObjectInfo(bucket, object string) (ObjectInfo, error) {
// Read from fs metadata only if it exists.
defer fs.rwPool.Close(fsMetaPath)
if _, rerr := fsMeta.ReadFrom(rlk.LockedFile); rerr != nil {
// `fs.json` can be empty due to previously failed
// PutObject() transaction, if we arrive at such
// a situation we just ignore and continue.
if errorCause(rerr) != io.EOF {
return ObjectInfo{}, toObjectErr(rerr, bucket, object)
}
}
}
// Ignore if `fs.json` is not available, this is true for pre-existing data.
if err != nil && err != errFileNotFound {

Loading…
Cancel
Save