From patchwork Mon Dec 11 02:16:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10104103 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 A56EB60329 for ; Mon, 11 Dec 2017 02:20:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9375F2882F for ; Mon, 11 Dec 2017 02:20:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86CE329371; Mon, 11 Dec 2017 02:20:03 +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, UNPARSEABLE_RELAY 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 0B6FC2882F for ; Mon, 11 Dec 2017 02:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752312AbdLKCUC (ORCPT ); Sun, 10 Dec 2017 21:20:02 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:43744 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751640AbdLKCUB (ORCPT ); Sun, 10 Dec 2017 21:20:01 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vBB2DFrO126733 for ; Mon, 11 Dec 2017 02:20:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=c1aafgmX1D+dNpGOK4pEGrPSR3n0d/3Pr1egetjVQ5w=; b=otlECHVoKYP6qV+9JFE0Ene0DO3tHFOkHlPu3LX5CkygHCEg2zcANWWlhsM+1rXPB4xm fpfJLvGMT6XXQf3+RsX7LTHe/gbYPpkE0n68SAlOAAHeuurIEBoEMSvDcBzHdnFdeOoF HCza50qAfYtYmTiDLLJWloRBO3WguGsmyPkttVJ1IJ5VOnOsto7rM9LtkUSyeLjvDJeK SSQqCSYIUsfWZ7e6FBFdOy6W2dYO/8qerW7FeKxwN25/Agi8OIhjY2KxwHkq5v4NNG1n 1b9cvVDUenQKAFCzuf/+UsVmsTuX9E9JprvgFuv/8pOxHnnky2uGkqbQGy5xw9wvyTX3 4Q== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2esh07014w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Dec 2017 02:19:59 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vBB2Go9d019056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 11 Dec 2017 02:16:51 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vBB2GoQo013647 for ; Mon, 11 Dec 2017 02:16:50 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 10 Dec 2017 18:16:50 -0800 Subject: [PATCH 5/6] xfs: avoid infinite loop when cancelling CoW blocks after writeback failure From: "Darrick J. Wong" To: linux-xfs@vger.kernel.org Cc: darrick.wong@oracle.com Date: Sun, 10 Dec 2017 18:16:48 -0800 Message-ID: <151295860804.30614.8264763311495796776.stgit@magnolia> In-Reply-To: <151295857424.30614.8269461794142248028.stgit@magnolia> References: <151295857424.30614.8269461794142248028.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8741 signatures=668644 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=758 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712110030 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 From: Darrick J. Wong When we're cancelling a cow range, we don't always delete each extent that we iterate, so we have to move icur backwards in the list to avoid an infinite loop. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_reflink.c | 3 +++ 1 file changed, 3 insertions(+) -- 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_reflink.c b/fs/xfs/xfs_reflink.c index 99c5852..6931b0c 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -611,6 +611,9 @@ xfs_reflink_cancel_cow_blocks( /* Remove the mapping from the CoW fork. */ xfs_bmap_del_extent_cow(ip, &icur, &got, &del); + } else { + /* Didn't do anything, push cursor back. */ + xfs_iext_prev(ifp, &icur); } next_extent: if (!xfs_iext_get_extent(ifp, &icur, &got))