From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7BDEC433E0 for ; Sun, 28 Jun 2020 15:50:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82A14206F1 for ; Sun, 28 Jun 2020 15:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593359448; bh=w9rSOsKUDgeR7kdbWjbIbKXaJbRk9o/dlvYrhhg3uTM=; h=Subject:To:Cc:From:Date:List-ID:From; b=2gQvfgwnc3LNPDKnyO9BcwnStU0uWEaJrHbUszB3wyZ54edKQ1bzdRUocTnocvpHJ tbM9/zKzJvDwn/BGiDRdTOyxOFtrvDrDIRBKW2C27bnv7iDdAq45gF+cyoAvfPl+l/ 8rZ4enLaBpLlh43NJNY3FzbB5KfRbEqGcBp4ezVA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726373AbgF1Pus (ORCPT ); Sun, 28 Jun 2020 11:50:48 -0400 Received: from forward5-smtp.messagingengine.com ([66.111.4.239]:42573 "EHLO forward5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbgF1Pur (ORCPT ); Sun, 28 Jun 2020 11:50:47 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 7A4C01940709; Sun, 28 Jun 2020 11:50:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 28 Jun 2020 11:50:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=HWjCeJ mOHHSpTkOrT5eVLYb3Z7Zl727H4Sjyd7Nk9To=; b=VQChTmgvAXgJZYN1tmE0z+ mrtsj9xbHa2B72Vd75D5X3/FDNNEzO4gm+QmPnqine6JYxH8O+fAORcgj1lSjuyM nPKnQk4Ehz8pWDoxPsa0z2ZaSRWagCT6/cAO+5aYNuS6Az7GmYFKh+Kfljvy32ju kKWRwIj0pV6GAbx8nGfGGh+4SHFGEtmKQpTQse9tyDwJNz43RsTZKGVM5P850Blt jelsInThIUJutZ+MWQx0tI8Xp4/LXQ22doJFYEksVweUm+nJKULpAwydoMMHAvGF Fq244Rz7QInvJFBPXOilg+tbZ0Z7grUbRyzwrm0Wa+2TtapjnUHKuP6qNbGCD/OA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeliedgleeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepieetveehuedvhfdtgfdvieeiheehfeelveevheejud etveeuveeludejjefgteehnecukfhppeekfedrkeeirdekledruddtjeenucevlhhushht vghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhh drtghomh X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 196C63067B9B; Sun, 28 Jun 2020 11:50:46 -0400 (EDT) Subject: FAILED: patch "[PATCH] cifs/smb3: Fix data inconsistent when zero file range" failed to apply to 4.4-stable tree To: zhangxiaoxu5@huawei.com, hulkci@huawei.com, pshilov@microsoft.com, stfrench@microsoft.com Cc: From: Date: Sun, 28 Jun 2020 17:50:38 +0200 Message-ID: <159335943824434@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 6b69040247e14b43419a520f841f2b3052833df9 Mon Sep 17 00:00:00 2001 From: Zhang Xiaoxu Date: Tue, 23 Jun 2020 07:31:54 -0400 Subject: [PATCH] cifs/smb3: Fix data inconsistent when zero file range CIFS implements the fallocate(FALLOC_FL_ZERO_RANGE) with send SMB ioctl(FSCTL_SET_ZERO_DATA) to server. It just set the range of the remote file to zero, but local page cache not update, then the data inconsistent with server, which leads the xfstest generic/008 failed. So we need to remove the local page caches before send SMB ioctl(FSCTL_SET_ZERO_DATA) to server. After next read, it will re-cache it. Fixes: 30175628bf7f5 ("[SMB3] Enable fallocate -z support for SMB3 mounts") Reported-by: Hulk Robot Signed-off-by: Zhang Xiaoxu Reviewed-by: Pavel Shilovsky Cc: stable@vger.kernel.org # v3.17 Signed-off-by: Steve French diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 28553d45604e..876a0d9e3d46 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3188,6 +3188,11 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, trace_smb3_zero_enter(xid, cfile->fid.persistent_fid, tcon->tid, ses->Suid, offset, len); + /* + * We zero the range through ioctl, so we need remove the page caches + * first, otherwise the data may be inconsistent with the server. + */ + truncate_pagecache_range(inode, offset, offset + len - 1); /* if file not oplocked can't be sure whether asking to extend size */ if (!CIFS_CACHE_READ(cifsi))