diff options
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r-- | Documentation/filesystems/gfs2-uevents.txt | 100 | ||||
-rw-r--r-- | Documentation/filesystems/nfs.txt | 98 |
2 files changed, 198 insertions, 0 deletions
diff --git a/Documentation/filesystems/gfs2-uevents.txt b/Documentation/filesystems/gfs2-uevents.txt new file mode 100644 index 000000000000..fd966dc9979a --- /dev/null +++ b/Documentation/filesystems/gfs2-uevents.txt | |||
@@ -0,0 +1,100 @@ | |||
1 | uevents and GFS2 | ||
2 | ================== | ||
3 | |||
4 | During the lifetime of a GFS2 mount, a number of uevents are generated. | ||
5 | This document explains what the events are and what they are used | ||
6 | for (by gfs_controld in gfs2-utils). | ||
7 | |||
8 | A list of GFS2 uevents | ||
9 | ----------------------- | ||
10 | |||
11 | 1. ADD | ||
12 | |||
13 | The ADD event occurs at mount time. It will always be the first | ||
14 | uevent generated by the newly created filesystem. If the mount | ||
15 | is successful, an ONLINE uevent will follow. If it is not successful | ||
16 | then a REMOVE uevent will follow. | ||
17 | |||
18 | The ADD uevent has two environment variables: SPECTATOR=[0|1] | ||
19 | and RDONLY=[0|1] that specify the spectator status (a read-only mount | ||
20 | with no journal assigned), and read-only (with journal assigned) status | ||
21 | of the filesystem respectively. | ||
22 | |||
23 | 2. ONLINE | ||
24 | |||
25 | The ONLINE uevent is generated after a successful mount or remount. It | ||
26 | has the same environment variables as the ADD uevent. The ONLINE | ||
27 | uevent, along with the two environment variables for spectator and | ||
28 | RDONLY are a relatively recent addition (2.6.32-rc+) and will not | ||
29 | be generated by older kernels. | ||
30 | |||
31 | 3. CHANGE | ||
32 | |||
33 | The CHANGE uevent is used in two places. One is when reporting the | ||
34 | successful mount of the filesystem by the first node (FIRSTMOUNT=Done). | ||
35 | This is used as a signal by gfs_controld that it is then ok for other | ||
36 | nodes in the cluster to mount the filesystem. | ||
37 | |||
38 | The other CHANGE uevent is used to inform of the completion | ||
39 | of journal recovery for one of the filesystems journals. It has | ||
40 | two environment variables, JID= which specifies the journal id which | ||
41 | has just been recovered, and RECOVERY=[Done|Failed] to indicate the | ||
42 | success (or otherwise) of the operation. These uevents are generated | ||
43 | for every journal recovered, whether it is during the initial mount | ||
44 | process or as the result of gfs_controld requesting a specific journal | ||
45 | recovery via the /sys/fs/gfs2/<fsname>/lock_module/recovery file. | ||
46 | |||
47 | Because the CHANGE uevent was used (in early versions of gfs_controld) | ||
48 | without checking the environment variables to discover the state, we | ||
49 | cannot add any more functions to it without running the risk of | ||
50 | someone using an older version of the user tools and breaking their | ||
51 | cluster. For this reason the ONLINE uevent was used when adding a new | ||
52 | uevent for a successful mount or remount. | ||
53 | |||
54 | 4. OFFLINE | ||
55 | |||
56 | The OFFLINE uevent is only generated due to filesystem errors and is used | ||
57 | as part of the "withdraw" mechanism. Currently this doesn't give any | ||
58 | information about what the error is, which is something that needs to | ||
59 | be fixed. | ||
60 | |||
61 | 5. REMOVE | ||
62 | |||
63 | The REMOVE uevent is generated at the end of an unsuccessful mount | ||
64 | or at the end of a umount of the filesystem. All REMOVE uevents will | ||
65 | have been preceeded by at least an ADD uevent for the same fileystem, | ||
66 | and unlike the other uevents is generated automatically by the kernel's | ||
67 | kobject subsystem. | ||
68 | |||
69 | |||
70 | Information common to all GFS2 uevents (uevent environment variables) | ||
71 | ---------------------------------------------------------------------- | ||
72 | |||
73 | 1. LOCKTABLE= | ||
74 | |||
75 | The LOCKTABLE is a string, as supplied on the mount command | ||
76 | line (locktable=) or via fstab. It is used as a filesystem label | ||
77 | as well as providing the information for a lock_dlm mount to be | ||
78 | able to join the cluster. | ||
79 | |||
80 | 2. LOCKPROTO= | ||
81 | |||
82 | The LOCKPROTO is a string, and its value depends on what is set | ||
83 | on the mount command line, or via fstab. It will be either | ||
84 | lock_nolock or lock_dlm. In the future other lock managers | ||
85 | may be supported. | ||
86 | |||
87 | 3. JOURNALID= | ||
88 | |||
89 | If a journal is in use by the filesystem (journals are not | ||
90 | assigned for spectator mounts) then this will give the | ||
91 | numeric journal id in all GFS2 uevents. | ||
92 | |||
93 | 4. UUID= | ||
94 | |||
95 | With recent versions of gfs2-utils, mkfs.gfs2 writes a UUID | ||
96 | into the filesystem superblock. If it exists, this will | ||
97 | be included in every uevent relating to the filesystem. | ||
98 | |||
99 | |||
100 | |||
diff --git a/Documentation/filesystems/nfs.txt b/Documentation/filesystems/nfs.txt new file mode 100644 index 000000000000..f50f26ce6cd0 --- /dev/null +++ b/Documentation/filesystems/nfs.txt | |||
@@ -0,0 +1,98 @@ | |||
1 | |||
2 | The NFS client | ||
3 | ============== | ||
4 | |||
5 | The NFS version 2 protocol was first documented in RFC1094 (March 1989). | ||
6 | Since then two more major releases of NFS have been published, with NFSv3 | ||
7 | being documented in RFC1813 (June 1995), and NFSv4 in RFC3530 (April | ||
8 | 2003). | ||
9 | |||
10 | The Linux NFS client currently supports all the above published versions, | ||
11 | and work is in progress on adding support for minor version 1 of the NFSv4 | ||
12 | protocol. | ||
13 | |||
14 | The purpose of this document is to provide information on some of the | ||
15 | upcall interfaces that are used in order to provide the NFS client with | ||
16 | some of the information that it requires in order to fully comply with | ||
17 | the NFS spec. | ||
18 | |||
19 | The DNS resolver | ||
20 | ================ | ||
21 | |||
22 | NFSv4 allows for one server to refer the NFS client to data that has been | ||
23 | migrated onto another server by means of the special "fs_locations" | ||
24 | attribute. See | ||
25 | http://tools.ietf.org/html/rfc3530#section-6 | ||
26 | and | ||
27 | http://tools.ietf.org/html/draft-ietf-nfsv4-referrals-00 | ||
28 | |||
29 | The fs_locations information can take the form of either an ip address and | ||
30 | a path, or a DNS hostname and a path. The latter requires the NFS client to | ||
31 | do a DNS lookup in order to mount the new volume, and hence the need for an | ||
32 | upcall to allow userland to provide this service. | ||
33 | |||
34 | Assuming that the user has the 'rpc_pipefs' filesystem mounted in the usual | ||
35 | /var/lib/nfs/rpc_pipefs, the upcall consists of the following steps: | ||
36 | |||
37 | (1) The process checks the dns_resolve cache to see if it contains a | ||
38 | valid entry. If so, it returns that entry and exits. | ||
39 | |||
40 | (2) If no valid entry exists, the helper script '/sbin/nfs_cache_getent' | ||
41 | (may be changed using the 'nfs.cache_getent' kernel boot parameter) | ||
42 | is run, with two arguments: | ||
43 | - the cache name, "dns_resolve" | ||
44 | - the hostname to resolve | ||
45 | |||
46 | (3) After looking up the corresponding ip address, the helper script | ||
47 | writes the result into the rpc_pipefs pseudo-file | ||
48 | '/var/lib/nfs/rpc_pipefs/cache/dns_resolve/channel' | ||
49 | in the following (text) format: | ||
50 | |||
51 | "<ip address> <hostname> <ttl>\n" | ||
52 | |||
53 | Where <ip address> is in the usual IPv4 (123.456.78.90) or IPv6 | ||
54 | (ffee:ddcc:bbaa:9988:7766:5544:3322:1100, ffee::1100, ...) format. | ||
55 | <hostname> is identical to the second argument of the helper | ||
56 | script, and <ttl> is the 'time to live' of this cache entry (in | ||
57 | units of seconds). | ||
58 | |||
59 | Note: If <ip address> is invalid, say the string "0", then a negative | ||
60 | entry is created, which will cause the kernel to treat the hostname | ||
61 | as having no valid DNS translation. | ||
62 | |||
63 | |||
64 | |||
65 | |||
66 | A basic sample /sbin/nfs_cache_getent | ||
67 | ===================================== | ||
68 | |||
69 | #!/bin/bash | ||
70 | # | ||
71 | ttl=600 | ||
72 | # | ||
73 | cut=/usr/bin/cut | ||
74 | getent=/usr/bin/getent | ||
75 | rpc_pipefs=/var/lib/nfs/rpc_pipefs | ||
76 | # | ||
77 | die() | ||
78 | { | ||
79 | echo "Usage: $0 cache_name entry_name" | ||
80 | exit 1 | ||
81 | } | ||
82 | |||
83 | [ $# -lt 2 ] && die | ||
84 | cachename="$1" | ||
85 | cache_path=${rpc_pipefs}/cache/${cachename}/channel | ||
86 | |||
87 | case "${cachename}" in | ||
88 | dns_resolve) | ||
89 | name="$2" | ||
90 | result="$(${getent} hosts ${name} | ${cut} -f1 -d\ )" | ||
91 | [ -z "${result}" ] && result="0" | ||
92 | ;; | ||
93 | *) | ||
94 | die | ||
95 | ;; | ||
96 | esac | ||
97 | echo "${result} ${name} ${ttl}" >${cache_path} | ||
98 | |||