Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1410629ybp; Thu, 17 Oct 2019 12:22:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/cVG5JQgePKZqaB3qmN/daDZcLU45mKqeveHAp9SUEYaPCGhmDVxpjciDQFo5VyT/mTy0 X-Received: by 2002:aa7:d0d5:: with SMTP id u21mr5660209edo.36.1571340156182; Thu, 17 Oct 2019 12:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571340156; cv=none; d=google.com; s=arc-20160816; b=Ac3+ykrvdcN2VDtXrRvyfg0b6wZznXLRVGkHTT4fKcddI3/xKPwD6vEOy/ZOp2xevm u5Y3+ix6lBK/znnF3FSgfa8t2nycQqvU3KRsPg/33ASyDekJi+Iz1ngwe3/4Dn6ArH7/ ntMkUNUrS91+Nutjruyfs2mLBo5Qr1cYv0TJ9XHwqd5UH7W+/Ms6C7Wwa5z2brB1PPfV As92ElUvbvx4TQ6C+50mRc6CpVjqMHySRfeSMIzSa3VHbBS6WtJQIi9ZEHfC+wkpkDbn cCHNxL+U+WbSMDfCisnE4XWC7rqusiJsqnfSsfOEgEzma+TpDGTJrKcBftPV318Tt8L7 8lfQ== 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=wecZ55A73bkwOecALbv8l8Qrao/DLYJvXn861jpKCnw=; b=bEFOrHVOtBML8CjhoYSRiowG75NySodil2/5oWn6FdoklLz1FNAS64XX7VrGWAcOKo bSZ1QjO3lHCZIiUbXvSbZSmvTaZlJcMtO+J+Eu24CNqDhz6ER+d75RNXo3Axdwvg4wjL TYC7ooa6EiYbE07ezB15uoanvFbWz0f+/0NCvLMN2hEjkxRUPaBsGQR1Pzmu4Kg0PC/K W6MGGHcIRtOjWWaQVjHhZXrDRiEcokJshC/tOTNakvcjXj4I+hYN4M4NWvnQJgvYGbRr ei8OZHu8HE+6CaXlUQM53KqZzSy3nUGXymrwhXIBr0kYiRPoeBDJtJr5FDiD8yQ8C4hd C7BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CPPTjtSu; 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 r14si2039257eju.69.2019.10.17.12.22.12; Thu, 17 Oct 2019 12:22:36 -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=CPPTjtSu; 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 S2439386AbfJPWPo (ORCPT + 99 others); Wed, 16 Oct 2019 18:15:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:45954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437781AbfJPVzV (ORCPT ); Wed, 16 Oct 2019 17:55:21 -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 DA18721925; Wed, 16 Oct 2019 21:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262921; bh=OWP9qiIYdbw9wGZUH+h8+ReE0Xal0SwpufBF+1eIWUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CPPTjtSu/b0F7eenbRQmG9N8QrtCReLgJuXAmOenJVyAGKfZrBqT9hBdJE7kQ80bl G83S+6kCPZ2QAJEDWuxav9KzLpBix/u7aqYCfxVeZrCH9/la50i5q9bVBaldBzMx+J N7tjnn1wNBQaSiIFlvuKps3CkOgiR0EKlpYyTokA= 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.9 80/92] CIFS: Force revalidate inode when dentry is stale Date: Wed, 16 Oct 2019 14:50:53 -0700 Message-Id: <20191016214846.918626643@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214759.600329427@linuxfoundation.org> References: <20191016214759.600329427@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 @@ -405,6 +405,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; } @@ -412,6 +413,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; } @@ -917,6 +919,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; } @@ -924,6 +927,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; }