NFS: Kill fscache warnings when mounting without -ofsc
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 21 Dec 2012 16:02:32 +0000 (11:02 -0500)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Dec 2012 16:32:09 +0000 (08:32 -0800)
The fscache code will currently bleat a "non-unique superblock keys"
warning even if the user is mounting without the 'fsc' option.

There should be no reason to even initialise the superblock cache cookie
unless we're planning on using fscache for something, so ensure that we
check for the NFS_OPTION_FSCACHE flag before calling into the fscache
code.

Reported-by: Paweł Sikora <pawel.sikora@agmk.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: David Howells <dhowells@redhat.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/nfs/super.c

index aa5315bb3666817657e01323e84cb36c8c9f0078..c25cadf8f8c4a5d58bf02bce527939c7875e5474 100644 (file)
@@ -2375,19 +2375,30 @@ static void nfs_get_cache_cookie(struct super_block *sb,
                                 struct nfs_parsed_mount_data *parsed,
                                 struct nfs_clone_mount *cloned)
 {
+       struct nfs_server *nfss = NFS_SB(sb);
        char *uniq = NULL;
        int ulen = 0;
 
-       if (parsed && parsed->fscache_uniq) {
-               uniq = parsed->fscache_uniq;
-               ulen = strlen(parsed->fscache_uniq);
+       nfss->fscache_key = NULL;
+       nfss->fscache = NULL;
+
+       if (parsed) {
+               if (!(parsed->options & NFS_OPTION_FSCACHE))
+                       return;
+               if (parsed->fscache_uniq) {
+                       uniq = parsed->fscache_uniq;
+                       ulen = strlen(parsed->fscache_uniq);
+               }
        } else if (cloned) {
                struct nfs_server *mnt_s = NFS_SB(cloned->sb);
+               if (!(mnt_s->options & NFS_OPTION_FSCACHE))
+                       return;
                if (mnt_s->fscache_key) {
                        uniq = mnt_s->fscache_key->key.uniquifier;
                        ulen = mnt_s->fscache_key->key.uniq_len;
                };
-       }
+       } else
+               return;
 
        nfs_fscache_get_super_cookie(sb, uniq, ulen);
 }