filer: option to create file only if it is new, O_EXCL

This commit is contained in:
Chris Lu
2020-01-22 11:42:40 -08:00
parent 9b01a99d9a
commit d4e75a0d18
11 changed files with 140 additions and 122 deletions

View File

@@ -176,7 +176,7 @@ func (fs *FilerServer) doAutoChunk(ctx context.Context, w http.ResponseWriter, r
},
Chunks: fileChunks,
}
if dbErr := fs.filer.CreateEntry(ctx, entry); dbErr != nil {
if dbErr := fs.filer.CreateEntry(ctx, entry, false); dbErr != nil {
fs.filer.DeleteChunks(entry.Chunks)
replyerr = dbErr
filerResult.Error = dbErr.Error()