HealObjects should remove objects without quorum (#7407)

This PR adds a way to list objects without quorum
such that they can purged by `mc admin heal --remove`
This commit is contained in:
Harshavardhana
2019-03-26 14:57:44 -07:00
committed by kannappanr
parent 9629de8230
commit 4a698c731b
5 changed files with 180 additions and 60 deletions

View File

@@ -1358,9 +1358,18 @@ func (s *posix) RenameFile(srcVolume, srcPath, dstVolume, dstPath string) (err e
if err == nil && !isDirEmpty(dstFilePath) {
return errFileAccessDenied
}
if !os.IsNotExist(err) {
if err != nil && !os.IsNotExist(err) {
return err
}
// Empty destination remove it before rename.
if isDirEmpty(dstFilePath) {
if err = os.Remove(dstFilePath); err != nil {
if isSysErrNotEmpty(err) {
return errFileAccessDenied
}
return err
}
}
}
if err = renameAll(srcFilePath, dstFilePath); err != nil {