From patchwork Thu Sep 29 12:56:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Maiolino X-Patchwork-Id: 9356413 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 68CD56077A for ; Thu, 29 Sep 2016 12:56:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A9B8299DB for ; Thu, 29 Sep 2016 12:56:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E9BA299E2; Thu, 29 Sep 2016 12:56:36 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5ECFC299DB for ; Thu, 29 Sep 2016 12:56:34 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 1A6527CA6; Thu, 29 Sep 2016 07:56:32 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay3.corp.sgi.com [198.149.34.15]) by oss.sgi.com (Postfix) with ESMTP id C16237CA1 for ; Thu, 29 Sep 2016 07:56:28 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay3.corp.sgi.com (Postfix) with ESMTP id 35AC9AC003 for ; Thu, 29 Sep 2016 05:56:27 -0700 (PDT) X-ASG-Debug-ID: 1475153783-0bf57c7e212ff20001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id LNKd4psvkYBYDorl (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 29 Sep 2016 05:56:24 -0700 (PDT) X-Barracuda-Envelope-From: cmaiolino@redhat.com X-Barracuda-Effective-Source-IP: mx1.redhat.com[209.132.183.28] X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-ASG-Whitelist: Client Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B93F627C3; Thu, 29 Sep 2016 12:56:23 +0000 (UTC) Received: from zion.usersys.redhat.com (vpn-54-24.rdu2.redhat.com [10.10.54.24]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8TCuLSM022994; Thu, 29 Sep 2016 08:56:22 -0400 From: Carlos Maiolino To: linux-xfs@vger.kernel.org, xfs@oss.sgi.com Subject: [PATCH] [RFC] Release buffer locks in case of IO error Date: Thu, 29 Sep 2016 14:56:17 +0200 X-ASG-Orig-Subj: [PATCH] [RFC] Release buffer locks in case of IO error Message-Id: <1475153777-28558-1-git-send-email-cmaiolino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 29 Sep 2016 12:56:23 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1475153783 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.176.15:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 2025 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP I have been working in a bug still regarding xfs fail_at_unmount configuration, where, even though the configuration is enable, an unmount attempt will still hang if the AIL buf items are locked as a result of a previous failed attempt to flush these items. Currently, if there is a failure while trying to flush inode buffers to disk, these items are kept in AIL with FLUSHING status and with the locks held, making them unable to be retried. Either during unmount, where they will be retried and 'failed', or if using a thin provisioned device, the pool is actually extended, to accomodate these not-yet-flushed items, instead of retrying to flush such items, xfs is unable to retry them, once they are already locked. Brian came with a suggestion about how to fix it, releasing the locks in case we had a failed write attempt. I know there are some other persons also involved in this problem, so I think it's a good idea to send Brian's patch here and get some more comments about it. I'm keeping Brian's signed-off once he wrote the whole patch. Signed-off-by: Brian Foster --- fs/xfs/xfs_inode_item.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index 892c2ac..cce0373 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c @@ -517,7 +517,26 @@ xfs_inode_item_push( * the AIL. */ if (!xfs_iflock_nowait(ip)) { - rval = XFS_ITEM_FLUSHING; + int error; + struct xfs_dinode *dip; + + error = xfs_imap_to_bp(ip->i_mount, NULL, &ip->i_imap, &dip, + &bp, XBF_TRYLOCK, 0); + if (error) { + rval = XFS_ITEM_FLUSHING; + goto out_unlock; + } + + if (!(bp->b_flags & XBF_WRITE_FAIL)) { + rval = XFS_ITEM_FLUSHING; + xfs_buf_relse(bp); + goto out_unlock; + } + + if (!xfs_buf_delwri_queue(bp, buffer_list)) + rval = XFS_ITEM_FLUSHING; + + xfs_buf_relse(bp); goto out_unlock; }