Message ID | 387bbbec5e040ec46f5d15b6a754b7a7af57b302.1628854236.git.anand.jain@oracle.com |
---|---|
State | New |
Headers | show
Return-Path: <stable-owner@kernel.org> 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 24554C4338F for <stable@archiver.kernel.org>; Fri, 13 Aug 2021 12:12:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0647C610F7 for <stable@archiver.kernel.org>; Fri, 13 Aug 2021 12:12:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234931AbhHMMNQ (ORCPT <rfc822;stable@archiver.kernel.org>); Fri, 13 Aug 2021 08:13:16 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:13180 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240259AbhHMMNQ (ORCPT <rfc822;stable@vger.kernel.org>); Fri, 13 Aug 2021 08:13:16 -0400 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17DC7GME026291; Fri, 13 Aug 2021 12:12:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=zVuw70JfTlM4/80WwpBxg2UKnZkr4fSJ14RmTv0NR0s=; b=LD7VyS8uMdcobOzNsv7RHhYgbDOVoTKpJFzq+0uWkOrQQHUVHR6hW0sczQqyZpDQlCoD L0F+sKxOd7YR6KIyvMDhXx10YvO3cJvvL9XalNCzzG8paxoa9816kmoMnCAwmL4FGTdZ 9eKcClLgY83fxedNxG1ZNd7Q6anOkuYQQy0JE5FxWPLEFiHOeErfCZerQDWWNEB1S9HT 7/GlQLl18hnREAcgiBQze51lgxIw86R+o+WTr7Ig8q+e2hK0nY42FDHLccPjCICWqGKp 9IbqDhAMFATmxqgdUBbMpSQeOg8BTscoBD9ooQD5N6LA9y9YGN8BSh7qwOZVwGAZvCGN Tw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=zVuw70JfTlM4/80WwpBxg2UKnZkr4fSJ14RmTv0NR0s=; b=WTOGozE9GCmJl4ZA1YxmoaqtmhTFqLhG00HX0pNt400JLZmrZDCEf2cbtfVpdMCuMoYF K0kxss0eEsBY6A1OWZJuoW/JTrPifwChm4uuBx0IgyzeYcdrAoH9ICwC89YGPGJXb2D+ caSEzUXc6IbQfKMRlRvRS/vU1YzAzcQyTFVyLCpSaVfLWH/A24NEYMT+eJmTKvGTpBxb wz+sIqbSmKY664OUsSxpioUZRWMypYeXmSjI59DQRM1mBXNbj/FVBI73M6aYyt33/9Zh DwNO+UmjRt3TkZYqFsTz/4ZBQPWDpwO3xeCWhrHyq7fyxZks0HscG9tZYnckRykGWI5Z ng== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3adq9g84dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 12:12:45 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17DCAZX7038630; Fri, 13 Aug 2021 12:12:44 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by aserp3020.oracle.com with ESMTP id 3accrdx85v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 12:12:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LlJPc2O7WUiPvaakpCKBV/p7ulpruPcm5LqsdKzn6fepvlUVJ35dur8vH3R2MEJzAxcLNqOQFAplrYoMcLj95pacQFlnvu6omiqaSUXLIWVkGHRU1zmfI9WxTQkTwkIpytXncFfCbtPicTFyV6zuUgVvrt//v2c3RgVaegdZKcBq2mq0FGexBqslcLwwQ0p4h/bNY2mOLUlBK69+wGApK5t/mHEN7IpKE6OASB+onWGL53oqlcTeL2Kfn8bP3wh0SXgo+9uuqTXPEkRdh9/FqPmAN0k8+VfNsd+kEYnPySu8rjZCpXdgRXtGmx23XxfBJ3mzg7H3YJt1hok99bEUgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zVuw70JfTlM4/80WwpBxg2UKnZkr4fSJ14RmTv0NR0s=; b=DrRCrTgJYpMSLQoJUnTYy3gvDhfJhyI486lol0H38eopAACIeyx6cgJ6d0OtdIOzLYuujyXApo6JCsTN+HKIJ/pq7/5xYZpOPrCqEo0I3fSJ0kxXb8bNnXJ+BWWUFFTMArO1QS0ypqDqGkCjf9uxuv/xCuhuDvacD4UtbCw+dLpS8kDlnUMWCUFRHzw5gRUkfBKOKS4IY2syovf1losbJCfclU9XuSSxp95/Dmzdcw/UEZiLi7bcra9aPG6iP91hB/2gXAek2awgchWu8Z/BAld45b6muX2u2dc3GVBSsoIvIAdh3AxXAqozD0n4BLbZdydxVXG7NaJ4ySMVgc/zYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zVuw70JfTlM4/80WwpBxg2UKnZkr4fSJ14RmTv0NR0s=; b=AGDPlbvaXcUaP58fWVTSuYifPFD5A5nL3poOZUKnUIO8sIv+zMyyUqhhQheWWuQi0Wa1Jqz5mtg0F3WO0IS5n9FVuYiHvOdnK0m1/YOUxu+eyLTFwvhSCYDgaHg+Bo8HTycZuTyO5JduEYl92WeCgZzppkYzUbOo+rJ6NNAfIh4= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=oracle.com; Received: from MN2PR10MB4128.namprd10.prod.outlook.com (2603:10b6:208:1d2::24) by MN2PR10MB3789.namprd10.prod.outlook.com (2603:10b6:208:181::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Fri, 13 Aug 2021 12:12:43 +0000 Received: from MN2PR10MB4128.namprd10.prod.outlook.com ([fe80::b813:4805:31e:d36a]) by MN2PR10MB4128.namprd10.prod.outlook.com ([fe80::b813:4805:31e:d36a%5]) with mapi id 15.20.4415.019; Fri, 13 Aug 2021 12:12:43 +0000 From: Anand Jain <anand.jain@oracle.com> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, fdmanana@suse.com, Qu Wenruo <wqu@suse.com>, Anand Jain <anand.jain@oracle.com> Subject: [PATCH 1/3] btrfs: qgroup: don't commit transaction when we already hold the handle Date: Fri, 13 Aug 2021 20:12:23 +0800 Message-Id: <387bbbec5e040ec46f5d15b6a754b7a7af57b302.1628854236.git.anand.jain@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <cover.1628854236.git.anand.jain@oracle.com> References: <cover.1628854236.git.anand.jain@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR04CA0155.apcprd04.prod.outlook.com (2603:1096:4::17) To MN2PR10MB4128.namprd10.prod.outlook.com (2603:10b6:208:1d2::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (39.109.186.25) by SG2PR04CA0155.apcprd04.prod.outlook.com (2603:1096:4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17 via Frontend Transport; Fri, 13 Aug 2021 12:12:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1380493a-8fd4-4d30-abb1-08d95e53a70e X-MS-TrafficTypeDiagnostic: MN2PR10MB3789: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <MN2PR10MB3789FF034948102864310E69E5FA9@MN2PR10MB3789.namprd10.prod.outlook.com> X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W8S7mE47HEd/Luhu4UFMlFx4VCnR0rnAzQ7J7gt5734mb49ptPviUamB/217WOFggoxBQYE6RIjuV8yBtPUXR1a6lRT3TBQxPxmSCfwSvaq0emrwVjJES2bMbterMVkgMVnzyfJPOwqPQ5jysrdt2eI3D5Bb6R4KL0Kfk4WaFb/BlAH5UsS+Cwb9IeJeVh1bkpUJ8IcdPr801JU3D4wLg1l6qDBxzyleFuf7RTH8x7CRCw7w5wU8VlCbNMq01ICyZN4mAj8kR/31wldwni4sT9tsVeiIsGKGnEUsL+bkD50xlGV+C70YP5iYWlRljezFFzU7NYtWJBM5twsERkORJIwFof+Z9jzULvZmqYzQx5LUqsjqhwfAfSuMufu5O1QyWqjx05/fYjeRP3x/4E6/7n+kJRV19z0fXHvBhBQ3RzmsHcmQ35ojkG68xOmu/ObpWocZ65QiiKw8qLabbUhx/bH1YceCN9Ystd0Eb3j2RkxLMHz94zM3UfOm+O9u9oi1tEOUbNK2mNWsZ7OqFyFvLlwtDmFkHGCUOd+WegYAYzVOjJ9NpWDiZIqOiVyz6HbsXiJEV7of4ZAEj4I+aQm6HtR22zoQQm66EV3Yz3OJiTz2uDE46JsD8QD4U/0n0S/yUJ3/0u46L735HBw7TB1kh3Eq0yPm4i8kAHYw3IDw5RSZTEMFdgjhrfCvxHnI50hEDtC+vrce14eAtQw6ScWmi+UHyG61WMC1tQnsbgzMvdulOtlUNfvVGowh+tbqqLhhW//fMGZIDTnjjSGDJxweGNUrV5ZlFpU9SR8+0ezwcZ4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB4128.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(396003)(346002)(136003)(366004)(376002)(39860400002)(26005)(54906003)(44832011)(5660300002)(52116002)(966005)(107886003)(316002)(6506007)(83380400001)(36756003)(956004)(6666004)(8936002)(4326008)(2616005)(6512007)(38350700002)(38100700002)(86362001)(8676002)(66476007)(66556008)(66946007)(2906002)(6486002)(186003)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FLAjAjwVtn5yYKFy5UrRcu8EvkZQEcmZsaXiwZhBymOtKbt/u6WaBp68se/kU5c/0xTp3qJvQG3H0iD0GEEZEf/s2a+kaMyNGuflq0zCf7/+t4N85q50ZCrnHA232USCzTkmPTUAkIa/uiZ1R/ZqKpkoqBT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JT+ZpIHXxhC6z04BjPtY9OBVPI9QmRv2LFptuL39yXzsuuubhLzOAvkkR/xb53uZtmHcjPEDUW05MC9eKCBIPf23aYN48N8p8IdtFGVC8FyAtjxVh9j29cw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1380493a-8fd4-4d30-abb1-08d95e53a70e X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4128.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2021 12:12:43.0536 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UwMF34leFLP3XLxxlXUfu1eD8KECvAM6R7wBtGUh3y+S7THiKsHIpcvNgTOIrODVqYy9wNUGRTDHnqDwznqvgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3789 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10074 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130074 X-Proofpoint-ORIG-GUID: jCejqUD1mbJoyY3P-EHZRNpS-SxGaOIq X-Proofpoint-GUID: jCejqUD1mbJoyY3P-EHZRNpS-SxGaOIq Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
btrfs: backport hang fixes due to commit c53e9653605d
|
expand
|
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 2f119adbc808..78146501c665 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -3502,6 +3502,7 @@ static int try_flush_qgroup(struct btrfs_root *root) { struct btrfs_trans_handle *trans; int ret; + bool can_commit = true; /* * We don't want to run flush again and again, so if there is a running @@ -3513,6 +3514,20 @@ static int try_flush_qgroup(struct btrfs_root *root) return 0; } + /* + * If current process holds a transaction, we shouldn't flush, as we + * assume all space reservation happens before a transaction handle is + * held. + * + * But there are cases like btrfs_delayed_item_reserve_metadata() where + * we try to reserve space with one transction handle already held. + * In that case we can't commit transaction, but at least try to end it + * and hope the started data writes can free some space. + */ + if (current->journal_info && + current->journal_info != BTRFS_SEND_TRANS_STUB) + can_commit = false; + ret = btrfs_start_delalloc_snapshot(root); if (ret < 0) goto out; @@ -3524,7 +3539,10 @@ static int try_flush_qgroup(struct btrfs_root *root) goto out; } - ret = btrfs_commit_transaction(trans); + if (can_commit) + ret = btrfs_commit_transaction(trans); + else + ret = btrfs_end_transaction(trans); out: clear_bit(BTRFS_ROOT_QGROUP_FLUSHING, &root->state); wake_up(&root->qgroup_flush_wait);