Commit 7582416a authored by Donald Douwsma's avatar Donald Douwsma Committed by Jialin Zhang
Browse files

xfs: allow setting full range of panic tags

mainline inclusion
from mainline-v6.3-rc1
commit 167ce4cb
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=167ce4cbfa370114fee61ad5b58e401d95e2d5cd



--------------------------------

xfs will not allow combining other panic masks with
XFS_PTAG_VERIFIER_ERROR.

 # sysctl fs.xfs.panic_mask=511
 sysctl: setting key "fs.xfs.panic_mask": Invalid argument
 fs.xfs.panic_mask = 511

Update to the maximum value that can be set to allow the full range of
masks. Do this using a mask of possible values to prevent this happening
again as suggested by Darrick.

Fixes: d519da41 ("xfs: Introduce XFS_PTAG_VERIFIER_ERROR panic mask")
Signed-off-by: default avatarDonald Douwsma <ddouwsma@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>

Conflicts:
	fs/xfs/xfs_error.h

Signed-off-by: default avataryangerkun <yangerkun@huaweicloud.com>
Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent 2367be02
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -296,7 +296,7 @@ The following sysctls are available for the XFS filesystem:
		XFS_ERRLEVEL_LOW:       1
		XFS_ERRLEVEL_HIGH:      5

  fs.xfs.panic_mask		(Min: 0  Default: 0  Max: 256)
  fs.xfs.panic_mask		(Min: 0  Default: 0  Max: 511)
	Causes certain error conditions to call BUG(). Value is a bitmask;
	OR together the tags which represent errors which should cause panics:

+11 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp);

/*
 * XFS panic tags -- allow a call to xfs_alert_tag() be turned into
 *			a panic by setting xfs_panic_mask in a sysctl.
 *			a panic by setting fs.xfs.panic_mask in a sysctl.
 */
#define		XFS_NO_PTAG			0
#define		XFS_PTAG_IFLUSH			0x00000001
@@ -75,4 +75,14 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp);
#define		XFS_PTAG_FSBLOCK_ZERO		0x00000080
#define		XFS_PTAG_VERIFIER_ERROR		0x00000100

#define		XFS_PTAG_MASK	(XFS_PTAG_IFLUSH | \
				 XFS_PTAG_LOGRES | \
				 XFS_PTAG_AILDELETE | \
				 XFS_PTAG_ERROR_REPORT | \
				 XFS_PTAG_SHUTDOWN_CORRUPT | \
				 XFS_PTAG_SHUTDOWN_IOERROR | \
				 XFS_PTAG_SHUTDOWN_LOGERROR | \
				 XFS_PTAG_FSBLOCK_ZERO | \
				 XFS_PTAG_VERIFIER_ERROR)

#endif	/* __XFS_ERROR_H__ */
+2 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 * All Rights Reserved.
 */
#include "xfs.h"
#include "xfs_error.h"

/*
 * Tunable XFS parameters.  xfs_params is required even when CONFIG_SYSCTL=n,
@@ -15,7 +16,7 @@ xfs_param_t xfs_params = {
			  /*	MIN		DFLT		MAX	*/
	.sgid_inherit	= {	0,		0,		1	},
	.symlink_mode	= {	0,		0,		1	},
	.panic_mask	= {	0,		0,		256	},
	.panic_mask	= {	0,		0,		XFS_PTAG_MASK},
	.error_level	= {	0,		3,		11	},
	.syncd_timer	= {	1*100,		30*100,		7200*100},
	.stats_clear	= {	0,		0,		1	},