Commit Graph

100 Commits

Author SHA1 Message Date
gVisor bot ea3706565d Merge release-20201130.0-51-gb28dc25ae (automated) 2020-12-07 17:27:46 +00:00
Michael Pratt b28dc25aea Remove p9.fidRef.openedMu
openedMu has lock ordering violations. Most locks go through OpenedFlag(),
which is usually taken after renameMu and opMu. On the other hand, Tlopen takes
openedMu before renameMu and opMu (via safelyRead).

Resolving this violation is simple: just drop openedMu. The opened and
openFlags fields are already protected by opMu in most cases, renameMu (for
write) in one case (via safelyGlobal), and only in doWalk by neither.

This is a bit ugly because opMu is supposed to be a "semantic" lock, but it
works. I'm open to other suggestions.

Note that doWalk has a race condition where a FID may open after the open check
but before actually walking. This race existed before this change as well; it
is not clear if it is problematic.

PiperOrigin-RevId: 346108483
2020-12-07 09:23:17 -08:00
gVisor bot 99ee4465b2 Merge release-20201109.0-63-g949742be8 (automated) 2020-11-17 23:43:28 +00:00
Nicolas Lacasse 949742be88 Allow short writes from gofers.
They were returning io.ErrShortWrite, but that is not handled at higher levels
and resulted in a panic.

We can just return the short write directly from the p9 call without
ErrShortWrite.

PiperOrigin-RevId: 342960441
2020-11-17 15:39:48 -08:00
gVisor bot ccc4fc176c Merge release-20201109.0-61-ge2d9a68ee (automated) 2020-11-17 23:01:28 +00:00
Fabricio Voznika e2d9a68eef Add support for TTY in multi-container
Fixes #2714

PiperOrigin-RevId: 342950412
2020-11-17 14:51:24 -08:00
gVisor bot 2e80f58b0d Merge release-20200818.0-105-g37a217aca (automated) 2020-09-02 02:25:18 +00:00
Fabricio Voznika 37a217aca4 Implement setattr+clunk in 9P
This is to cover the common pattern: open->read/write->close,
where SetAttr needs to be called to update atime/mtime before
the file is closed.

Benchmark results:

BM_OpenReadClose/10240 CPU
setattr+clunk: 63783 ns
VFS2:          68109 ns
VFS1:          72507 ns

Updates #1198

PiperOrigin-RevId: 329628461
2020-09-01 19:22:12 -07:00
gVisor bot b68af66e80 Merge release-20200810.0-63-g3fd4b83fa (automated) 2020-08-19 19:03:36 +00:00
Jamie Liu 3fd4b83fa3 Remove use of channels from p9.connState legacy transport.
- Remove sendDone, which currently does nothing whatsoever (errors sent to the
  channel are completely unused). Instead, have request handlers log errors
  they get from p9.send() inline.

- Replace recvOkay and recvDone with recvMu/recvIdle/recvShutdown. In addition
  to being slightly clearer (IMO), this eliminates the p9.connState.service()
  goroutine, significantly reducing the overhead involved in passing connection
  receive access between goroutines (from buffered chan send/recv + unbuffered
  chan send/recv to just a mutex unlock/lock).

PiperOrigin-RevId: 327476755
2020-08-19 11:58:59 -07:00
gVisor bot 499d41d889 Merge release-20200810.0-49-gb3141b680 (automated) 2020-08-18 19:35:25 +00:00
Jamie Liu b3141b680f Wait for all p9 handlers to complete before server shutdown.
... including those invoked via flipcall.

PiperOrigin-RevId: 327283194
2020-08-18 12:32:14 -07:00
gVisor bot 5f884e6a47 Merge release-20200804.0-63-g49947d2eb (automated) 2020-08-11 23:46:18 +00:00
Fazlul Shahriar 49947d2eb9 Eliminate one allocation per send/recv for non-flipcall transport.
Ported from https://github.com/hugelgupf/p9/pull/44.

