From 3fde56d024129430b849c41ceda9c2068797bcb7 Mon Sep 17 00:00:00 2001 From: Sandy Xu Date: Thu, 12 Jan 2023 22:38:01 +0800 Subject: [PATCH] meta: skip trash directories when handling rmr --- pkg/meta/utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/meta/utils.go b/pkg/meta/utils.go index d77fbc550885..0d6c0b541614 100644 --- a/pkg/meta/utils.go +++ b/pkg/meta/utils.go @@ -292,7 +292,7 @@ func (m *baseMeta) emptyDir(ctx Context, inode Ino, count *uint64, concurrent ch entries[i] = nil // release memory } wg.Wait() - if status != 0 { + if status != 0 || inode == TrashInode { // try only once for .trash return status } } @@ -300,7 +300,7 @@ func (m *baseMeta) emptyDir(ctx Context, inode Ino, count *uint64, concurrent ch func (m *baseMeta) emptyEntry(ctx Context, parent Ino, name string, inode Ino, count *uint64, concurrent chan int) syscall.Errno { st := m.emptyDir(ctx, inode, count, concurrent) - if st == 0 { + if st == 0 && !isTrash(inode) { st = m.Rmdir(ctx, parent, name) if st == syscall.ENOTEMPTY { st = m.emptyEntry(ctx, parent, name, inode, count, concurrent)