xl/fs: Make i/o operations atomic. (#1496)

This commit is contained in:
Harshavardhana
2016-05-05 20:28:22 -07:00
committed by Anand Babu (AB) Periasamy
parent 17868ccd7f
commit 5133ea50bd
7 changed files with 95 additions and 141 deletions

View File

@@ -70,9 +70,8 @@ func (f *File) Close() error {
// error if any.
func (f *File) CloseAndRemove() error {
// close the embedded fd
if err := f.File.Close(); err != nil {
return err
}
f.File.Close()
// Remove the temp file.
if err := os.Remove(f.Name()); err != nil {
return err