Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1042889ybp; Thu, 17 Oct 2019 07:15:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYeAHjsjxde32azA0E0JViAxHWeHub7AS6hGr3nhfXh0aZXJSueAQtMM3k3PUOUdSN4EqB X-Received: by 2002:a50:8b45:: with SMTP id l63mr4018532edl.31.1571321752652; Thu, 17 Oct 2019 07:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571321752; cv=none; d=google.com; s=arc-20160816; b=eOqqWD893kwNv4qpBfrcK4I4JB0KAKQOyIvt9RE6aAIJ3h8tBJkIp9wNlxpa2B2FVp gsMZaTxZ4sk/6uxCb1VaNoMesIHo1hyaYuOJ+3QyzcuR837f/xVf38AuwYrM7OUobChe 0wzuQOyYPZzSzkr1s7I+Nvmj31pxnZ6BVdmn7wNETZ27zix5gcQVhNQeRgt5djADY8Qm T0oBziPQM5hsvEnYn4kDDr7xZ/96qcajIMKfptHUvwnAbKrOGztEhvLi5ZZJKrJt88xl RWVaZG7fIJhAkQVq2uza/wFmURJ3fR4wcTjwShsv5JkSdQUacs6t7mAhB1yy+HaIJ3CC WQ9A== 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=tyrJi6ZCkJ1zFBHzkO/JRm+CegTOtQGkcC1vqDSv/74=; b=p/XVcYldnW7cVkqV+ZM3lAOj+pcb1GIrqCSD9Xg/UcCQRBvFGq9oVMm7dtb+L0227Y VA4QZtHvaEYT7N639R8Bh9wXx9oFyPhfoXArVQlLUPmN5NDj6btFpURjyQ5Cn4nvBNdR F2dwnjFnGIdo0arp+L7cAmg2vMftz5xFxCJVaTHLMuKxKSOMuTmykXPpOqbSQtDjUo0Y /ad9g45S+V9eyg9jLjwnjc4s3dm6iXCzMsVZJdfUibyT5PQkaULJfSOWBGp2sdyB9lqK msVpNmBnGHckQX58pPCx01QrOAkDT1+/nn3DEKYgccsuUFo/NEb1QM8cvtfsiPp8rWaM ibwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qFaQ4otZ; 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 c14si1523349ejz.242.2019.10.17.07.15.29; Thu, 17 Oct 2019 07:15: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=qFaQ4otZ; 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 S2394924AbfJPVx4 (ORCPT + 99 others); Wed, 16 Oct 2019 17:53:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:43210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394907AbfJPVxw (ORCPT ); Wed, 16 Oct 2019 17:53:52 -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 0D75321925; Wed, 16 Oct 2019 21:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262832; bh=4PRr/WjD56JOyIXFFF9MLjhZ3i2W8e6bDo2POCKbhnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFaQ4otZ29Ke1Sz1eshYYyCH60veluCPPn7icPW7YvnqFKsfXUHzsXMVJIiaMQX0W w6KF1fTMGgxSeaelMYOPwsHIY3O2zZmJ/2fSysvK9VRR8TELVS1Y5FlY/72pnqhGzy znMXk90lGLnip1IsGqavdi5naUMM6s9UJjLDvQ0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French , Sasha Levin Subject: [PATCH 4.4 75/79] CIFS: Force revalidate inode when dentry is stale Date: Wed, 16 Oct 2019 14:50:50 -0700 Message-Id: <20191016214833.436582478@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214729.758892904@linuxfoundation.org> References: <20191016214729.758892904@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 [ Upstream commit c82e5ac7fe3570a269c0929bf7899f62048e7dbc ] 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: Sasha Levin --- fs/cifs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 3d3c66fcb5ee6..0a219545940d9 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -405,6 +405,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, /* 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; } @@ -412,6 +413,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, /* 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; } @@ -887,6 +889,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, /* 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; } @@ -894,6 +897,7 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, /* 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; } -- 2.20.1