summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/sentry/fsimpl/gofer/filesystem.go19
-rw-r--r--test/syscalls/BUILD15
2 files changed, 26 insertions, 8 deletions
diff --git a/pkg/sentry/fsimpl/gofer/filesystem.go b/pkg/sentry/fsimpl/gofer/filesystem.go
index 3c467e313..21eb976cb 100644
--- a/pkg/sentry/fsimpl/gofer/filesystem.go
+++ b/pkg/sentry/fsimpl/gofer/filesystem.go
@@ -374,13 +374,16 @@ func (fs *filesystem) doCreateAt(ctx context.Context, rp *vfs.ResolvingPath, dir
return nil
}
if fs.opts.interop == InteropModeShared {
- // The existence of a dentry at name would be inconclusive because the
- // file it represents may have been deleted from the remote filesystem,
- // so we would need to make an RPC to revalidate the dentry. Just
- // attempt the file creation RPC instead. If a file does exist, the RPC
- // will fail with EEXIST like we would have. If the RPC succeeds, and a
- // stale dentry exists, the dentry will fail revalidation next time
- // it's used.
+ if child := parent.children[name]; child != nil && child.isSynthetic() {
+ return syserror.EEXIST
+ }
+ // The existence of a non-synthetic dentry at name would be inconclusive
+ // because the file it represents may have been deleted from the remote
+ // filesystem, so we would need to make an RPC to revalidate the dentry.
+ // Just attempt the file creation RPC instead. If a file does exist, the
+ // RPC will fail with EEXIST like we would have. If the RPC succeeds, and a
+ // stale dentry exists, the dentry will fail revalidation next time it's
+ // used.
return createInRemoteDir(parent, name)
}
if child := parent.children[name]; child != nil {
@@ -518,7 +521,7 @@ func (fs *filesystem) unlinkAt(ctx context.Context, rp *vfs.ResolvingPath, dir b
if child == nil {
return syserror.ENOENT
}
- } else {
+ } else if child == nil || !child.isSynthetic() {
err = parent.file.unlinkAt(ctx, name, flags)
if err != nil {
if child != nil {
diff --git a/test/syscalls/BUILD b/test/syscalls/BUILD
index 65a6a7f37..7b0248a39 100644
--- a/test/syscalls/BUILD
+++ b/test/syscalls/BUILD
@@ -57,6 +57,7 @@ syscall_test(
size = "large",
add_overlay = True,
test = "//test/syscalls/linux:bind_test",
+ vfs2 = "True",
)
syscall_test(
@@ -700,6 +701,7 @@ syscall_test(
size = "medium",
add_overlay = True,
test = "//test/syscalls/linux:socket_filesystem_non_blocking_test",
+ vfs2 = "True",
)
syscall_test(
@@ -707,12 +709,14 @@ syscall_test(
add_overlay = True,
shard_count = 50,
test = "//test/syscalls/linux:socket_filesystem_test",
+ vfs2 = "True",
)
syscall_test(
size = "large",
shard_count = 50,
test = "//test/syscalls/linux:socket_inet_loopback_test",
+ vfs2 = "True",
)
syscall_test(
@@ -721,6 +725,7 @@ syscall_test(
# Takes too long for TSAN. Creates a lot of TCP sockets.
tags = ["nogotsan"],
test = "//test/syscalls/linux:socket_inet_loopback_nogotsan_test",
+ vfs2 = "True",
)
syscall_test(
@@ -796,6 +801,7 @@ syscall_test(
syscall_test(
test = "//test/syscalls/linux:socket_blocking_local_test",
+ vfs2 = "True",
)
syscall_test(
@@ -805,6 +811,7 @@ syscall_test(
syscall_test(
test = "//test/syscalls/linux:socket_non_stream_blocking_local_test",
+ vfs2 = "True",
)
syscall_test(
@@ -815,6 +822,7 @@ syscall_test(
syscall_test(
size = "large",
test = "//test/syscalls/linux:socket_stream_blocking_local_test",
+ vfs2 = "True",
)
syscall_test(
@@ -826,11 +834,13 @@ syscall_test(
syscall_test(
size = "medium",
test = "//test/syscalls/linux:socket_stream_local_test",
+ vfs2 = "True",
)
syscall_test(
size = "medium",
test = "//test/syscalls/linux:socket_stream_nonblock_local_test",
+ vfs2 = "True",
)
syscall_test(
@@ -838,6 +848,7 @@ syscall_test(
size = "enormous",
shard_count = 5,
test = "//test/syscalls/linux:socket_unix_dgram_local_test",
+ vfs2 = "True",
)
syscall_test(
@@ -859,11 +870,13 @@ syscall_test(
size = "enormous",
shard_count = 5,
test = "//test/syscalls/linux:socket_unix_seqpacket_local_test",
+ vfs2 = "True",
)
syscall_test(
size = "medium",
test = "//test/syscalls/linux:socket_unix_stream_test",
+ vfs2 = "True",
)
syscall_test(
@@ -881,6 +894,7 @@ syscall_test(
syscall_test(
size = "medium",
test = "//test/syscalls/linux:socket_unix_unbound_filesystem_test",
+ vfs2 = "True",
)
syscall_test(
@@ -894,6 +908,7 @@ syscall_test(
size = "large",
shard_count = 50,
test = "//test/syscalls/linux:socket_unix_unbound_stream_test",
+ vfs2 = "True",
)
syscall_test(