Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5216431ybl; Tue, 27 Aug 2019 00:57:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAVo5U36yUH1x+AGuWVQrZNuIcLpKwgbjv5jKKNF8Ja4YoVALm2NkgG51/9cwVeYuTmynI X-Received: by 2002:a65:6815:: with SMTP id l21mr20401611pgt.146.1566892653870; Tue, 27 Aug 2019 00:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892653; cv=none; d=google.com; s=arc-20160816; b=mPuoqxNiMwpP7Vie4pmn0JxlA+yghvztBQqh/oOfwEYIK+RW6W1+I579RgU4tSGm5T r8w78a7DNudoq2cXNsWnYl0dZHIk1TtuNb5NHIb34bPxk+Mje0OlcYlWex3EdpxOwZJJ c+ZXt3E6qjhEyzzEh5/g46df14aWevyOxsi/P3SLxR3x0ucKQ18GM0/sYb8ZgBvduHkA 89FYigevRu0OdbMO/I+kcg356SyJhbQ2bDrkDF4nbzjJzBtfKKVhgeU+1kkQVLOITPVI ZDWecU0M8fwK5+JHZrfUUISjAdlNUt7hzC/cuLPg0LdJcuDIyesoCfe5akITnxT35OR1 W/NQ== 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=U8LzBEMz0RpThl+ffwhpWfQ7Rn+pv0tx5fRRnNa8IV4=; b=rFHjDUmWHRNH8umfNmOs6ZpViC/NFhL1cV8D3PosIFlMXl8A6wDMDfeeb/z+F9GnPL bTNWKtPzTwGF6SQigg3bk8iD+VU7ProeJ8JUrLsY6J/kXHsdcF14zZtQCBZCo3g8pL6T yjWa0nrX9lVDX//cijjrk5ydzxDACyUFdBKSEzQTpnUBdqvrIbhc87sBnxVQXpYMTRjI 3BJ1s9QFxuQSC060YTGypthgwa4h/5uFl/ZimK4icNACVnRReHH7ccc0MCQMRgeq94G+ aJ4xPa/DqcXk6Tp9KP31DgeiXWsUAqFWrudv6GF5MiILpCMD6s3hoWjhdE2KvotaKpZE MuQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IFVZWWAq; 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 i6si560375pjs.13.2019.08.27.00.57.18; Tue, 27 Aug 2019 00:57:33 -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=IFVZWWAq; 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 S1730482AbfH0H4E (ORCPT + 99 others); Tue, 27 Aug 2019 03:56:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:47948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730472AbfH0H4D (ORCPT ); Tue, 27 Aug 2019 03:56:03 -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 24FC5206BF; Tue, 27 Aug 2019 07:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892561; bh=N7PtK8DhcxXfNekQ9K+34iB1O9iKlNmQk5LJq5lbX9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IFVZWWAq76v5o+cgvT2hYJa7/yOgLh7MfzWnxQ0lLgJQUoChg8nReryzESR0gUCtH B/oiUzZi00rK1c1TCXLHTl8gWaybp9eiiX2Jj4NJMQq8I1Rq9y97dNmJwRXsRTyK4D Ay1KEiYa/KgWLsujm14V21xNG/8Mhss38NGR9Qfw= 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 4.19 35/98] NFS: Fix regression whereby fscache errors are appearing on nofsc mounts Date: Tue, 27 Aug 2019 09:50:14 +0200 Message-Id: <20190827072720.043818271@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072718.142728620@linuxfoundation.org> References: <20190827072718.142728620@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 4dc887813c71d..a7bc4e0494f92 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c @@ -118,6 +118,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; @@ -230,10 +234,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 161ba2edb9d04..6363ea9568581 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h @@ -186,7 +186,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 6df9b85caf205..d90efdea9fbd6 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