From patchwork Fri Oct 26 16:19:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10657667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B575814BD for ; Fri, 26 Oct 2018 16:19:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A22D82BCFE for ; Fri, 26 Oct 2018 16:19:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 960032CADB; Fri, 26 Oct 2018 16:19:15 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, 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 477622BCFE for ; Fri, 26 Oct 2018 16:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbeJ0A4x (ORCPT ); Fri, 26 Oct 2018 20:56:53 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:47320 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbeJ0A4x (ORCPT ); Fri, 26 Oct 2018 20:56:53 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9QGCuIB010827; Fri, 26 Oct 2018 16:19:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=C/V+GileaXzenAhHlx5dcyiKwTlfKLot6ptbk75b/BQ=; b=A7c8hEXZtm2D513At2y+5JxIk/6Ml+Fuus+zNYZjSokU67LFhZ1v+4JIBbN69zxps2pt B9z+oacmD+OZetS9ETWW6okkzttOadTAlrNZ9bxIohm5MeqqQS0cF0Yb3GtCLHfoOT7h ioZztKMecuMxoFUBMJi5CbMZAPpllTNhpx7xIEvT7TwRK+6PTwDcm0P/O3kJYM3WR+yo XudhQ7d1pEJy3jcmBLT+pbBt2hYIZ+vNZvyYOdlXXp4sGnreYkgDwnv8VS0BCE/n6Kvo daDGkd15xmC5qtmhAOpEsWdb8rg4IYOByDznp6Eb2FfndZguk47feuMprIVGhtxKDGfY 7g== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2n7usur7pa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Oct 2018 16:19:11 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9QGJ6aS007078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 26 Oct 2018 16:19:06 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w9QGJ6Xg005958; Fri, 26 Oct 2018 16:19:06 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 26 Oct 2018 09:19:05 -0700 Date: Fri, 26 Oct 2018 09:19:05 -0700 From: "Darrick J. Wong" To: Eric Sandeen Cc: xfs Subject: [PATCH] libxfs: check all defer ops types Message-ID: <20181026161905.GH28243@magnolia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9057 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810260136 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 Make sure we have all the defer ops types loaded before proceeding. Signed-off-by: Darrick J. Wong --- libxfs/init.c | 5 +++++ libxfs/xfs_defer.c | 12 ++++++++++++ libxfs/xfs_defer.h | 1 + 3 files changed, 18 insertions(+) diff --git a/libxfs/init.c b/libxfs/init.c index 750b8f20..d1fdc3a8 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -253,6 +253,11 @@ libxfs_init(libxfs_init_t *a) xfs_rmap_update_init_defer_op(); xfs_refcount_update_init_defer_op(); xfs_bmap_update_init_defer_op(); + if (!xfs_defer_check_all_present()) { + fprintf(stderr, _("%s: defer ops not all there\n"), + progname); + goto done; + } radix_tree_init(); diff --git a/libxfs/xfs_defer.c b/libxfs/xfs_defer.c index 5a6da0f3..cd3a8ef3 100644 --- a/libxfs/xfs_defer.c +++ b/libxfs/xfs_defer.c @@ -545,3 +545,15 @@ xfs_defer_move( xfs_defer_reset(stp); } + +/* Make sure we filled out all the defer_ops types. */ +bool +xfs_defer_check_all_present(void) +{ + int x; + + for(x = 0; x < XFS_DEFER_OPS_TYPE_MAX; x++) + if (defer_op_types[x] == NULL) + return false; + return true; +} diff --git a/libxfs/xfs_defer.h b/libxfs/xfs_defer.h index 2584a5b9..bc7ae7ff 100644 --- a/libxfs/xfs_defer.h +++ b/libxfs/xfs_defer.h @@ -57,5 +57,6 @@ struct xfs_defer_op_type { }; void xfs_defer_init_op_type(const struct xfs_defer_op_type *type); +bool xfs_defer_check_all_present(void); #endif /* __XFS_DEFER_H__ */