Skip to content

Commit

Permalink
meta: skip trash directories when handling rmr
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyXSD authored and davies committed Jan 12, 2023
1 parent c5875be commit 3fde56d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/meta/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,15 @@ 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
}
}
}

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)
Expand Down

0 comments on commit 3fde56d

Please sign in to comment.