summaryrefslogtreecommitdiffstats
path: root/utils/mount/nfs4mount.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 10:03:22 +1000
committerNeil Brown <neilb@suse.de>2007-07-10 10:03:22 +1000
commit3ecc5650e25fbcfe6d1b885b69c00d515cd485ce (patch)
treefbfbffd068c510ec15d2775a277ca6c68c700b5d /utils/mount/nfs4mount.c
parent3b55934b9baefecee17aefc3ea139e261a4b03b8 (diff)
downloadnfs-utils-3ecc5650e25fbcfe6d1b885b69c00d515cd485ce.tar.gz
nfs-utils-3ecc5650e25fbcfe6d1b885b69c00d515cd485ce.tar.xz
nfs-utils-3ecc5650e25fbcfe6d1b885b69c00d515cd485ce.zip
mount.nfs: Add the mount option "nosharecache"
Prior to David Howell's mount changes in 2.6.18, users who mounted different directories which happened to be from the same filesystem on the server would get different super blocks, and hence could choose different mount options. As long as there were no hard linked files that crossed from one subtree to another, this was quite safe. Post the changes, if the two directories are on the same filesystem (have the same 'fsid'), they will share the same super block, and hence the same mount options. Add a flag to allow users to elect not to share the NFS super block with another mount point, even if the fsids are the same. This will allow users to set different mount options for the two different super blocks, as was previously possible. It is still up to the user to ensure that there are no cache coherency issues when doing this, however the default behaviour will be to share super blocks whenever two paths result in the same fsid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/mount/nfs4mount.c')
-rw-r--r--utils/mount/nfs4mount.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c
index 2a58d0a..0376f32 100644
--- a/utils/mount/nfs4mount.c
+++ b/utils/mount/nfs4mount.c
@@ -201,7 +201,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
char *s;
int val;
int bg, soft, intr;
- int nocto, noac;
+ int nocto, noac, unshared;
int retry;
int retval;
time_t timeout, t;
@@ -252,6 +252,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
intr = NFS4_MOUNT_INTR;
nocto = 0;
noac = 0;
+ unshared = 0;
retry = 10000; /* 10000 minutes ~ 1 week */
/*
@@ -336,6 +337,8 @@ int nfs4mount(const char *spec, const char *node, int *flags,
nocto = !val;
else if (!strcmp(opt, "ac"))
noac = !val;
+ else if (!strcmp(opt, "sharecache"))
+ unshared = !val;
else if (!sloppy) {
printf(_("unknown nfs mount option: "
"%s%s\n"), val ? "" : "no", opt);
@@ -347,7 +350,8 @@ int nfs4mount(const char *spec, const char *node, int *flags,
data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
| (intr ? NFS4_MOUNT_INTR : 0)
| (nocto ? NFS4_MOUNT_NOCTO : 0)
- | (noac ? NFS4_MOUNT_NOAC : 0);
+ | (noac ? NFS4_MOUNT_NOAC : 0)
+ | (unshared ? NFS4_MOUNT_UNSHARED : 0);
/*
* Give a warning if the rpc.idmapd daemon is not running
@@ -388,11 +392,13 @@ int nfs4mount(const char *spec, const char *node, int *flags,
data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
ntohs(server_addr.sin_port), bg, retry, data.flags);
- printf("soft = %d, intr = %d, nocto = %d, noac = %d\n",
+ printf("soft = %d, intr = %d, nocto = %d, noac = %d, "
+ "nosharecache = %d\n",
(data.flags & NFS4_MOUNT_SOFT) != 0,
(data.flags & NFS4_MOUNT_INTR) != 0,
(data.flags & NFS4_MOUNT_NOCTO) != 0,
- (data.flags & NFS4_MOUNT_NOAC) != 0);
+ (data.flags & NFS4_MOUNT_NOAC) != 0,
+ (data.flags & NFS4_MOUNT_UNSHARED) != 0);
if (num_flavour > 0) {
int pf_cnt, i;