mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Correctly decrement link counts in tmpfs rename operations.
When a directory is replaced by a rename operation, its link count should reach zero. We were missing the link from `dir/.` PiperOrigin-RevId: 325141730
This commit is contained in:
@@ -566,7 +566,9 @@ func (fs *filesystem) RenameAt(ctx context.Context, rp *vfs.ResolvingPath, oldPa
|
||||
if replaced != nil {
|
||||
newParentDir.removeChildLocked(replaced)
|
||||
if replaced.inode.isDir() {
|
||||
newParentDir.inode.decLinksLocked(ctx) // from replaced's ".."
|
||||
// Remove links for replaced/. and replaced/..
|
||||
replaced.inode.decLinksLocked(ctx)
|
||||
newParentDir.inode.decLinksLocked(ctx)
|
||||
}
|
||||
replaced.inode.decLinksLocked(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user