diff options
Diffstat (limited to 'fs/nfs/fscache.c')
| -rw-r--r-- | fs/nfs/fscache.c | 25 |
1 files changed, 21 insertions, 4 deletions
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; |
