Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5224343ybl; Tue, 27 Aug 2019 01:05:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFj/z9R6ZbljlqsaDJ+jBjFA8rtXvS/q1hEekWTNH3gdZYrnimQloTebge2CPeOq/a5v5c X-Received: by 2002:a17:902:a615:: with SMTP id u21mr1161250plq.4.1566893118158; Tue, 27 Aug 2019 01:05:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893118; cv=none; d=google.com; s=arc-20160816; b=RPv7dHataFEnfRDfEmvvMpgjQxBLBZqB7rz3NfEyGSPozC+uDpX3+RVo3efTWGFWCd SXnfh+HRpEpGsSJCX0D9lkzInu/o/UuBF1nkS6EraNRMc4Fqg+eVJVnBL6vxKbY00A7p qi7o0cc0v4r8GklftD95nrHAFtvzmWyCVi7jK+ahJnu8rpVsq6h8clDrT5mZYo31b7v+ oxvx3LFhs6PGXN9U5JEUmdMa17B1P1UWNCanH2/Y9IGtsH1SGuCKq7YhbouVJKmDQ/jF AKSuPbeHSZdqARvrLxbek9due0byqG9ci0YeOTEWwclBbGxvnEMG8TjkVQGsCRJjakUt rtaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5303wElFmbR9u5thFoI3OZzt4cCLfmUVcVAzZUmkuKM=; b=Z5RzYCjyKeEaFAo3qyuLJkp6diNnXR75MtALTVxg1D6axZAcTB0QF+8pqbFVxaBgcL ooSEtxGg1PPJADNKOP0ST0VgCgOqhCWNNEd/KSRhR4rjl9MGICeenT9barDj3boFKlTA WhNmAxG8BItfh66IMeszFxRD/g9EaB+siHLIiPquPhIosraCw0EjixDPrrnvaqwA0aIZ CU228Vn2DVaqBPTw5bp5Rv/Z+0k6lELmpXqjmvam3jZMiQXJdLsgxPv7RfCQFY3lX1NN uI70x7fxhLY2cGuKCfNLRTaf2XnsYpoQ9UwzXjWANNTFWMpqpqPJTaX4fP4rofnqnu6/ dy0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B93Lfs98; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d24si11900021plr.187.2019.08.27.01.05.03; Tue, 27 Aug 2019 01:05:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B93Lfs98; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732073AbfH0ICp (ORCPT + 99 others); Tue, 27 Aug 2019 04:02:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:59912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731361AbfH0ICo (ORCPT ); Tue, 27 Aug 2019 04:02:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 59E71206BA; Tue, 27 Aug 2019 08:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892962; bh=XggU+zeG8dIlkxxfLnrwanGtmdueLn1I1rN1AMZpw3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B93Lfs981GAUPRhdb2zoJnfsjKHfPPTE0dSyMTK1Fo+YKeLhYJdEpjEIIC98MCe5z WMjY/MnRN683+tlFJDQVayjhxTHznjjKcrNhNhQxicN8AnsZqq3Y0RjtKxycbAGRq9 6HFTYOiP6fZQY+P0BiiUd91jWsTZ4LTPH3jWBrhg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Steve Dickson , David Howells , Sasha Levin Subject: [PATCH 5.2 076/162] NFS: Fix regression whereby fscache errors are appearing on nofsc mounts Date: Tue, 27 Aug 2019 09:50:04 +0200 Message-Id: <20190827072740.760244501@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072738.093683223@linuxfoundation.org> References: <20190827072738.093683223@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit dea1bb35c5f35e0577cfc61f79261d80b8715221 ] People are reporing seeing fscache errors being reported concerning duplicate cookies even in cases where they are not setting up fscache at all. The rule needs to be that if fscache is not enabled, then it should have no side effects at all. To ensure this is the case, we disable fscache completely on all superblocks for which the 'fsc' mount option was not set. In order to avoid issues with '-oremount', we also disable the ability to turn fscache on via remount. Fixes: f1fe29b4a02d ("NFS: Use i_writecount to control whether...") Link: https://bugzilla.kernel.org/show_bug.cgi?id=200145 Signed-off-by: Trond Myklebust Cc: Steve Dickson Cc: David Howells Signed-off-by: Sasha Levin --- fs/nfs/fscache.c | 7 ++++++- fs/nfs/fscache.h | 2 +- fs/nfs/super.c | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index 53507aa96b0b6..3800ab6f08fa8 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c @@ -114,6 +114,10 @@ void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq, int struct rb_node **p, *parent; int diff; + nfss->fscache_key = NULL; + nfss->fscache = NULL; + if (!(nfss->options & NFS_OPTION_FSCACHE)) + return; if (!uniq) { uniq = ""; ulen = 1; @@ -226,10 +230,11 @@ void nfs_fscache_release_super_cookie(struct super_block *sb) void nfs_fscache_init_inode(struct inode *inode) { struct nfs_fscache_inode_auxdata auxdata; + struct nfs_server *nfss = NFS_SERVER(inode); struct nfs_inode *nfsi = NFS_I(inode); nfsi->fscache = NULL; - if (!S_ISREG(inode->i_mode)) + if (!(nfss->fscache && S_ISREG(inode->i_mode))) return; memset(&auxdata, 0, sizeof(auxdata)); diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index 25a75e40d91d9..ad041cfbf9ec0 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h @@ -182,7 +182,7 @@ static inline void nfs_fscache_wait_on_invalidate(struct inode *inode) */ static inline const char *nfs_server_fscache_state(struct nfs_server *server) { - if (server->fscache && (server->options & NFS_OPTION_FSCACHE)) + if (server->fscache) return "yes"; return "no "; } diff --git a/fs/nfs/super.c b/fs/nfs/super.c index f88ddac2dcdf3..4d375b517eda8 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2239,6 +2239,7 @@ nfs_compare_remount_data(struct nfs_server *nfss, data->acdirmin != nfss->acdirmin / HZ || data->acdirmax != nfss->acdirmax / HZ || data->timeo != (10U * nfss->client->cl_timeout->to_initval / HZ) || + (data->options & NFS_OPTION_FSCACHE) != (nfss->options & NFS_OPTION_FSCACHE) || data->nfs_server.port != nfss->port || data->nfs_server.addrlen != nfss->nfs_client->cl_addrlen || !rpc_cmp_addr((struct sockaddr *)&data->nfs_server.address, -- 2.20.1