Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5617157rwb; Wed, 21 Sep 2022 10:03:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67vVWzVaEFQafRsM3E0JYfe4FtEu1ZGm8PvwbrfeYGBT04p0gvUDwNXXvz5OdPMyDt4tLf X-Received: by 2002:a63:4626:0:b0:43b:383d:d1e with SMTP id t38-20020a634626000000b0043b383d0d1emr8852958pga.619.1663779825376; Wed, 21 Sep 2022 10:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663779825; cv=none; d=google.com; s=arc-20160816; b=km9HZehiz7FLm7hvqvaLdTE8yIcPhpIRfk2A/JkHe07+g3KR68AuqU90B4LKAoyObF kvs7UqSU06stjNhjLQSM1kUHvxmYYAL7iyPXVFz/Yp45PcHXa4X7n4x92VSb/QNZVthj 4ASpoNO6EmlyYcrICAwY3FBIQ8OVyliGz97l76LtQs6U3lzkiHj7lO7e2rYy1BoFMplu aoPl+lrgmpQQy02/8yLkaBzJ4Lf1KM1gTnyRiA9WMK4dokEyAg9qERf9E7FIcc0RnEMm xhpnKO0c3LbFK9VbLsL7oMJeYMd2xyVduSMI1zEfvfKFFxqvDoEN2o5yywnOW7MhiJVa FN1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=91j7bo0CfX6UGXnuG75CuRdAq3F0HaD61nJtEW3znRQ=; b=GfmWI6KdX+6o1l2jv3r0gY7USER7CtmjdYW10/krnhYh0n2xpIHejqGEm+lqv+z8oz w/7b8+vNgeuD6Z9kPUj4uV2g5caoFLhj5v+Tahhg87Od5vshrQYlaGgUAwaZY6z6GhcO 8Ep8PCwDszYNCa7fiBKpmcjyH1L65P3SK0SGIK4rPfC0EHAHY45Y4yWIJ/L3YHhQ4/nm NnfT+hbWLP5eEuBHj6IxmEsG5JPG/Ym7kNtsJJKZOPLlSb26GTXDODrXuvO+Jp8ZRgzA mOuC+aZA1YOv/ptGJXQiXqIs7rIsfSsf85qDTSJOezMnCmmB7dDz4eu9FQICS8JPAYTq 7ZXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GWmX+LH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a70-20020a639049000000b004397a9739cbsi3346962pge.851.2022.09.21.10.03.31; Wed, 21 Sep 2022 10:03:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GWmX+LH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231690AbiIUPvv (ORCPT + 99 others); Wed, 21 Sep 2022 11:51:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbiIUPvP (ORCPT ); Wed, 21 Sep 2022 11:51:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 517D09C234; Wed, 21 Sep 2022 08:48:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A0C163126; Wed, 21 Sep 2022 15:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 980AEC433D7; Wed, 21 Sep 2022 15:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663775330; bh=c05jEFt6CA62YY3uo0SwUTY5l2iuLBFz8UaS0/jF1GA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GWmX+LH2QTCVzLVmpBPMykk2NGZjnP7VY/IJLDLLBgpVhcDxjN4W/QoLuDNeymKW8 FWjfgWce7H3+CffnCV7ri9xmoxuvvgHJQ+a0FcveyLLIjBApcL314KevkFzpI3qeNJ Uy+ZCNRR0DpXFiG0U3on6qbkPB2OJuH9BTBZ6xQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Ronnie Sahlberg , Steve French Subject: [PATCH 5.15 17/45] cifs: revalidate mapping when doing direct writes Date: Wed, 21 Sep 2022 17:46:07 +0200 Message-Id: <20220921153647.454450096@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220921153646.931277075@linuxfoundation.org> References: <20220921153646.931277075@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ronnie Sahlberg commit 7500a99281dfed2d4a84771c933bcb9e17af279b upstream. Kernel bugzilla: 216301 When doing direct writes we need to also invalidate the mapping in case we have a cached copy of the affected page(s) in memory or else subsequent reads of the data might return the old/stale content before we wrote an update to the server. Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/file.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3318,6 +3318,9 @@ static ssize_t __cifs_writev( ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from) { + struct file *file = iocb->ki_filp; + + cifs_revalidate_mapping(file->f_inode); return __cifs_writev(iocb, from, true); }