From patchwork Thu Aug 31 14:15:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 9932289 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 9FBAA603B4 for ; Thu, 31 Aug 2017 14:11:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9390D28514 for ; Thu, 31 Aug 2017 14:11:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 884CA28660; Thu, 31 Aug 2017 14:11:17 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 320772851B for ; Thu, 31 Aug 2017 14:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751205AbdHaOLQ (ORCPT ); Thu, 31 Aug 2017 10:11:16 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5075 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbdHaOLO (ORCPT ); Thu, 31 Aug 2017 10:11:14 -0400 Received: from 172.30.72.60 (EHLO DGGEMS410-HUB.china.huawei.com) ([172.30.72.60]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DGI68921; Thu, 31 Aug 2017 22:11:08 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.301.0; Thu, 31 Aug 2017 22:11:04 +0800 From: Hou Tao To: CC: , , Subject: [PATCH 5/7] xfs: construct the values of error configuration for XFS error handler Date: Thu, 31 Aug 2017 22:15:56 +0800 Message-ID: <1504188958-18374-6-git-send-email-houtao1@huawei.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1504188958-18374-1-git-send-email-houtao1@huawei.com> References: <1504188958-18374-1-git-send-email-houtao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0206.59A818FC.0169, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d2a7846a4679c391eaba51ac59731b28 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 When a corresponding XFS_ERR_CFG_BIT_* bit had been set on the error configuration, the value of the fs-specific error configuration will be returned, else the value of the default error configuration will be used. Signed-off-by: Hou Tao --- fs/xfs/xfs_buf_item.c | 3 ++- fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_sysfs.c | 19 ++++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 186c5f5..4f9fd50 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -1146,7 +1146,8 @@ xfs_buf_iodone_callback_error( goto permanent_error; /* At unmount we may treat errors differently */ - if ((mp->m_flags & XFS_MOUNT_UNMOUNTING) && mp->m_eobj.fail_unmount) + if ((mp->m_flags & XFS_MOUNT_UNMOUNTING) && + xfs_fail_at_unmount(&mp->m_eobj)) goto permanent_error; /* diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 906c3a4..ceed665 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -475,5 +475,6 @@ int xfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb, void xfs_error_get_cfg(struct xfs_error_obj *eobj, int error_class, int error, struct xfs_error_cfg *cfg); +bool xfs_fail_at_unmount(struct xfs_error_obj *eobj); #endif /* __XFS_MOUNT_H__ */ diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c index c623d92..cd7dfca 100644 --- a/fs/xfs/xfs_sysfs.c +++ b/fs/xfs/xfs_sysfs.c @@ -713,6 +713,7 @@ xfs_error_get_cfg( struct xfs_error_cfg *cfg) { int idx; + struct xfs_error_cfg_kobj *kobj; if (error < 0) error = -error; @@ -732,5 +733,21 @@ xfs_error_get_cfg( break; } - *cfg = eobj->cfg_kobj[error_class][idx].cfg; + *cfg = xfs_dft_eobj.cfg_kobj[error_class][idx].cfg; + + kobj = &eobj->cfg_kobj[error_class][idx]; + if (test_bit(XFS_ERR_CFG_BIT_PRIV_MAX_RETRIES, &kobj->flags)) + cfg->max_retries = kobj->cfg.max_retries; + if (test_bit(XFS_ERR_CFG_BIT_PRIV_RETRY_TIMEOUT, &kobj->flags)) + cfg->retry_timeout = kobj->cfg.retry_timeout; +} + +bool +xfs_fail_at_unmount( + struct xfs_error_obj *eobj) +{ + if (!test_bit(XFS_ERR_CFG_BIT_PRIV_FAIL_UNMOUNT, &eobj->flags)) + return xfs_dft_eobj.fail_unmount; + else + return eobj->fail_unmount; }