@ -886,7 +886,8 @@ func (s *xlStorage) DeleteVersions(ctx context.Context, volume string, versions
return errs
return errs
}
}
// DeleteVersion - deletes FileInfo metadata for path at `xl.meta`
// DeleteVersion - deletes FileInfo metadata for path at `xl.meta`. Create a fresh
// `xl.meta` if it does not exist and we creating a new delete-marker.
func ( s * xlStorage ) DeleteVersion ( ctx context . Context , volume , path string , fi FileInfo ) error {
func ( s * xlStorage ) DeleteVersion ( ctx context . Context , volume , path string , fi FileInfo ) error {
if HasSuffix ( path , SlashSeparator ) {
if HasSuffix ( path , SlashSeparator ) {
return s . Delete ( ctx , volume , path , false )
return s . Delete ( ctx , volume , path , false )
@ -894,10 +895,17 @@ func (s *xlStorage) DeleteVersion(ctx context.Context, volume, path string, fi F
buf , err := s . ReadAll ( ctx , volume , pathJoin ( path , xlStorageFormatFile ) )
buf , err := s . ReadAll ( ctx , volume , pathJoin ( path , xlStorageFormatFile ) )
if err != nil {
if err != nil {
if err == errFileNotFound && fi . VersionID != "" {
if err != errFileNotFound {
err = errFileVersionNotFound
return err
}
}
return err
if fi . Deleted {
// Create a new xl.meta with a delete marker in it
return s . WriteMetadata ( ctx , volume , path , fi )
}
if fi . VersionID != "" {
return errFileVersionNotFound
}
return errFileNotFound
}
}
if len ( buf ) == 0 {
if len ( buf ) == 0 {