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. 7
      cmd/fs-v1.go

@ -506,7 +506,12 @@ 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 {
return ObjectInfo{}, toObjectErr(rerr, bucket, object)
// `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)
}
}
}

Loading…
Cancel
Save