diff options
author | David Howells <dhowells@redhat.com> | 2009-09-23 14:36:39 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-09-23 14:36:39 -0400 |
commit | 2df54806389205d76bc3d1ce8a10cc14889ddec9 (patch) | |
tree | 7c1c170e39d50dd105792e25522e249ea371758e /fs | |
parent | 4111d4fde6aa04a2e42c43d0e74593e6144b0f0f (diff) |
NFS: Propagate 'fsc' mount option through automounts
Propagate the NFS 'fsc' mount option through NFS automounts of various types.
This is now required as commit:
commit c02d7adf8c5429727a98bad1d039bccad4c61c50
Author: Trond Myklebust <Trond.Myklebust@netapp.com>
Date: Mon Jun 22 15:09:14 2009 -0400
NFSv4: Replace nfs4_path_walk() with VFS path lookup in a private namespace
uses VFS-driven automounting to reach all submounts barring the root, thus
preventing fscaching from being enabled on any submount other than the root.
This patch gets around that by propagating the NFS_OPTION_FSCACHE flag across
automounts. If a uniquifier is supplied to a mount then this is propagated to
all automounts of that mount too.
Signed-off-by: David Howells <dhowells@redhat.com>
[Trond: Fixed up the definition of nfs_fscache_get_super_cookie for the
case of #undef CONFIG_NFS_FSCACHE]
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/client.c | 1 | ||||
-rw-r--r-- | fs/nfs/fscache.c | 25 | ||||
-rw-r--r-- | fs/nfs/fscache.h | 6 | ||||
-rw-r--r-- | fs/nfs/super.c | 9 |
4 files changed, 33 insertions, 8 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 73ddefba7aa3..63976c0ccc25 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -970,6 +970,7 @@ static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_serve | |||
970 | target->acdirmin = source->acdirmin; | 970 | target->acdirmin = source->acdirmin; |
971 | target->acdirmax = source->acdirmax; | 971 | target->acdirmax = source->acdirmax; |
972 | target->caps = source->caps; | 972 | target->caps = source->caps; |
973 | target->options = source->options; | ||
973 | } | 974 | } |
974 | 975 | ||
975 | /* | 976 | /* |
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index 379be678cb7e..70fad69eb959 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c | |||
@@ -58,17 +58,34 @@ void nfs_fscache_release_client_cookie(struct nfs_client *clp) | |||
58 | /* | 58 | /* |
59 | * Get the cache cookie for an NFS superblock. We have to handle | 59 | * Get the cache cookie for an NFS superblock. We have to handle |
60 | * uniquification here because the cache doesn't do it for us. | 60 | * uniquification here because the cache doesn't do it for us. |
61 | * | ||
62 | * The default uniquifier is just an empty string, but it may be overridden | ||
63 | * either by the 'fsc=xxx' option to mount, or by inheriting it from the parent | ||
64 | * superblock across an automount point of some nature. | ||
61 | */ | 65 | */ |
62 | void nfs_fscache_get_super_cookie(struct super_block *sb, | 66 | void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, |
63 | struct nfs_parsed_mount_data *data) | 67 | struct nfs_clone_mount *mntdata) |
64 | { | 68 | { |
65 | struct nfs_fscache_key *key, *xkey; | 69 | struct nfs_fscache_key *key, *xkey; |
66 | struct nfs_server *nfss = NFS_SB(sb); | 70 | struct nfs_server *nfss = NFS_SB(sb); |
67 | struct rb_node **p, *parent; | 71 | struct rb_node **p, *parent; |
68 | const char *uniq = data->fscache_uniq ?: ""; | ||
69 | int diff, ulen; | 72 | int diff, ulen; |
70 | 73 | ||
71 | ulen = strlen(uniq); | 74 | if (uniq) { |
75 | ulen = strlen(uniq); | ||
76 | } else if (mntdata) { | ||
77 | struct nfs_server *mnt_s = NFS_SB(mntdata->sb); | ||
78 | if (mnt_s->fscache_key) { | ||
79 | uniq = mnt_s->fscache_key->key.uniquifier; | ||
80 | ulen = mnt_s->fscache_key->key.uniq_len; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | if (!uniq) { | ||
85 | uniq = ""; | ||
86 | ulen = 1; | ||
87 | } | ||
88 | |||
72 | key = kzalloc(sizeof(*key) + ulen, GFP_KERNEL); | 89 | key = kzalloc(sizeof(*key) + ulen, GFP_KERNEL); |
73 | if (!key) | 90 | if (!key) |
74 | return; | 91 | return; |
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index 6e809bb0ff08..b9c572d0679f 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h | |||
@@ -74,7 +74,8 @@ extern void nfs_fscache_get_client_cookie(struct nfs_client *); | |||
74 | extern void nfs_fscache_release_client_cookie(struct nfs_client *); | 74 | extern void nfs_fscache_release_client_cookie(struct nfs_client *); |
75 | 75 | ||
76 | extern void nfs_fscache_get_super_cookie(struct super_block *, | 76 | extern void nfs_fscache_get_super_cookie(struct super_block *, |
77 | struct nfs_parsed_mount_data *); | 77 | const char *, |
78 | struct nfs_clone_mount *); | ||
78 | extern void nfs_fscache_release_super_cookie(struct super_block *); | 79 | extern void nfs_fscache_release_super_cookie(struct super_block *); |
79 | 80 | ||
80 | extern void nfs_fscache_init_inode_cookie(struct inode *); | 81 | extern void nfs_fscache_init_inode_cookie(struct inode *); |
@@ -173,7 +174,8 @@ static inline void nfs_fscache_release_client_cookie(struct nfs_client *clp) {} | |||
173 | 174 | ||
174 | static inline void nfs_fscache_get_super_cookie( | 175 | static inline void nfs_fscache_get_super_cookie( |
175 | struct super_block *sb, | 176 | struct super_block *sb, |
176 | struct nfs_parsed_mount_data *data) | 177 | const char *uniq, |
178 | struct nfs_clone_mount *mntdata) | ||
177 | { | 179 | { |
178 | } | 180 | } |
179 | static inline void nfs_fscache_release_super_cookie(struct super_block *sb) {} | 181 | static inline void nfs_fscache_release_super_cookie(struct super_block *sb) {} |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 92bbe1de4fcf..810770f96816 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -2154,7 +2154,8 @@ static int nfs_get_sb(struct file_system_type *fs_type, | |||
2154 | if (!s->s_root) { | 2154 | if (!s->s_root) { |
2155 | /* initial superblock/root creation */ | 2155 | /* initial superblock/root creation */ |
2156 | nfs_fill_super(s, data); | 2156 | nfs_fill_super(s, data); |
2157 | nfs_fscache_get_super_cookie(s, data); | 2157 | nfs_fscache_get_super_cookie( |
2158 | s, data ? data->fscache_uniq : NULL, NULL); | ||
2158 | } | 2159 | } |
2159 | 2160 | ||
2160 | mntroot = nfs_get_root(s, mntfh); | 2161 | mntroot = nfs_get_root(s, mntfh); |
@@ -2255,6 +2256,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
2255 | if (!s->s_root) { | 2256 | if (!s->s_root) { |
2256 | /* initial superblock/root creation */ | 2257 | /* initial superblock/root creation */ |
2257 | nfs_clone_super(s, data->sb); | 2258 | nfs_clone_super(s, data->sb); |
2259 | nfs_fscache_get_super_cookie(s, NULL, data); | ||
2258 | } | 2260 | } |
2259 | 2261 | ||
2260 | mntroot = nfs_get_root(s, data->fh); | 2262 | mntroot = nfs_get_root(s, data->fh); |
@@ -2507,7 +2509,8 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type, | |||
2507 | if (!s->s_root) { | 2509 | if (!s->s_root) { |
2508 | /* initial superblock/root creation */ | 2510 | /* initial superblock/root creation */ |
2509 | nfs4_fill_super(s); | 2511 | nfs4_fill_super(s); |
2510 | nfs_fscache_get_super_cookie(s, data); | 2512 | nfs_fscache_get_super_cookie( |
2513 | s, data ? data->fscache_uniq : NULL, NULL); | ||
2511 | } | 2514 | } |
2512 | 2515 | ||
2513 | mntroot = nfs4_get_root(s, mntfh); | 2516 | mntroot = nfs4_get_root(s, mntfh); |
@@ -2740,6 +2743,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
2740 | if (!s->s_root) { | 2743 | if (!s->s_root) { |
2741 | /* initial superblock/root creation */ | 2744 | /* initial superblock/root creation */ |
2742 | nfs4_clone_super(s, data->sb); | 2745 | nfs4_clone_super(s, data->sb); |
2746 | nfs_fscache_get_super_cookie(s, NULL, data); | ||
2743 | } | 2747 | } |
2744 | 2748 | ||
2745 | mntroot = nfs4_get_root(s, data->fh); | 2749 | mntroot = nfs4_get_root(s, data->fh); |
@@ -2821,6 +2825,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type, | |||
2821 | if (!s->s_root) { | 2825 | if (!s->s_root) { |
2822 | /* initial superblock/root creation */ | 2826 | /* initial superblock/root creation */ |
2823 | nfs4_fill_super(s); | 2827 | nfs4_fill_super(s); |
2828 | nfs_fscache_get_super_cookie(s, NULL, data); | ||
2824 | } | 2829 | } |
2825 | 2830 | ||
2826 | mntroot = nfs4_get_root(s, &mntfh); | 2831 | mntroot = nfs4_get_root(s, &mntfh); |