From 9bb88e610e836ea88594aa856e07d92c67ea17a2 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Sinha Date: Thu, 20 Dec 2018 00:57:10 +0530 Subject: [PATCH] Deletion of subfolders of multipart (#6961) Delete subfolders under multipart folder upon completion of CompleteMultipartUpload, AbortMultipartUpload and cleanupStaleMultipartUploads functions --- cmd/fs-v1-multipart.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/fs-v1-multipart.go b/cmd/fs-v1-multipart.go index c56adfc0b..fd11448d3 100644 --- a/cmd/fs-v1-multipart.go +++ b/cmd/fs-v1-multipart.go @@ -682,6 +682,8 @@ func (fs *FSObjects) CompleteMultipartUpload(ctx context.Context, bucket string, return oi, toObjectErr(err, bucket, object) } fsRemoveAll(ctx, uploadIDDir) + // It is safe to ignore any directory not empty error (in case there were multiple uploadIDs on the same object) + fsRemoveDir(ctx, fs.getMultipartSHADir(bucket, object)) fi, err := fsStatFile(ctx, pathJoin(fs.fsPath, bucket, object)) if err != nil { return oi, toObjectErr(err, bucket, object) @@ -769,6 +771,9 @@ func (fs *FSObjects) cleanupStaleMultipartUploads(ctx context.Context, cleanupIn } if now.Sub(fi.ModTime()) > expiry { fsRemoveAll(ctx, pathJoin(fs.fsPath, minioMetaMultipartBucket, entry, uploadID)) + // It is safe to ignore any directory not empty error (in case there were multiple uploadIDs on the same object) + fsRemoveDir(ctx, pathJoin(fs.fsPath, minioMetaMultipartBucket, entry)) + } } }