Update gofer mount options to only show version for 9P.

PiperOrigin-RevId: 487493605
This commit is contained in:
Ayush Ranjan
2022-11-10 03:59:37 -08:00
committed by gVisor bot
parent edc16b49e3
commit 93b37dad70
2 changed files with 20 additions and 16 deletions
+4 -1
View File
@@ -1898,7 +1898,6 @@ func (fs *filesystem) MountOptions() string {
{moptDfltUID, fs.opts.dfltuid},
{moptDfltGID, fs.opts.dfltgid},
{moptMsize, fs.opts.msize},
{moptVersion, fs.opts.version},
}
switch fs.opts.interop {
@@ -1923,7 +1922,11 @@ func (fs *filesystem) MountOptions() string {
optsKV = append(optsKV, mopt{moptOverlayfsStaleRead, nil})
}
if fs.opts.lisaEnabled {
// LISAFS does not have a protocol level version number. Simply add
// `lisafs` in the opts to indicate that we are using LISAFS.
optsKV = append(optsKV, mopt{moptLisafs, nil})
} else {
optsKV = append(optsKV, mopt{moptVersion, fs.opts.version9P})
}
opts := make([]string, 0, len(optsKV))
+16 -15
View File
@@ -212,13 +212,13 @@ type filesystem struct {
// +stateify savable
type filesystemOptions struct {
// "Standard" 9P options.
fd int
aname string
interop InteropMode // derived from the "cache" mount option
dfltuid auth.KUID
dfltgid auth.KGID
msize uint32
version string
fd int
aname string
interop InteropMode // derived from the "cache" mount option
dfltuid auth.KUID
dfltgid auth.KGID
msize uint32
version9P string
// If forcePageCache is true, host FDs may not be used for application
// memory mappings even if available; instead, the client must perform its
@@ -438,13 +438,6 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt
fsopts.msize = uint32(msize)
}
// Parse the 9P protocol version.
fsopts.version = p9.HighestVersionString()
if version, ok := mopts[moptVersion]; ok {
delete(mopts, moptVersion)
fsopts.version = version
}
// Handle simple flags.
if _, ok := mopts[moptForcePageCache]; ok {
delete(mopts, moptForcePageCache)
@@ -466,6 +459,14 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt
return nil, nil, linuxerr.EINVAL
}
}
if !fsopts.lisaEnabled {
// Parse the 9P protocol version.
fsopts.version9P = p9.HighestVersionString()
if version, ok := mopts[moptVersion]; ok {
delete(mopts, moptVersion)
fsopts.version9P = version
}
}
// fsopts.regularFilesUseSpecialFileFD can only be enabled by specifying
// "cache=none".
@@ -673,7 +674,7 @@ func (fs *filesystem) dial(ctx context.Context) error {
// Perform version negotiation with the server.
ctx.UninterruptibleSleepStart(false)
client, err := p9.NewClient(conn, fs.opts.msize, fs.opts.version)
client, err := p9.NewClient(conn, fs.opts.msize, fs.opts.version9P)
ctx.UninterruptibleSleepFinish(false)
if err != nil {
conn.Close()