]>
Commit | Line | Data |
---|---|---|
65228de5 JR |
1 | commit e916e9e47a6a932872641d0da1f7bd4927b63fee |
2 | Author: Steve Dickson <steved@redhat.com> | |
3 | Date: Mon Aug 13 11:04:02 2007 -0400 | |
4 | ||
5 | Adds support for the 'nosharecache' mount option to nfs-utils. | |
6 | ||
7 | Signed-off-by: Steve Dickson <steved@redhat.com> | |
8 | ||
9 | diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man | |
10 | index 673556c..e66daba 100644 | |
11 | --- a/utils/mount/nfs.man | |
12 | +++ b/utils/mount/nfs.man | |
13 | @@ -288,6 +288,23 @@ Mount the NFS filesystem using the UDP protocol. | |
14 | Disables NFSv3 READDIRPLUS RPCs. Use this option when | |
15 | mounting servers that don't support or have broken | |
16 | READDIRPLUS implementations. | |
17 | +.TP 1.5i | |
18 | +.I nosharecache | |
19 | +As of kernel 2.6.18, it is no longer possible to mount the same | |
20 | +same filesystem with different mount options to a new mountpoint. | |
21 | +It was deemed unsafe to do so, since cached data cannot be shared | |
22 | +between the two mountpoints. In consequence, files or directories | |
23 | +that were common to both mountpoint subtrees could often be seen to | |
24 | +be out of sync following an update. | |
25 | +.br | |
26 | +This option allows administrators to select the pre-2.6.18 behaviour, | |
27 | +permitting the same filesystem to be mounted with different mount | |
28 | +options. | |
29 | +.br | |
30 | +.B Beware: | |
31 | +Use of this option is not recommended unless you are certain that there | |
32 | +are no hard links or subtrees of this mountpoint that are mounted | |
33 | +elsewhere. | |
34 | .P | |
35 | All of the non-value options have corresponding nooption forms. | |
36 | For example, nointr means don't allow file operations to be | |
37 | @@ -444,6 +461,23 @@ This extracts a | |
38 | server performance penalty but it allows two different NFS clients | |
39 | to get reasonable good results when both clients are actively | |
40 | writing to common filesystem on the server. | |
41 | +.TP 1.5i | |
42 | +.I nosharecache | |
43 | +As of kernel 2.6.18, it is no longer possible to mount the same | |
44 | +same filesystem with different mount options to a new mountpoint. | |
45 | +It was deemed unsafe to do so, since cached data cannot be shared | |
46 | +between the two mountpoints. In consequence, files or directories | |
47 | +that were common to both mountpoint subtrees could often be seen to | |
48 | +be out of sync following an update. | |
49 | +.br | |
50 | +This option allows administrators to select the pre-2.6.18 behaviour, | |
51 | +permitting the same filesystem to be mounted with different mount | |
52 | +options. | |
53 | +.br | |
54 | +.B Beware: | |
55 | +Use of this option is not recommended unless you are certain that there | |
56 | +are no hard links or subtrees of this mountpoint that are mounted | |
57 | +elsewhere. | |
58 | .P | |
59 | All of the non-value options have corresponding nooption forms. | |
60 | For example, nointr means don't allow file operations to be | |
61 | diff --git a/utils/mount/nfs4_mount.h b/utils/mount/nfs4_mount.h | |
62 | index 74c9b95..2fcca6d 100644 | |
63 | --- a/utils/mount/nfs4_mount.h | |
64 | +++ b/utils/mount/nfs4_mount.h | |
65 | @@ -65,6 +65,7 @@ struct nfs4_mount_data { | |
66 | #define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ | |
67 | #define NFS4_MOUNT_NOAC 0x0020 /* 1 */ | |
68 | #define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ | |
69 | +#define NFS4_MOUNT_UNSHARED 0x8000 /* 5 */ | |
70 | #define NFS4_MOUNT_FLAGMASK 0xFFFF | |
71 | ||
72 | /* pseudoflavors: */ | |
73 | diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c | |
74 | index 2a58d0a..0376f32 100644 | |
75 | --- a/utils/mount/nfs4mount.c | |
76 | +++ b/utils/mount/nfs4mount.c | |
77 | @@ -201,7 +201,7 @@ int nfs4mount(const char *spec, const char *node, int *flags, | |
78 | char *s; | |
79 | int val; | |
80 | int bg, soft, intr; | |
81 | - int nocto, noac; | |
82 | + int nocto, noac, unshared; | |
83 | int retry; | |
84 | int retval; | |
85 | time_t timeout, t; | |
86 | @@ -252,6 +252,7 @@ int nfs4mount(const char *spec, const char *node, int *flags, | |
87 | intr = NFS4_MOUNT_INTR; | |
88 | nocto = 0; | |
89 | noac = 0; | |
90 | + unshared = 0; | |
91 | retry = 10000; /* 10000 minutes ~ 1 week */ | |
92 | ||
93 | /* | |
94 | @@ -336,6 +337,8 @@ int nfs4mount(const char *spec, const char *node, int *flags, | |
95 | nocto = !val; | |
96 | else if (!strcmp(opt, "ac")) | |
97 | noac = !val; | |
98 | + else if (!strcmp(opt, "sharecache")) | |
99 | + unshared = !val; | |
100 | else if (!sloppy) { | |
101 | printf(_("unknown nfs mount option: " | |
102 | "%s%s\n"), val ? "" : "no", opt); | |
103 | @@ -347,7 +350,8 @@ int nfs4mount(const char *spec, const char *node, int *flags, | |
104 | data.flags = (soft ? NFS4_MOUNT_SOFT : 0) | |
105 | | (intr ? NFS4_MOUNT_INTR : 0) | |
106 | | (nocto ? NFS4_MOUNT_NOCTO : 0) | |
107 | - | (noac ? NFS4_MOUNT_NOAC : 0); | |
108 | + | (noac ? NFS4_MOUNT_NOAC : 0) | |
109 | + | (unshared ? NFS4_MOUNT_UNSHARED : 0); | |
110 | ||
111 | /* | |
112 | * Give a warning if the rpc.idmapd daemon is not running | |
113 | @@ -388,11 +392,13 @@ int nfs4mount(const char *spec, const char *node, int *flags, | |
114 | data.acregmin, data.acregmax, data.acdirmin, data.acdirmax); | |
115 | printf("port = %d, bg = %d, retry = %d, flags = %.8x\n", | |
116 | ntohs(server_addr.sin_port), bg, retry, data.flags); | |
117 | - printf("soft = %d, intr = %d, nocto = %d, noac = %d\n", | |
118 | + printf("soft = %d, intr = %d, nocto = %d, noac = %d, " | |
119 | + "nosharecache = %d\n", | |
120 | (data.flags & NFS4_MOUNT_SOFT) != 0, | |
121 | (data.flags & NFS4_MOUNT_INTR) != 0, | |
122 | (data.flags & NFS4_MOUNT_NOCTO) != 0, | |
123 | - (data.flags & NFS4_MOUNT_NOAC) != 0); | |
124 | + (data.flags & NFS4_MOUNT_NOAC) != 0, | |
125 | + (data.flags & NFS4_MOUNT_UNSHARED) != 0); | |
126 | ||
127 | if (num_flavour > 0) { | |
128 | int pf_cnt, i; | |
129 | diff --git a/utils/mount/nfs_mount.h b/utils/mount/nfs_mount.h | |
130 | index 4a061d8..50ce2a8 100644 | |
131 | --- a/utils/mount/nfs_mount.h | |
132 | +++ b/utils/mount/nfs_mount.h | |
133 | @@ -64,6 +64,7 @@ struct nfs_mount_data { | |
134 | #define NFS_MOUNT_NOACL 0x0800 /* 4 */ | |
135 | #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ | |
136 | #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ | |
137 | +#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ | |
138 | ||
139 | /* security pseudoflavors */ | |
140 | ||
141 | diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c | |
142 | index 815064a..f21aaff 100644 | |
143 | --- a/utils/mount/nfsmount.c | |
144 | +++ b/utils/mount/nfsmount.c | |
145 | @@ -804,6 +804,10 @@ parse_options(char *old_opts, struct nfs_mount_data *data, | |
146 | data->flags &= ~NFS_MOUNT_NORDIRPLUS; | |
147 | if (!val) | |
148 | data->flags |= NFS_MOUNT_NORDIRPLUS; | |
149 | + } else if (!strcmp(opt, "sharecache")) { | |
150 | + data->flags &= ~NFS_MOUNT_UNSHARED; | |
151 | + if (!val) | |
152 | + data->flags |= NFS_MOUNT_UNSHARED; | |
153 | #endif | |
154 | } else { | |
155 | bad_option: |