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: 1608026 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=OBL4+2DU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4KMzGd532Vz9s1l for ; Tue, 22 Mar 2022 15:36:57 +1100 (AEDT) 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-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