Commit ccbc432a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nathan Scott

[XFS] Implement xfs_panic_mask

SGI Modid: 2.5.x-xfs:slinx:134172a
parent a04fe871
......@@ -37,7 +37,6 @@
#include <xfs.h>
uint64_t xfs_panic_mask; /* set to cause more panics */
unsigned long xfs_physmem;
/*
......
......@@ -71,6 +71,7 @@
#define restricted_chown xfs_params.restrict_chown
#define irix_sgid_inherit xfs_params.sgid_inherit
#define irix_symlink_mode xfs_params.symlink_mode
#define xfs_panic_mask xfs_params.panic_mask
typedef struct xfs_dirent { /* data from readdir() */
xfs_ino_t d_ino; /* inode number of entry */
......
......@@ -40,10 +40,10 @@
extern struct xfsstats xfsstats;
STATIC ulong xfs_min[XFS_PARAM] = { 0, 0, 0, 0 };
STATIC ulong xfs_max[XFS_PARAM] = { 1, 1, 1, 1 };
STATIC ulong xfs_min[XFS_PARAM] = { 0, 0, 0, 0, 0 };
STATIC ulong xfs_max[XFS_PARAM] = { 1, 1, 1, 1, 127 };
xfs_param_t xfs_params = { 0, 1, 0, 0 };
xfs_param_t xfs_params = { 0, 1, 0, 0, 0 };
static struct ctl_table_header *xfs_table_header;
......@@ -90,6 +90,10 @@ STATIC ctl_table xfs_table[] = {
sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
&sysctl_intvec, NULL, &xfs_min[5], &xfs_max[5]},
{XFS_PANIC_MASK, "panic_mask", &xfs_params.panic_mask,
sizeof(ulong), 0644, NULL, &proc_doulongvec_minmax,
&sysctl_intvec, NULL, &xfs_min[6], &xfs_max[6]},
{0}
};
......
......@@ -47,6 +47,7 @@ typedef struct xfs_param {
ulong sgid_inherit; /* Inherit ISGID bit if process' GID is */
/* not a member of the parent dir GID. */
ulong symlink_mode; /* Symlink creat mode affected by umask. */
ulong panic_mask; /* bitmask to specify panics on errors. */
} xfs_param_t;
enum {
......@@ -54,6 +55,7 @@ enum {
XFS_RESTRICT_CHOWN = 2,
XFS_SGID_INHERIT = 3,
XFS_SYMLINK_MODE = 4,
XFS_PANIC_MASK = 5,
};
extern xfs_param_t xfs_params;
......
......@@ -224,11 +224,15 @@ xfs_cmn_err(uint64_t panic_tag, int level, xfs_mount_t *mp, char *fmt, ...)
{
va_list ap;
#ifdef DEBUG
xfs_panic_mask |= XFS_PTAG_SHUTDOWN_CORRUPT;
#endif
if (xfs_panic_mask && (xfs_panic_mask & panic_tag)
&& (level & CE_ALERT)) {
level &= ~CE_ALERT;
level |= CE_PANIC;
cmn_err(CE_ALERT, "Transforming an alert into a panic.");
cmn_err(CE_ALERT, "XFS: Transforming an alert into a BUG.");
}
va_start(ap, fmt);
xfs_fs_vcmn_err(level, mp, fmt, ap);
......
......@@ -138,13 +138,18 @@ int xfs_errortag_clearall_umount(int64_t fsid, char *fsname,
/*
* XFS panic tags -- allow a call to xfs_cmn_err() be turned into
* a panic by setting xfs_panic_mask in the
* stune file.
* a panic by setting xfs_panic_mask in a
* sysctl. update xfs_max[XFS_PARAM] if
* more are added.
*/
#define XFS_NO_PTAG 0LL
#define XFS_PTAG_IFLUSH 0x0000000000000001LL
#define XFS_PTAG_LOGRES 0x0000000000000002LL
#define XFS_PTAG_AILDELETE 0x0000000000000004LL
#define XFS_PTAG_AVAILABLE 0x0000000000000008LL
#define XFS_PTAG_SHUTDOWN_CORRUPT 0x0000000000000010LL
#define XFS_PTAG_SHUTDOWN_IOERROR 0x0000000000000020LL
#define XFS_PTAG_SHUTDOWN_LOGERROR 0x0000000000000040LL
struct xfs_mount;
/* PRINTFLIKE4 */
......
......@@ -116,16 +116,16 @@ xfs_do_force_shutdown(
return;
if (flags & XFS_CORRUPT_INCORE) {
cmn_err(CE_ALERT,
xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp,
"Corruption of in-memory data detected. Shutting down filesystem: %s",
mp->m_fsname);
} else if (!(flags & XFS_FORCE_UMOUNT)) {
if (logerror) {
cmn_err(CE_ALERT,
xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp,
"Log I/O Error Detected. Shutting down filesystem: %s",
mp->m_fsname);
} else if (!(flags & XFS_SHUTDOWN_REMOTE_REQ)) {
cmn_err(CE_ALERT,
xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp,
"I/O Error Detected. Shutting down filesystem: %s",
mp->m_fsname);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment