From patchwork Tue Mar 22 04:36:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 12788086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D13DC433EF for ; Tue, 22 Mar 2022 04:36:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229586AbiCVEiW (ORCPT ); Tue, 22 Mar 2022 00:38:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236453AbiCVEiV (ORCPT ); Tue, 22 Mar 2022 00:38:21 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD8B821E13 for ; Mon, 21 Mar 2022 21:36:52 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id w7so27820356lfd.6 for ; Mon, 21 Mar 2022 21:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=tb8ri8QBmlj4Mv65OSHhZ9ER+noruH/06tLtzjpavd0=; b=OBL4+2DUrdCbIZ15quBUlonSHOQ7tcXCP0MeFPDJGyTNdXsdmDURV6U6SrvkhlLjS9 KzGkuHmJHlQKmF5o9b+f5euw1DoPoBcPYatVSew7w1A4ucZLyYji65m5TP4MP4t/kvEV c0TfUJM41xFICPaaH24cbp8VuCCZ1OAH2+CSGPT6UPy/EUmbiQcRt5Xv3LnFtxWz7kWR scUU+L0r36XuzcgkW5SEYpRt30OhTA/RtiJrgPO18n6GcEcFmcEs7PeaSXNbV+ldD+Qa Xap7VYKWVWG3SYl0pLvCp8hT71fnfho/DABTyQ3ZqO/kG1YUAPzAbxsLIkIzD76LSSD3 EOow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=tb8ri8QBmlj4Mv65OSHhZ9ER+noruH/06tLtzjpavd0=; b=KBSl/yUm7p5c42d7xWSgc1c+CMv6Ktss2owTKwmFGJgCZs0FWo35bqWv6dZHEhdZ9p Rh9PQBQ6MVMEL7kUZ+pLOLbxgtbb+p6+G9h8JToA6WEhmK8W1Wa1bltAl1OM2noLQ2y2 80xe2YgtRHpch5W7CdgiLcJs503uFKAJw7UELBMvUQu9SxZtW4m13nOyTWZp6RZSDkY4 C+E/PbnP0l+sv/v0N7cC31J2SsitgEBFX+CbwWBlKaHYxeuyVR5N36jCXcDvzCIuPQqM hI73+EqJSWZQcSsg1p7ftjW7AQGtkGiDK6IUApr2J1yihlfP7u9JyftwTerZE5zJYaLS P0zw== X-Gm-Message-State: AOAM533gBNfczTcbrtMk0K4bfp7m4Airit6+QO7BYBpfiFjRS+lc5eDJ Dk1hLHk5l8vpIjwhqwLHqndyGDVFQu+TsZ/x35Fjr+C73DU= X-Google-Smtp-Source: ABdhPJwyebPTvZh7+7BydywioHbaHM7Zj0kdlY3DeRrWq8rSFCOo5QpIP80AfWb82lApqs07VuYTYZfPcR2dZitELw8= X-Received: by 2002:a05:6512:130c:b0:44a:2dd3:91d0 with SMTP id x12-20020a056512130c00b0044a2dd391d0mr5214106lfu.234.1647923810713; Mon, 21 Mar 2022 21:36:50 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Mon, 21 Mar 2022 23:36:39 -0500 Message-ID: Subject: [PATCH][CIFS] writeback fix To: CIFS Cc: David Howells Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org https://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=d9a5f40a52016abe765d97d1e57acead9e824a12 Wait for the page to be written to the cache before we allow it to be modified Signed-off-by: David Howells Signed-off-by: Steve French From d9a5f40a52016abe765d97d1e57acead9e824a12 Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 24 Jan 2022 23:15:18 +0000 Subject: [PATCH] cifs: writeback fix Wait for the page to be written to the cache before we allow it to be modified Signed-off-by: David Howells Signed-off-by: Steve French --- fs/cifs/file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index a2723f7cb5e9..cf8642c16e59 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4210,13 +4210,19 @@ cifs_page_mkwrite(struct vm_fault *vmf) { struct page *page = vmf->page; + /* Wait for the page to be written to the cache before we allow it to + * be modified. We then assume the entire page will need writing back. + */ #ifdef CONFIG_CIFS_FSCACHE if (PageFsCache(page) && wait_on_page_fscache_killable(page) < 0) return VM_FAULT_RETRY; #endif - lock_page(page); + wait_on_page_writeback(page); + + if (lock_page_killable(page) < 0) + return VM_FAULT_RETRY; return VM_FAULT_LOCKED; } -- 2.32.0