mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Do not attempt to clear release dentries if fs.root is nil.
When initializing the fs.client and fs.root fails, the filesystem is released. The release implementation panics when leak checking is enabled (in tests) because it lacks nil-checks for fs.root. PiperOrigin-RevId: 428976387
This commit is contained in:
@@ -697,8 +697,9 @@ func (fs *filesystem) Release(ctx context.Context) {
|
||||
// If leak checking is enabled, release all outstanding references in the
|
||||
// filesystem. We deliberately avoid doing this outside of leak checking; we
|
||||
// have released all external resources above rather than relying on dentry
|
||||
// destructors.
|
||||
if refs_vfs1.GetLeakMode() != refs_vfs1.NoLeakChecking {
|
||||
// destructors. fs.root may be nil if creating the client or initializing the
|
||||
// root dentry failed in GetFilesystem.
|
||||
if refs_vfs1.GetLeakMode() != refs_vfs1.NoLeakChecking && fs.root != nil {
|
||||
fs.renameMu.Lock()
|
||||
fs.root.releaseSyntheticRecursiveLocked(ctx)
|
||||
fs.evictAllCachedDentriesLocked(ctx)
|
||||
|
||||
Reference in New Issue
Block a user