xref: /linux/Documentation/filesystems/9p.rst (revision 8142db4f2792717837b97e219e5f5203dde17abb)
107d241fdSMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
207d241fdSMauro Carvalho Chehab
307d241fdSMauro Carvalho Chehab=======================================
407d241fdSMauro Carvalho Chehabv9fs: Plan 9 Resource Sharing for Linux
507d241fdSMauro Carvalho Chehab=======================================
607d241fdSMauro Carvalho Chehab
707d241fdSMauro Carvalho ChehabAbout
807d241fdSMauro Carvalho Chehab=====
907d241fdSMauro Carvalho Chehab
1007d241fdSMauro Carvalho Chehabv9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol.
1107d241fdSMauro Carvalho Chehab
1207d241fdSMauro Carvalho ChehabThis software was originally developed by Ron Minnich <rminnich@sandia.gov>
1307d241fdSMauro Carvalho Chehaband Maya Gokhale.  Additional development by Greg Watson
1407d241fdSMauro Carvalho Chehab<gwatson@lanl.gov> and most recently Eric Van Hensbergen
1507d241fdSMauro Carvalho Chehab<ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox
1607d241fdSMauro Carvalho Chehab<rsc@swtch.com>.
1707d241fdSMauro Carvalho Chehab
1807d241fdSMauro Carvalho ChehabThe best detailed explanation of the Linux implementation and applications of
1907d241fdSMauro Carvalho Chehabthe 9p client is available in the form of a USENIX paper:
2007d241fdSMauro Carvalho Chehab
210f540b95SAlexander A. Klimov   https://www.usenix.org/events/usenix05/tech/freenix/hensbergen.html
2207d241fdSMauro Carvalho Chehab
2307d241fdSMauro Carvalho ChehabOther applications are described in the following papers:
2407d241fdSMauro Carvalho Chehab
2507d241fdSMauro Carvalho Chehab	* XCPU & Clustering
2607d241fdSMauro Carvalho Chehab	  http://xcpu.org/papers/xcpu-talk.pdf
2707d241fdSMauro Carvalho Chehab	* KVMFS: control file system for KVM
2807d241fdSMauro Carvalho Chehab	  http://xcpu.org/papers/kvmfs.pdf
2907d241fdSMauro Carvalho Chehab	* CellFS: A New Programming Model for the Cell BE
3007d241fdSMauro Carvalho Chehab	  http://xcpu.org/papers/cellfs-talk.pdf
3107d241fdSMauro Carvalho Chehab	* PROSE I/O: Using 9p to enable Application Partitions
3207d241fdSMauro Carvalho Chehab	  http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf
3307d241fdSMauro Carvalho Chehab	* VirtFS: A Virtualization Aware File System pass-through
3407d241fdSMauro Carvalho Chehab	  http://goo.gl/3WPDg
3507d241fdSMauro Carvalho Chehab
3607d241fdSMauro Carvalho ChehabUsage
3707d241fdSMauro Carvalho Chehab=====
3807d241fdSMauro Carvalho Chehab
3907d241fdSMauro Carvalho ChehabFor remote file server::
4007d241fdSMauro Carvalho Chehab
4107d241fdSMauro Carvalho Chehab	mount -t 9p 10.10.1.2 /mnt/9
4207d241fdSMauro Carvalho Chehab
4307d241fdSMauro Carvalho ChehabFor Plan 9 From User Space applications (http://swtch.com/plan9)::
4407d241fdSMauro Carvalho Chehab
4507d241fdSMauro Carvalho Chehab	mount -t 9p `namespace`/acme /mnt/9 -o trans=unix,uname=$USER
4607d241fdSMauro Carvalho Chehab
4707d241fdSMauro Carvalho ChehabFor server running on QEMU host with virtio transport::
4807d241fdSMauro Carvalho Chehab
4907d241fdSMauro Carvalho Chehab	mount -t 9p -o trans=virtio <mount_tag> /mnt/9
5007d241fdSMauro Carvalho Chehab
5107d241fdSMauro Carvalho Chehabwhere mount_tag is the tag associated by the server to each of the exported
5207d241fdSMauro Carvalho Chehabmount points. Each 9P export is seen by the client as a virtio device with an
5307d241fdSMauro Carvalho Chehabassociated "mount_tag" property. Available mount tags can be
5407d241fdSMauro Carvalho Chehabseen by reading /sys/bus/virtio/drivers/9pnet_virtio/virtio<n>/mount_tag files.
5507d241fdSMauro Carvalho Chehab
5607d241fdSMauro Carvalho ChehabOptions
5707d241fdSMauro Carvalho Chehab=======
5807d241fdSMauro Carvalho Chehab
5907d241fdSMauro Carvalho Chehab  ============= ===============================================================
6007d241fdSMauro Carvalho Chehab  trans=name	select an alternative transport.  Valid options are
6107d241fdSMauro Carvalho Chehab  		currently:
6207d241fdSMauro Carvalho Chehab
6307d241fdSMauro Carvalho Chehab			========  ============================================
6407d241fdSMauro Carvalho Chehab			unix 	  specifying a named pipe mount point
6507d241fdSMauro Carvalho Chehab			tcp	  specifying a normal TCP/IP connection
6607d241fdSMauro Carvalho Chehab			fd   	  used passed file descriptors for connection
6707d241fdSMauro Carvalho Chehab                                  (see rfdno and wfdno)
6807d241fdSMauro Carvalho Chehab			virtio	  connect to the next virtio channel available
6907d241fdSMauro Carvalho Chehab				  (from QEMU with trans_virtio module)
7007d241fdSMauro Carvalho Chehab			rdma	  connect to a specified RDMA channel
7107d241fdSMauro Carvalho Chehab			========  ============================================
7207d241fdSMauro Carvalho Chehab
7307d241fdSMauro Carvalho Chehab  uname=name	user name to attempt mount as on the remote server.  The
7407d241fdSMauro Carvalho Chehab  		server may override or ignore this value.  Certain user
7507d241fdSMauro Carvalho Chehab		names may require authentication.
7607d241fdSMauro Carvalho Chehab
7707d241fdSMauro Carvalho Chehab  aname=name	aname specifies the file tree to access when the server is
7807d241fdSMauro Carvalho Chehab  		offering several exported file systems.
7907d241fdSMauro Carvalho Chehab
8007d241fdSMauro Carvalho Chehab  cache=mode	specifies a caching policy.  By default, no caches are used.
8107d241fdSMauro Carvalho Chehab
8207d241fdSMauro Carvalho Chehab                        none
8307d241fdSMauro Carvalho Chehab				default no cache policy, metadata and data
8407d241fdSMauro Carvalho Chehab                                alike are synchronous.
8507d241fdSMauro Carvalho Chehab			loose
8607d241fdSMauro Carvalho Chehab				no attempts are made at consistency,
8707d241fdSMauro Carvalho Chehab                                intended for exclusive, read-only mounts
8807d241fdSMauro Carvalho Chehab                        fscache
8907d241fdSMauro Carvalho Chehab				use FS-Cache for a persistent, read-only
9007d241fdSMauro Carvalho Chehab				cache backend.
9107d241fdSMauro Carvalho Chehab                        mmap
9207d241fdSMauro Carvalho Chehab				minimal cache that is only used for read-write
9307d241fdSMauro Carvalho Chehab                                mmap.  Northing else is cached, like cache=none
9407d241fdSMauro Carvalho Chehab
9507d241fdSMauro Carvalho Chehab  debug=n	specifies debug level.  The debug level is a bitmask.
9607d241fdSMauro Carvalho Chehab
9707d241fdSMauro Carvalho Chehab			=====   ================================
9807d241fdSMauro Carvalho Chehab			0x01    display verbose error messages
9907d241fdSMauro Carvalho Chehab			0x02    developer debug (DEBUG_CURRENT)
10007d241fdSMauro Carvalho Chehab			0x04    display 9p trace
10107d241fdSMauro Carvalho Chehab			0x08    display VFS trace
10207d241fdSMauro Carvalho Chehab			0x10    display Marshalling debug
10307d241fdSMauro Carvalho Chehab			0x20    display RPC debug
10407d241fdSMauro Carvalho Chehab			0x40    display transport debug
10507d241fdSMauro Carvalho Chehab			0x80    display allocation debug
10607d241fdSMauro Carvalho Chehab			0x100   display protocol message debug
10707d241fdSMauro Carvalho Chehab			0x200   display Fid debug
10807d241fdSMauro Carvalho Chehab			0x400   display packet debug
10907d241fdSMauro Carvalho Chehab			0x800   display fscache tracing debug
11007d241fdSMauro Carvalho Chehab			=====   ================================
11107d241fdSMauro Carvalho Chehab
11207d241fdSMauro Carvalho Chehab  rfdno=n	the file descriptor for reading with trans=fd
11307d241fdSMauro Carvalho Chehab
11407d241fdSMauro Carvalho Chehab  wfdno=n	the file descriptor for writing with trans=fd
11507d241fdSMauro Carvalho Chehab
11607d241fdSMauro Carvalho Chehab  msize=n	the number of bytes to use for 9p packet payload
11707d241fdSMauro Carvalho Chehab
11807d241fdSMauro Carvalho Chehab  port=n	port to connect to on the remote server
11907d241fdSMauro Carvalho Chehab
12007d241fdSMauro Carvalho Chehab  noextend	force legacy mode (no 9p2000.u or 9p2000.L semantics)
12107d241fdSMauro Carvalho Chehab
12207d241fdSMauro Carvalho Chehab  version=name	Select 9P protocol version. Valid options are:
12307d241fdSMauro Carvalho Chehab
12407d241fdSMauro Carvalho Chehab			========        ==============================
12507d241fdSMauro Carvalho Chehab			9p2000          Legacy mode (same as noextend)
12607d241fdSMauro Carvalho Chehab			9p2000.u        Use 9P2000.u protocol
12707d241fdSMauro Carvalho Chehab			9p2000.L        Use 9P2000.L protocol
12807d241fdSMauro Carvalho Chehab			========        ==============================
12907d241fdSMauro Carvalho Chehab
13007d241fdSMauro Carvalho Chehab  dfltuid	attempt to mount as a particular uid
13107d241fdSMauro Carvalho Chehab
13207d241fdSMauro Carvalho Chehab  dfltgid	attempt to mount with a particular gid
13307d241fdSMauro Carvalho Chehab
13407d241fdSMauro Carvalho Chehab  afid		security channel - used by Plan 9 authentication protocols
13507d241fdSMauro Carvalho Chehab
13607d241fdSMauro Carvalho Chehab  nodevmap	do not map special files - represent them as normal files.
13707d241fdSMauro Carvalho Chehab  		This can be used to share devices/named pipes/sockets between
13807d241fdSMauro Carvalho Chehab		hosts.  This functionality will be expanded in later versions.
13907d241fdSMauro Carvalho Chehab
140*8142db4fSEric Van Hensbergen  noxattr	do not offer xattr functions on this mount.
141*8142db4fSEric Van Hensbergen
14207d241fdSMauro Carvalho Chehab  access	there are four access modes.
14307d241fdSMauro Carvalho Chehab			user
14407d241fdSMauro Carvalho Chehab				if a user tries to access a file on v9fs
14507d241fdSMauro Carvalho Chehab			        filesystem for the first time, v9fs sends an
14607d241fdSMauro Carvalho Chehab			        attach command (Tattach) for that user.
14707d241fdSMauro Carvalho Chehab				This is the default mode.
14807d241fdSMauro Carvalho Chehab			<uid>
14907d241fdSMauro Carvalho Chehab				allows only user with uid=<uid> to access
15007d241fdSMauro Carvalho Chehab				the files on the mounted filesystem
15107d241fdSMauro Carvalho Chehab			any
15207d241fdSMauro Carvalho Chehab				v9fs does single attach and performs all
15307d241fdSMauro Carvalho Chehab				operations as one user
15407d241fdSMauro Carvalho Chehab			clien
15507d241fdSMauro Carvalho Chehab				 ACL based access check on the 9p client
15607d241fdSMauro Carvalho Chehab			         side for access validation
15707d241fdSMauro Carvalho Chehab
15807d241fdSMauro Carvalho Chehab  cachetag	cache tag to use the specified persistent cache.
15907d241fdSMauro Carvalho Chehab		cache tags for existing cache sessions can be listed at
16007d241fdSMauro Carvalho Chehab		/sys/fs/9p/caches. (applies only to cache=fscache)
16107d241fdSMauro Carvalho Chehab  ============= ===============================================================
16207d241fdSMauro Carvalho Chehab
1635d30bcacSLinus TorvaldsBehavior
1645d30bcacSLinus Torvalds========
1655d30bcacSLinus Torvalds
1665d30bcacSLinus TorvaldsThis section aims at describing 9p 'quirks' that can be different
1675d30bcacSLinus Torvaldsfrom a local filesystem behaviors.
1685d30bcacSLinus Torvalds
1695d30bcacSLinus Torvalds - Setting O_NONBLOCK on a file will make client reads return as early
1705d30bcacSLinus Torvalds   as the server returns some data instead of trying to fill the read
1715d30bcacSLinus Torvalds   buffer with the requested amount of bytes or end of file is reached.
1725d30bcacSLinus Torvalds
17307d241fdSMauro Carvalho ChehabResources
17407d241fdSMauro Carvalho Chehab=========
17507d241fdSMauro Carvalho Chehab
17607d241fdSMauro Carvalho ChehabProtocol specifications are maintained on github:
17707d241fdSMauro Carvalho Chehabhttp://ericvh.github.com/9p-rfc/
17807d241fdSMauro Carvalho Chehab
17907d241fdSMauro Carvalho Chehab9p client and server implementations are listed on
18007d241fdSMauro Carvalho Chehabhttp://9p.cat-v.org/implementations
18107d241fdSMauro Carvalho Chehab
18207d241fdSMauro Carvalho ChehabA 9p2000.L server is being developed by LLNL and can be found
18307d241fdSMauro Carvalho Chehabat http://code.google.com/p/diod/
18407d241fdSMauro Carvalho Chehab
18507d241fdSMauro Carvalho ChehabThere are user and developer mailing lists available through the v9fs project
18607d241fdSMauro Carvalho Chehabon sourceforge (http://sourceforge.net/projects/v9fs).
18707d241fdSMauro Carvalho Chehab
18807d241fdSMauro Carvalho ChehabNews and other information is maintained on a Wiki.
18907d241fdSMauro Carvalho Chehab(http://sf.net/apps/mediawiki/v9fs/index.php).
19007d241fdSMauro Carvalho Chehab
19107d241fdSMauro Carvalho ChehabBug reports are best issued via the mailing list.
19207d241fdSMauro Carvalho Chehab
19307d241fdSMauro Carvalho ChehabFor more information on the Plan 9 Operating System check out
19407d241fdSMauro Carvalho Chehabhttp://plan9.bell-labs.com/plan9
19507d241fdSMauro Carvalho Chehab
19607d241fdSMauro Carvalho ChehabFor information on Plan 9 from User Space (Plan 9 applications and libraries
197b529c06fSJuan Manuel Méndez Reyported to Linux/BSD/OSX/etc) check out https://9fans.github.io/plan9port/
198