diff options
author | Dean Deng <deandeng@google.com> | 2021-05-14 14:02:04 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-14 14:04:46 -0700 |
commit | 894187b2c6edbe367135670fb53f2e3f3d24535d (patch) | |
tree | 750cf74e5dc7d8acc5715f9b43555a2d481273d1 /pkg/sentry/kernel/fd_table.go | |
parent | eb7e83f645cc21f3219865d38fa7f8e06852c822 (diff) |
Resolve remaining O_PATH TODOs.
O_PATH is now implemented in vfs2.
Fixes #2782.
PiperOrigin-RevId: 373861410
Diffstat (limited to 'pkg/sentry/kernel/fd_table.go')
-rw-r--r-- | pkg/sentry/kernel/fd_table.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/sentry/kernel/fd_table.go b/pkg/sentry/kernel/fd_table.go index 10885688c..62777faa8 100644 --- a/pkg/sentry/kernel/fd_table.go +++ b/pkg/sentry/kernel/fd_table.go @@ -154,9 +154,11 @@ func (f *FDTable) drop(ctx context.Context, file *fs.File) { // dropVFS2 drops the table reference. func (f *FDTable) dropVFS2(ctx context.Context, file *vfs.FileDescription) { // Release any POSIX lock possibly held by the FDTable. - err := file.UnlockPOSIX(ctx, f, lock.LockRange{0, lock.LockEOF}) - if err != nil && err != syserror.ENOLCK { - panic(fmt.Sprintf("UnlockPOSIX failed: %v", err)) + if file.SupportsLocks() { + err := file.UnlockPOSIX(ctx, f, lock.LockRange{0, lock.LockEOF}) + if err != nil && err != syserror.ENOLCK { + panic(fmt.Sprintf("UnlockPOSIX failed: %v", err)) + } } // Drop the table's reference. |