From patchwork Wed May 10 22:51:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 13237339 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 CBE37C77B7C for ; Wed, 10 May 2023 22:51:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235731AbjEJWv6 (ORCPT ); Wed, 10 May 2023 18:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbjEJWv5 (ORCPT ); Wed, 10 May 2023 18:51:57 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56BEA4488; Wed, 10 May 2023 15:51:55 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f139de8cefso42789897e87.0; Wed, 10 May 2023 15:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683759113; x=1686351113; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Ohs3T3NdbbBRfBPZoviqythlTyCVKHR7HNnzdiYYugg=; b=UZcIdCcS9GRr82mG/CdB3huJwhDoxQIzvsmnyFbvvmquGJg4EQuA2UEmpC49ODEitw 9vAgM6uM3DM7uSpET+bjLVEqgrLIaFrHLgV6tEYyjN8qLYwRgPkoC7JddtTcss2iSn+N O4Ic6SZzG/SJ6mFkVy7Y0kHE49H8ECiJBGW8quvIQTrBVC0YAyJb9SkrzNfENLbL3TeY O9c3LRdhg18EZ7YMdJfHUi/1wnXsl9wNMDVDKXVPoUwS8Ry7klVlPUU3FVKsBHlo4nfK nNQuv2lX7qaQeap8/ZF0KD+c3nXN6fBBoY585/0v9PCIq7xZk6Lp7ExMDTnvLSAK2+RC Fevg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683759113; x=1686351113; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ohs3T3NdbbBRfBPZoviqythlTyCVKHR7HNnzdiYYugg=; b=fnFoHsww106QeMPSZB/ZXBujYJxQskHgzYX3LgWlS9olFXgVrc3VcKjMBzhSoW2f/E dUWvzDhQgBmzxBFj2hWFL+lxzW2/ZASHVxVin3AZngrh0eh2g2gOY0lZVqBYdGWmJ9KG Rsjii6tpjOAA+BMaATXIjxGDj3pAlldmWvPj6ntzC1VDalUuKyI8l3O9tVoD8a8B5AA1 NSmtY4jMzGtuiMwxO1lZCi+hzEiEP1IA0e8VoQt25vuT0PzAA+mMU5YcVG9glWXHryRX qZaiyn6rr8CU4XU8gpybX1SUJh6Oi/jq19HzIlFk+begBt8g6fwJtIUPwA9iGEuqGcoW 0j+w== X-Gm-Message-State: AC+VfDz7kdFLCHBfCy7OhneP51dzkr8bHDmdq8UbfrRCo106gA5STdIi kPrtq0uIGTFODeKM2zAqxFAvZkMKuNQiT3Xb6SCahfDBNkcb/eJR X-Google-Smtp-Source: ACHHUZ6pFQA0UQwdD2HgKoqbtWxg3G+c05xilomwWIM3CxOrp3RcYZSBfnwod4YVRpJnf3J/cH3r1pgeRS3YN/Dz05k= X-Received: by 2002:a05:6512:2806:b0:4eb:4258:bf62 with SMTP id cf6-20020a056512280600b004eb4258bf62mr1882701lfb.8.1683759113049; Wed, 10 May 2023 15:51:53 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Wed, 10 May 2023 17:51:41 -0500 Message-ID: Subject: [PATCH] cifs: release leases for deferred close handles when freezing To: CIFS Cc: linux-fsdevel Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org We should not be caching closed files when freeze is invoked on an fs so we can release resources more gracefully). Fixes xfstests generic/068 generic/390 generic/491 See attached. From d39fc592ef8ae9a89c5e85c8d9f760937a57d5ba Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 10 May 2023 17:42:21 -0500 Subject: [PATCH] cifs: release leases for deferred close handles when freezing We should not be caching closed files when freeze is invoked on an fs (so we can release resources more gracefully). Fixes xfstests generic/068 generic/390 generic/491 Reviewed-by: David Howells Cc: Signed-off-by: Steve French --- fs/cifs/cifsfs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 8b6b3b6985f3..43a4d8603db3 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -760,6 +760,20 @@ static void cifs_umount_begin(struct super_block *sb) return; } +static int cifs_freeze(struct super_block *sb) +{ + struct cifs_sb_info *cifs_sb = CIFS_SB(sb); + struct cifs_tcon *tcon; + + if (cifs_sb == NULL) + return 0; + + tcon = cifs_sb_master_tcon(cifs_sb); + + cifs_close_all_deferred_files(tcon); + return 0; +} + #ifdef CONFIG_CIFS_STATS2 static int cifs_show_stats(struct seq_file *s, struct dentry *root) { @@ -798,6 +812,7 @@ static const struct super_operations cifs_super_ops = { as opens */ .show_options = cifs_show_options, .umount_begin = cifs_umount_begin, + .freeze_fs = cifs_freeze, #ifdef CONFIG_CIFS_STATS2 .show_stats = cifs_show_stats, #endif -- 2.34.1