From patchwork Fri Sep 29 19:44:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9978565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4764960311 for ; Fri, 29 Sep 2017 19:44:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A6D3298AB for ; Fri, 29 Sep 2017 19:44:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FB71298AE; Fri, 29 Sep 2017 19:44:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB287298AB for ; Fri, 29 Sep 2017 19:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752594AbdI2Toq (ORCPT ); Fri, 29 Sep 2017 15:44:46 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:34252 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbdI2Tof (ORCPT ); Fri, 29 Sep 2017 15:44:35 -0400 Received: by mail-qk0-f194.google.com with SMTP id d70so412330qkc.1 for ; Fri, 29 Sep 2017 12:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=rhNercliWrS3rYjAlPuNAEtxpxpndvxocGN2AZ3nxoA=; b=hPaHT0x1AZC/6IfBohey2L7Ts50HUlDJZoiR8g+lRC6Te+Sofgma1weu3F4I5FXfEp kgxkVdBD/Sx94VzpiC45h1ci/YHuiFGWXBiYpPLQMtcDlBl063nsVRcCX002cbsaALF1 SNDv+agL4X7w0yP4BNJQgyVJxufoYIMoAfcPS8oOVhIhtxIqRIarQVcpukOhKyNPvpnp FBSXQ0ng8wsIvJzGsgsmgTudXXTwOWqFhhuIWE7B+axrlSdvRj+dfQbrChjpLtwNiIzx wDF93vhHUqRMvbKYuxcFsS5af0j9OPo9TpXcrB0z/mlHrcRvc3tke+oyj+kKmlm36gDC RD/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=rhNercliWrS3rYjAlPuNAEtxpxpndvxocGN2AZ3nxoA=; b=q9tlRFr3hi4jG4ieONZF50+j8DmpX2WA6BSM5Enxb2Q+aLla0hUEwSaM9Vd+0ROmDW J2G/PFDKS/YpUPbN5xh1lrLwOMc3te4J2FQPVpZNWXgmxnAd5xa+MlXMA/gZ4eu+fhkh 7IQL7T14vz8YROB2YjIvO+ju8LVM51RaLZ8zLg0hOBzfd2gEXrhPG2X5PUxHf5G0ZX+u CdrhiMla2tyNBmz3sVkERIsXBS35SkcEiYUdZxhbOIhCIGCuXq8esxVlbFyISzMokCau LS8Cbf6xwgjl4cZk3JTSCGieUT4oO/S8UiuOlWobrxOrdE9sLJf6//fit2lTAXZQo6Lx 2gSQ== X-Gm-Message-State: AMCzsaVH7eaZbx+zBqdkAEOs1vR3VkCB9prKAnWV/bKRPSDiTIC7nwVt JhP4DJIWfNHAQCxgGmrLC7c5Ow== X-Google-Smtp-Source: AOwi7QA/nE3DudE5bAqdSvWDR08uXWiJJyF9Qt7NepFZjmagDVLXv4MgKkFz+X/Fbsn8iZOlNaF5Aw== X-Received: by 10.233.237.5 with SMTP id c5mr4938677qkg.309.1506714275158; Fri, 29 Sep 2017 12:44:35 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id u4sm3154022qtg.14.2017.09.29.12.44.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2017 12:44:34 -0700 (PDT) From: Josef Bacik X-Google-Original-From: Josef Bacik To: kernel-team@fb.com, linux-btrfs@vger.kernel.org Subject: [PATCH 19/21] btrfs: don't call btrfs_start_delalloc_roots in flushoncommit Date: Fri, 29 Sep 2017 15:44:03 -0400 Message-Id: <1506714245-23072-20-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506714245-23072-1-git-send-email-jbacik@fb.com> References: <1506714245-23072-1-git-send-email-jbacik@fb.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We're holding the sb_start_intwrite lock at this point, and doing async filemap_flush of the inodes will result in a deadlock if we freeze the fs during this operation. This is because we could do a btrfs_join_transaction() in the thread we are waiting on which would block at sb_start_intwrite, and thus deadlock. Using writeback_inodes_sb() side steps the problem by not introducing all of these extra locking dependencies. Signed-off-by: Josef Bacik --- fs/btrfs/transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 68c3e1c04bca..9fed8c67b6e8 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1917,7 +1917,7 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info) { if (btrfs_test_opt(fs_info, FLUSHONCOMMIT)) - return btrfs_start_delalloc_roots(fs_info, 1, -1); + writeback_inodes_sb(fs_info->sb, WB_REASON_SYNC); return 0; }