From patchwork Wed Apr 12 16:10:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9677749 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 D1402601C3 for ; Wed, 12 Apr 2017 16:10:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C45D7283FE for ; Wed, 12 Apr 2017 16:10:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6AAC28627; Wed, 12 Apr 2017 16:10:19 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 3E1EC283FE for ; Wed, 12 Apr 2017 16:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754483AbdDLQKS (ORCPT ); Wed, 12 Apr 2017 12:10:18 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:55068 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753458AbdDLQKS (ORCPT ); Wed, 12 Apr 2017 12:10:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=auSZTHeG436bMG/semrssuAHgBeiH++WPM1LVqqc8bo=; b=U1EYFNQa2nZ9vd2+vWanuNpCL eDzqCT1TlriU51OfRkXvA4VAmR8GZC95aPptWOUAer3v4bcudJKZlsdMWAmuxC9xXmVXtU5wcQmSF inYcvL9l2RxBWcHR0UM7cijQvKp0gLoqox1BhDSG/N3rTWwJ8ft4Bl2Od0qddxTOG0o+i3tsjCVzD lc7oAnaOootw9aHkznwxQBVsKCtK0oGEojxF18TGSGHrp9IVVbzks+9Vx46hD/2TwJRPeX1CE2E0V QWxcmAF/2pypXvCZZeEGRrVZWtZcVjmTzNB50c4KMEA5IhzQbRnu+xlTeId9gPZ/5WhTG+fxrits8 J9UxI/Itw==; Received: from hch by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1cyKqX-0006Xf-Pz; Wed, 12 Apr 2017 16:10:17 +0000 Date: Wed, 12 Apr 2017 09:10:17 -0700 From: Christoph Hellwig To: Nikolay Borisov Cc: linux-xfs@vger.kernel.org Subject: Re: Deadlock between block allocation and block truncation Message-ID: <20170412161017.GA16590@infradead.org> References: <800468eb-3ded-9166-20a4-047de8018582@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <800468eb-3ded-9166-20a4-047de8018582@gmail.com> User-Agent: Mutt/1.8.0 (2017-02-23) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Nikolay, I guess the culprit is that truncate can free up to two extents in the same transaction and thus try to lock two different AGs without requiring them to be in increasing order. Does the one liner below fix the problem for you? Tested-by: Nikolay Borisov --- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 7605d8396596..29f2cd5afb04 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -58,7 +58,7 @@ kmem_zone_t *xfs_inode_zone; * Used in xfs_itruncate_extents(). This is the maximum number of extents * freed from a file in a single transaction. */ -#define XFS_ITRUNC_MAX_EXTENTS 2 +#define XFS_ITRUNC_MAX_EXTENTS 1 STATIC int xfs_iflush_int(struct xfs_inode *, struct xfs_buf *); STATIC int xfs_iunlink(struct xfs_trans *, struct xfs_inode *);