Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1057866ybp; Thu, 17 Oct 2019 07:27:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSTteMmVCG1FfDOqaQAqv/vH3vaBu42ej441274e5KGiDD3qIJtPcvNmXrZSjRZYqnYt6J X-Received: by 2002:a17:906:3751:: with SMTP id e17mr3820899ejc.269.1571322472091; Thu, 17 Oct 2019 07:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571322472; cv=none; d=google.com; s=arc-20160816; b=shkCwt6foFf5WimZmfSzTHby48ZrskMd9iyvPNo+lx5AtIwOtOgfQuM0X4h36I7WYu JiBmYnUbDbgRXGMJkarOcbWeMkI/zISqhczwmxIcjRFBjW6WRgRw8X7lRqtn4UthWJP6 4SXOfa3HVRMFlaT1CbTMF3xRXtCbv06cNO8Bb0vS+0iYM3wW63RhYX+JrbbWffb1WHny rbULlBn9l4vKSGCpf+l2JZ21aQWpdDA/24wNocNqZqD/6gM/wceEPYF4+Fc6aRteuHT8 DZMK//g+KmCw9dORsQa5fFeHrIeW4LffHuddheIX+Q4L5neHY9x99pAEEu+sZaypTIPo I4cw== 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=WBG6bmpVwBd7pYs2CpwWZ95S4/pvEQiujd+PPrHmJU4=; b=C3zVMh31Z/Mz7LLq2STdh6Q0e4b5h44ouzjz8EjDbuC5NEr6BzEgefsIN2durmKaCZ H4Zl12VygTyKavTzwK62rpHq3hOOe94tvwEXVaX8lO9twZLC2LMtjrTlmrU4slKklEpx LbMiUmQiCE7UkD+oKts1gRq52VkQBPI1/ZH063juN6DGdmfDfmJVOXDWLd3P/4ZhiXZ4 mOnwrL93nqsnsF9XrfN3H2f4LHGV2FoFdJ4hL9Ioe5G4qmW6f7ijyKkgojnZgUcYb3fz O47Yf6tc4Q1bA11pn7wQMGaSLPWVFCH/DweQMASFwE6yboqx42ytngBkXJKJEkuPDUKe nI2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r5yjIjnq; 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 t18si1457505ejr.428.2019.10.17.07.27.28; Thu, 17 Oct 2019 07:27:52 -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=r5yjIjnq; 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 S2388633AbfJPV4c (ORCPT + 99 others); Wed, 16 Oct 2019 17:56:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:47822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406619AbfJPV4S (ORCPT ); Wed, 16 Oct 2019 17:56:18 -0400 Received: from localhost (unknown [192.55.54.58]) (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 C0F8421D7C; Wed, 16 Oct 2019 21:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262978; bh=gYkeHv2pVC1gVduuwi6FZhed2yorRXCI+ZgLHcWznLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5yjIjnqkR9CBL3HeE8M6ZY5EUgckgqiTN6JUsDQ8/3nIPEV3wDy5tzu5v7j+R85L ezqdNrLA5BfaS2rRcSUtMHYr5YkHOnXPcDlzvr7V+T8CKaTzRpwNJaEUymj9mXh8yY oTeegnhAiTxTSIeQXPI2/TIHAvA8MJ3bqN5fRtfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French Subject: [PATCH 4.14 47/65] CIFS: Force revalidate inode when dentry is stale Date: Wed, 16 Oct 2019 14:51:01 -0700 Message-Id: <20191016214834.707923238@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214756.457746573@linuxfoundation.org> References: <20191016214756.457746573@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 From: Pavel Shilovsky commit c82e5ac7fe3570a269c0929bf7899f62048e7dbc upstream. Currently the client indicates that a dentry is stale when inode numbers or type types between a local inode and a remote file don't match. If this is the case attributes is not being copied from remote to local, so, it is already known that the local copy has stale metadata. That's why the inode needs to be marked for revalidation in order to tell the VFS to lookup the dentry again before openning a file. This prevents unexpected stale errors to be returned to the user space when openning a file. Cc: Signed-off-by: Pavel Shilovsky Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -410,6 +410,7 @@ int cifs_get_inode_info_unix(struct inod /* if uniqueid is different, return error */ if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM && CIFS_I(*pinode)->uniqueid != fattr.cf_uniqueid)) { + CIFS_I(*pinode)->time = 0; /* force reval */ rc = -ESTALE; goto cgiiu_exit; } @@ -417,6 +418,7 @@ int cifs_get_inode_info_unix(struct inod /* if filetype is different, return error */ if (unlikely(((*pinode)->i_mode & S_IFMT) != (fattr.cf_mode & S_IFMT))) { + CIFS_I(*pinode)->time = 0; /* force reval */ rc = -ESTALE; goto cgiiu_exit; } @@ -925,6 +927,7 @@ cifs_get_inode_info(struct inode **inode /* if uniqueid is different, return error */ if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM && CIFS_I(*inode)->uniqueid != fattr.cf_uniqueid)) { + CIFS_I(*inode)->time = 0; /* force reval */ rc = -ESTALE; goto cgii_exit; } @@ -932,6 +935,7 @@ cifs_get_inode_info(struct inode **inode /* if filetype is different, return error */ if (unlikely(((*inode)->i_mode & S_IFMT) != (fattr.cf_mode & S_IFMT))) { + CIFS_I(*inode)->time = 0; /* force reval */ rc = -ESTALE; goto cgii_exit; }