mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Do not clear merkle files when creating dentry
The dentry for each file/directory can be created/destroyed multiple times during sandbox lifetime. We should not clear the Merkle file each time a dentry is created. PiperOrigin-RevId: 390277107
This commit is contained in:
@@ -595,23 +595,6 @@ func (fs *filesystem) lookupAndVerifyLocked(ctx context.Context, parent *dentry,
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the Merkle tree file if they are to be generated at runtime.
|
||||
// TODO(b/182315468): Optimize the Merkle tree generate process to
|
||||
// allow only updating certain files/directories.
|
||||
if fs.allowRuntimeEnable {
|
||||
childMerkleFD, err := vfsObj.OpenAt(ctx, fs.creds, &vfs.PathOperation{
|
||||
Root: childMerkleVD,
|
||||
Start: childMerkleVD,
|
||||
}, &vfs.OpenOptions{
|
||||
Flags: linux.O_RDWR | linux.O_TRUNC,
|
||||
Mode: 0644,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
childMerkleFD.DecRef(ctx)
|
||||
}
|
||||
|
||||
// The dentry needs to be cleaned up if any error occurs. IncRef will be
|
||||
// called if a verity child dentry is successfully created.
|
||||
defer childMerkleVD.DecRef(ctx)
|
||||
|
||||
Reference in New Issue
Block a user