NFS: Fix fscache super_cookie allocation
authorDave Wysochanski <dwysocha@redhat.com>
Wed, 15 Apr 2020 20:14:42 +0000 (16:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 May 2020 06:22:17 +0000 (08:22 +0200)
[ Upstream commit 15751612734ca0c419ac43ce986c9badcb5e2829 ]

Commit f2aedb713c28 ("NFS: Add fs_context support.") reworked
NFS mount code paths for fs_context support which included
super_block initialization.  In the process there was an extra
return left in the code and so we never call
nfs_fscache_get_super_cookie even if 'fsc' is given on as mount
option.  In addition, there is an extra check inside
nfs_fscache_get_super_cookie for the NFS_OPTION_FSCACHE which
is unnecessary since the only caller nfs_get_cache_cookie
checks this flag.

Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/fscache.c
fs/nfs/super.c

index 8eff1fd806b1cae8758cf313ec8c89c61c29fa4b..f51718415606838b7a4676d41d0c2fb5203a4813 100644 (file)
@@ -118,8 +118,6 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int
 
        nfss->fscache_key = NULL;
        nfss->fscache = NULL;
-       if (!(nfss->options & NFS_OPTION_FSCACHE))
-               return;
        if (!uniq) {
                uniq = "";
                ulen = 1;
index dada09b391c653a7f0fa1e6c8dd87daba0b204be..c0d5240b8a0ac7c07077bdb861b2a4daf2259f2c 100644 (file)
@@ -1154,7 +1154,6 @@ static void nfs_get_cache_cookie(struct super_block *sb,
                        uniq = ctx->fscache_uniq;
                        ulen = strlen(ctx->fscache_uniq);
                }
-               return;
        }
 
        nfs_fscache_get_super_cookie(sb, uniq, ulen);