name               old time/op    new time/op    delta
SendRecvLegacy-6     61.5µs ± 6%    60.1µs ±11%     ~     (p=0.063 n=9+9)
SendRecv-6           40.7µs ± 2%    39.8µs ± 5%   -2.27%  (p=0.035 n=10+10)

name               old alloc/op   new alloc/op   delta
SendRecvLegacy-6       769B ± 0%      705B ± 0%   -8.37%  (p=0.000 n=8+10)
SendRecv-6             320B ± 0%      256B ± 0%  -20.00%  (p=0.000 n=10+10)

name               old allocs/op  new allocs/op  delta
SendRecvLegacy-6       25.0 ± 0%      23.0 ± 0%   -8.00%  (p=0.000 n=10+10)
SendRecv-6             14.0 ± 0%      12.0 ± 0%  -14.29%  (p=0.000 n=10+10)

PiperOrigin-RevId: 326127979
2020-08-11 16:43:23 -07:00
gVisor bot 04e6528c3e Merge release-20200622.1-212-gbcbcaa67a (automated) 2020-07-24 04:12:49 +00:00
Sevki 033fe6d70a p9: fix `registry.get` ob1 bug 2020-07-21 22:42:18 +01:00
gVisor bot 68f56161e2 Merge release-20200622.1-52-g6a90c88b9 (automated) 2020-07-01 20:26:09 +00:00
Zach Koopmans 6a90c88b97 Port fallocate to VFS2.
PiperOrigin-RevId: 319283715
2020-07-01 13:14:44 -07:00
gVisor bot 9d099c6a4f Merge release-20200522.0-118-gfadbfd83d (automated) 2020-06-10 19:40:51 +00:00
Michael Pratt fadbfd83d9 Include panic message in log
PiperOrigin-RevId: 315745386
2020-06-10 12:38:20 -07:00
gVisor bot 84452958e1 Merge release-20200518.0-45-g0bc022b7 (automated) 2020-05-27 17:51:40 +00:00
gVisor bot 662290db1f Merge release-20200323.0-123-g8bb8027 (automated) 2020-04-10 18:41:16 +00:00
Dean Deng 8bb8027d55 Return EIO from p9 if sending/receiving fails.
Continues the modifications in cl/272963663. This prevents non-syscall errors
from being propogated to kernel/task_syscall.go:ExtractErrno(), which causes a
sentry panic.

PiperOrigin-RevId: 305913127
2020-04-10 11:36:57 -07:00
gVisor bot 31e1ab4b8c Merge release-20200323.0-105-g2b4687a (automated) 2020-04-09 18:22:39 +00:00
Dean Deng 2b4687a46b Handle os.LinkError in p9/handlers.go.
PiperOrigin-RevId: 305721329
2020-04-09 11:17:11 -07:00
gVisor bot 1e75d64fb5 Merge release-20200323.0-77-g51e461c (automated) 2020-04-07 03:11:16 +00:00
Dean Deng 51e461cf9c Add concurrency guarantees to p9 extended attribute methods.
PiperOrigin-RevId: 305171772
2020-04-06 20:08:51 -07:00
gVisor bot 3409906aa3 Merge release-20200323.0-63-gd151693 (automated) 2020-04-03 05:07:57 +00:00
Uros Prestor d151693530 Avoid sending a partial dirent when the Rreaddir response exceeds message limit.
PiperOrigin-RevId: 304542967
2020-04-02 22:03:20 -07:00
gVisor bot d266dd12b9 Merge release-20200211.0-19-g50c4931 (automated) 2020-02-14 20:25:38 +00:00
gVisor bot 50c493193b Un-export p9 message encode/decode functions.
These are not used outside of the p9 package.

PiperOrigin-RevId: 295200052
2020-02-14 12:23:10 -08:00
gVisor bot c59074e13f Merge release-20200127.0-99-g17b9f5e (automated) 2020-02-07 22:50:34 +00:00
Dean Deng 17b9f5e662 Support listxattr and removexattr syscalls.
Note that these are only implemented for tmpfs, and other impls will still
return EOPNOTSUPP.

