|
|
@ -640,6 +640,7 @@ func (xl XL) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) error { |
|
|
|
nsMutex.Lock(dstVolume, dstPath) |
|
|
|
nsMutex.Lock(dstVolume, dstPath) |
|
|
|
defer nsMutex.Unlock(dstVolume, dstPath) |
|
|
|
defer nsMutex.Unlock(dstVolume, dstPath) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errCount := 0 |
|
|
|
for index, disk := range xl.storageDisks { |
|
|
|
for index, disk := range xl.storageDisks { |
|
|
|
// Make sure to rename all the files only, not directories.
|
|
|
|
// Make sure to rename all the files only, not directories.
|
|
|
|
srcErasurePartPath := slashpath.Join(srcPath, fmt.Sprintf("file.%d", index)) |
|
|
|
srcErasurePartPath := slashpath.Join(srcPath, fmt.Sprintf("file.%d", index)) |
|
|
@ -652,6 +653,14 @@ func (xl XL) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) error { |
|
|
|
"dstVolume": dstVolume, |
|
|
|
"dstVolume": dstVolume, |
|
|
|
"dstPath": dstErasurePartPath, |
|
|
|
"dstPath": dstErasurePartPath, |
|
|
|
}).Errorf("RenameFile failed with %s", err) |
|
|
|
}).Errorf("RenameFile failed with %s", err) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errCount++ |
|
|
|
|
|
|
|
// We can safely allow RenameFile errors up to len(xl.storageDisks) - xl.writeQuorum
|
|
|
|
|
|
|
|
// otherwise return failure.
|
|
|
|
|
|
|
|
if errCount <= len(xl.storageDisks)-xl.writeQuorum { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
srcXLMetaPath := slashpath.Join(srcPath, xlMetaV1File) |
|
|
|
srcXLMetaPath := slashpath.Join(srcPath, xlMetaV1File) |
|
|
@ -664,6 +673,14 @@ func (xl XL) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) error { |
|
|
|
"dstVolume": dstVolume, |
|
|
|
"dstVolume": dstVolume, |
|
|
|
"dstPath": dstXLMetaPath, |
|
|
|
"dstPath": dstXLMetaPath, |
|
|
|
}).Errorf("RenameFile failed with %s", err) |
|
|
|
}).Errorf("RenameFile failed with %s", err) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errCount++ |
|
|
|
|
|
|
|
// We can safely allow RenameFile errors up to len(xl.storageDisks) - xl.writeQuorum
|
|
|
|
|
|
|
|
// otherwise return failure.
|
|
|
|
|
|
|
|
if errCount <= len(xl.storageDisks)-xl.writeQuorum { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
err = disk.DeleteFile(srcVolume, srcPath) |
|
|
|
err = disk.DeleteFile(srcVolume, srcPath) |
|
|
@ -672,6 +689,14 @@ func (xl XL) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) error { |
|
|
|
"srcVolume": srcVolume, |
|
|
|
"srcVolume": srcVolume, |
|
|
|
"srcPath": srcPath, |
|
|
|
"srcPath": srcPath, |
|
|
|
}).Errorf("DeleteFile failed with %s", err) |
|
|
|
}).Errorf("DeleteFile failed with %s", err) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
errCount++ |
|
|
|
|
|
|
|
// We can safely allow RenameFile errors up to len(xl.storageDisks) - xl.writeQuorum
|
|
|
|
|
|
|
|
// otherwise return failure.
|
|
|
|
|
|
|
|
if errCount <= len(xl.storageDisks)-xl.writeQuorum { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|