xfs: check all defer ops types
PATCH 1/1 xfs: check all defer ops types
From: Darrick J. Wong <[email protected]>
Make sure we have all the defer ops types loaded before proceeding.
Signed-off-by Darrick J. Wong <[email protected]>
--- fs/xfs/libxfs/xfs_defer.c | 12 ++++++++++++ fs/xfs/libxfs/xfs_defer.h | 1 + fs/xfs/xfs_super.c | 6 ++++++ 3 files changed, 19 insertions(+)
fs/xfs/libxfs/xfs_defer.c +12 -0
@@ -547,3 +547,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; +}
fs/xfs/libxfs/xfs_defer.h +1 -0
@@ -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__ */
fs/xfs/xfs_super.c +6 -0
@@ -38,6 +38,7 @@#include "xfs_refcount_item.h" #include "xfs_bmap_item.h" #include "xfs_reflink.h" +#include "xfs_defer.h" #include <linux/namei.h> #include <linux/dax.h>
@@ -2220,6 +2221,11 @@ init_xfs_fs(void)xfs_rmap_update_init_defer_op ();xfs_refcount_update_init_defer_op ();xfs_bmap_update_init_defer_op (); +if (!xfs_defer_check_all_present ()) { +printk (KERN_ERR "XFS: missing defer ops types\n" ); + error = -EINVAL ; + goto out; + }xfs_dir_startup ();