PiperOrigin-RevId: 293899385
2020-02-07 14:47:13 -08:00
gVisor bot 1daf3bb5f4 Merge release-20200127.0-86-g5ff7808 (automated) 2020-02-06 18:10:38 +00:00
Andrei Vagin 5ff780891e Move p9.pool to a separate package
PiperOrigin-RevId: 293617493
2020-02-06 10:07:45 -08:00
gVisor bot 971856a978 Merge release-20200127.0-85-g1b6a12a (automated) 2020-02-06 06:49:12 +00:00
Adin Scannell d29e59af9f Standardize on tools directory.
PiperOrigin-RevId: 291745021
2020-01-27 12:21:00 -08:00
gVisor bot b6542333a2 Merge release-20200115.0-15-g1e7f0c8 (automated) 2020-01-16 23:53:46 +00:00
Dean Deng 1e7f0c822b Bump p9 version, adding corresponding checks to client_file.go.
PiperOrigin-RevId: 290145451
2020-01-16 15:39:19 -08:00
gVisor bot 47e62a0e3d Merge release-20200115.0-9-g07f2584 (automated) 2020-01-16 21:04:22 +00:00
Dean Deng 07f2584979 Plumb getting/setting xattrs through InodeOperations and 9p gofer interfaces.
There was a very bare get/setxattr in the InodeOperations interface. Add
context.Context to both, size to getxattr, and flags to setxattr.
Note that extended attributes are passed around as strings in this
implementation, so size is automatically encoded into the value. Size is
added in getxattr so that implementations can return ERANGE if a value is larger
than can fit in the user-allocated buffer. This prevents us from unnecessarily
passing around an arbitrarily large xattr when the user buffer is actually too
small.

Don't use the existing xattrwalk and xattrcreate messages and define our
own, mainly for the sake of simplicity.

Extended attributes will be implemented in future commits.

PiperOrigin-RevId: 290121300
2020-01-16 12:56:33 -08:00
gVisor bot d09b1da02d Merge release-20191213.0-96-g27500d5 (automated) 2020-01-10 06:14:54 +00:00
Ian Gudger 27500d529f New sync package.
* Rename syncutil to sync.
* Add aliases to sync types.
* Replace existing usage of standard library sync package.

This will make it easier to swap out synchronization primitives. For example,
this will allow us to use primitives from github.com/sasha-s/go-deadlock to
check for lock ordering violations.

Updates #1472

PiperOrigin-RevId: 289033387
2020-01-09 22:02:24 -08:00
gVisor bot ce4512ac79 Merge release-20191210.0-35-g0881abd (automated) 2019-12-17 00:35:45 +00:00
Nicolas Lacasse 0881abdfdd Remove useless comments from p9/handlers.go.
These comments provided nothing, and have been copy-pasted into all
implementations. The code is clear without them.

I considered also removing the "handle implements handler.handle" comments, but
will let those stay for now.

PiperOrigin-RevId: 285876428
2019-12-16 16:32:59 -08:00
gVisor bot bd17bba359 Merge release-20191114.0-16-g012102e (automated) 2019-11-20 23:12:35 +00:00
Nicolas Lacasse 012102eefd Pass OpenTruncate to gofer in Open call when opening file with O_TRUNC.
Note that the Sentry still calls Truncate() on the file before calling Open.

A new p9 version check was added to ensure that the p9 server can handle the
the OpenTruncate flag. If not, then the flag is stripped before sending.

PiperOrigin-RevId: 281609112
2019-11-20 15:07:16 -08:00
gVisor bot be58d8f293 Merge release-20191104.0-46-g76039f8 (automated) 2019-11-15 19:48:29 +00:00
Jamie Liu 76039f8959 Do not set finalizer on p9.ClientFile.
Aside from the performance hit, there is no guarantee that p9.ClientFile's
finalizer runs before the associated p9.Client is closed.

PiperOrigin-RevId: 280702509
2019-11-15 11:40:52 -08:00
gVisor bot 2d83627b99 Merge release-20190806.1-377-gf8ffadd (automated) 2019-11-07 01:15:55 +00:00