Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1346025ybp; Thu, 17 Oct 2019 11:22:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0bPzmEy6EJEuolHSL3tFEiRnFaOpr3X13DF2uJnpNP3LkbhV4ZdO0IgA6iK66I3yutZ07 X-Received: by 2002:a05:6402:650:: with SMTP id u16mr5303037edx.211.1571336575685; Thu, 17 Oct 2019 11:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336575; cv=none; d=google.com; s=arc-20160816; b=fiN5wextGxpegFzdbuayUTS0c7AfUvvF5yZbly0VSZnVsqX6EoOtLuopCKV4rPEWKF 8jbkHK7klXYHkt1slgU1ao8Vpacl/ddg1+egRgOUD2BO0go2CAl+LvH9byds4Q8IM840 yE4jWBfz05frWxIUgHscnhuXooux/YmS3gQ+uvFr8FSGec9IjPIInj5JotnimZW8noer d94/lcy9au6AudxCxUJNRxkm+/3fQ2RYevMJL4lwrWBXMqCpGYa1I6yo3dALHIo0fyes v1L+VGEtEaVOoENGU2+ySK9l8sz3bcyZqDntmcMqp0HdSmImBZCOOM5MK6KUSLtGsh6B wZQA== 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=+pddG16bw1W0Moeh/tdQDN/R11X/a+IsWvVawlg27f4=; b=Qtrth7WvVIAC3rzrrwaqd7b5Xu4RYt2IVdn1Y/nVEDSVDD59Djya/Lt/0mYobMeUQC PfyAhEi48LUU/WFsCjlXfUM7YGlIAUuZ1WJep4RZvijEDI+6JOI+qcyY4AZmyTIeIQvr dP+q2oZkxuQ1pfdvz8X477gSa0PzQVtBHLiPGt7kqGqYF+G6TvQaingWQAaz/eh/ikfz dM8S1AFXes+Dzr3TnGEc9PxiAQPizXjtN8Yr/wLKNqu1LjBnpY2U66a6F8b4/+PVujMB ZI8QQLLZj+ovTLEht+wTmqtf1HBm3jAC1/iCi2+OkAkh0KX6A70wT3DaR1u6PUI/Ivje r8LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rlEmcumH; 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 g22si2191497edf.398.2019.10.17.11.22.32; Thu, 17 Oct 2019 11:22:55 -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=rlEmcumH; 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 S2438936AbfJPWBC (ORCPT + 99 others); Wed, 16 Oct 2019 18:01:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:54968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438624AbfJPV7r (ORCPT ); Wed, 16 Oct 2019 17:59:47 -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 09D6A21D80; Wed, 16 Oct 2019 21:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263186; bh=YnmQfpc3QrCOIxozSRo+8pJdrIUK4QFjQ8mrgUYzdME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlEmcumHJlOpW3TnJO/NXm2L9UyvpsHZpCDUdDW3LSSMwXd1F+pvQ7dJLk3sKOlOK 0HSNGKsIKcILnSQkS1zCti3z7xwtZsfi1UT97U8Yv426raTn8lnGAJYfnHVA4Jjvxw oNhdhrw90LeVfr6MKBdTarFTLmmjmEhNbsEKGqfc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Shilovsky , Steve French Subject: [PATCH 5.3 073/112] CIFS: Force reval dentry if LOOKUP_REVAL flag is set Date: Wed, 16 Oct 2019 14:51:05 -0700 Message-Id: <20191016214903.754836231@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@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 0b3d0ef9840f7be202393ca9116b857f6f793715 upstream. Mark inode for force revalidation if LOOKUP_REVAL flag is set. This tells the client to actually send a QueryInfo request to the server to obtain the latest metadata in case a directory or a file were changed remotely. Only do that if the client doesn't have a lease for the file to avoid unneeded round trips to the server. Cc: Signed-off-by: Pavel Shilovsky Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/dir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -738,10 +738,16 @@ cifs_lookup(struct inode *parent_dir_ino static int cifs_d_revalidate(struct dentry *direntry, unsigned int flags) { + struct inode *inode; + if (flags & LOOKUP_RCU) return -ECHILD; if (d_really_is_positive(direntry)) { + inode = d_inode(direntry); + if ((flags & LOOKUP_REVAL) && !CIFS_CACHE_READ(CIFS_I(inode))) + CIFS_I(inode)->time = 0; /* force reval */ + if (cifs_revalidate_dentry(direntry)) return 0; else { @@ -752,7 +758,7 @@ cifs_d_revalidate(struct dentry *direntr * attributes will have been updated by * cifs_revalidate_dentry(). */ - if (IS_AUTOMOUNT(d_inode(direntry)) && + if (IS_AUTOMOUNT(inode) && !(direntry->d_flags & DCACHE_NEED_AUTOMOUNT)) { spin_lock(&direntry->d_lock); direntry->d_flags |= DCACHE_NEED_AUTOMOUNT;