aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2012-09-14 17:24:11 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-01 18:33:33 -0400
commit896526174ce2b6a773e187ebe5a047b68230e2c4 (patch)
tree0f994ab0746003d4a6355086b24051664c89612d /fs/nfs/super.c
parentba9b584c1dc37851d9c6ca6d0d2ccba55d9aad04 (diff)
NFS: Introduce "migration" mount option
Currently, the Linux client uses a unique nfs_client_id4.id string when identifying itself to distinct NFS servers. To support transparent state migration, the Linux client will have to use the same nfs_client_id4 string for all servers it communicates with (also known as the "uniform client string" approach). Otherwise NFS servers can not recognize that open and lock state need to be merged after a file system transition. Unfortunately, there are some NFSv4.0 servers currently in the field that do not tolerate the uniform client string approach. Thus, by default, our NFSv4.0 mounts will continue to use the current approach, and we introduce a mount option that switches them to use the uniform model. Client administrators must identify which servers can be mounted with this option. Eventually most NFSv4.0 servers will be able to handle the uniform approach, and we can change the default. The first mount of a server controls the behavior for all subsequent mounts for the lifetime of that set of mounts of that server. After the last mount of that server is gone, the client erases the data structure that tracks the lease. A subsequent lease may then honor a different "migration" setting. This patch adds only the infrastructure for parsing the new mount option. Support for uniform client strings is added in a subsequent patch. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index b8eda700584b..056138d45c11 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -88,6 +88,7 @@ enum {
88 Opt_sharecache, Opt_nosharecache, 88 Opt_sharecache, Opt_nosharecache,
89 Opt_resvport, Opt_noresvport, 89 Opt_resvport, Opt_noresvport,
90 Opt_fscache, Opt_nofscache, 90 Opt_fscache, Opt_nofscache,
91 Opt_migration, Opt_nomigration,
91 92
92 /* Mount options that take integer arguments */ 93 /* Mount options that take integer arguments */
93 Opt_port, 94 Opt_port,
@@ -147,6 +148,8 @@ static const match_table_t nfs_mount_option_tokens = {
147 { Opt_noresvport, "noresvport" }, 148 { Opt_noresvport, "noresvport" },
148 { Opt_fscache, "fsc" }, 149 { Opt_fscache, "fsc" },
149 { Opt_nofscache, "nofsc" }, 150 { Opt_nofscache, "nofsc" },
151 { Opt_migration, "migration" },
152 { Opt_nomigration, "nomigration" },
150 153
151 { Opt_port, "port=%s" }, 154 { Opt_port, "port=%s" },
152 { Opt_rsize, "rsize=%s" }, 155 { Opt_rsize, "rsize=%s" },
@@ -676,6 +679,9 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
676 if (nfss->options & NFS_OPTION_FSCACHE) 679 if (nfss->options & NFS_OPTION_FSCACHE)
677 seq_printf(m, ",fsc"); 680 seq_printf(m, ",fsc");
678 681
682 if (nfss->options & NFS_OPTION_MIGRATION)
683 seq_printf(m, ",migration");
684
679 if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) { 685 if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) {
680 if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE) 686 if (nfss->flags & NFS_MOUNT_LOOKUP_CACHE_NONE)
681 seq_printf(m, ",lookupcache=none"); 687 seq_printf(m, ",lookupcache=none");
@@ -1243,6 +1249,12 @@ static int nfs_parse_mount_options(char *raw,
1243 kfree(mnt->fscache_uniq); 1249 kfree(mnt->fscache_uniq);
1244 mnt->fscache_uniq = NULL; 1250 mnt->fscache_uniq = NULL;
1245 break; 1251 break;
1252 case Opt_migration:
1253 mnt->options |= NFS_OPTION_MIGRATION;
1254 break;
1255 case Opt_nomigration:
1256 mnt->options &= NFS_OPTION_MIGRATION;
1257 break;
1246 1258
1247 /* 1259 /*
1248 * options that take numeric values 1260 * options that take numeric values
@@ -1535,6 +1547,10 @@ static int nfs_parse_mount_options(char *raw,
1535 if (mnt->minorversion && mnt->version != 4) 1547 if (mnt->minorversion && mnt->version != 4)
1536 goto out_minorversion_mismatch; 1548 goto out_minorversion_mismatch;
1537 1549
1550 if (mnt->options & NFS_OPTION_MIGRATION &&
1551 mnt->version != 4 && mnt->minorversion != 0)
1552 goto out_migration_misuse;
1553
1538 /* 1554 /*
1539 * verify that any proto=/mountproto= options match the address 1555 * verify that any proto=/mountproto= options match the address
1540 * familiies in the addr=/mountaddr= options. 1556 * familiies in the addr=/mountaddr= options.
@@ -1572,6 +1588,10 @@ out_minorversion_mismatch:
1572 printk(KERN_INFO "NFS: mount option vers=%u does not support " 1588 printk(KERN_INFO "NFS: mount option vers=%u does not support "
1573 "minorversion=%u\n", mnt->version, mnt->minorversion); 1589 "minorversion=%u\n", mnt->version, mnt->minorversion);
1574 return 0; 1590 return 0;
1591out_migration_misuse:
1592 printk(KERN_INFO
1593 "NFS: 'migration' not supported for this NFS version\n");
1594 return 0;
1575out_nomem: 1595out_nomem:
1576 printk(KERN_INFO "NFS: not enough memory to parse option\n"); 1596 printk(KERN_INFO "NFS: not enough memory to parse option\n");
1577 return 0; 1597 return 0;