xfs: issue log message on user force shutdown
The kernel only issues a log message that it's been shut down when the filesystem triggers a shutdown itself. Hence there is no trace in the log when a shutdown is triggered manually from userspace. This can make it hard to see sequence of events in the log when things go wrong, so make sure we always log a message when a shutdown is run. While there, clean up the logic flow so we don't have to continually check if the shutdown trigger was user initiated before logging shutdown messages. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
38b6238eb6
commit
56668a5cc4
@ -470,20 +470,13 @@ xfs_fs_goingdown(
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xfs_do_force_shutdown(
|
xfs_do_force_shutdown(
|
||||||
xfs_mount_t *mp,
|
struct xfs_mount *mp,
|
||||||
int flags,
|
int flags,
|
||||||
char *fname,
|
char *fname,
|
||||||
int lnnum)
|
int lnnum)
|
||||||
{
|
{
|
||||||
int logerror;
|
bool logerror = flags & SHUTDOWN_LOG_IO_ERROR;
|
||||||
|
|
||||||
logerror = flags & SHUTDOWN_LOG_IO_ERROR;
|
|
||||||
|
|
||||||
if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
|
|
||||||
xfs_notice(mp,
|
|
||||||
"%s(0x%x) called from line %d of file %s. Return address = "PTR_FMT,
|
|
||||||
__func__, flags, lnnum, fname, __return_address);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* No need to duplicate efforts.
|
* No need to duplicate efforts.
|
||||||
*/
|
*/
|
||||||
@ -499,13 +492,22 @@ xfs_do_force_shutdown(
|
|||||||
if (xfs_log_force_umount(mp, logerror))
|
if (xfs_log_force_umount(mp, logerror))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (flags & SHUTDOWN_FORCE_UMOUNT) {
|
||||||
|
xfs_alert(mp,
|
||||||
|
"User initiated shutdown received. Shutting down filesystem");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xfs_notice(mp,
|
||||||
|
"%s(0x%x) called from line %d of file %s. Return address = "PTR_FMT,
|
||||||
|
__func__, flags, lnnum, fname, __return_address);
|
||||||
|
|
||||||
if (flags & SHUTDOWN_CORRUPT_INCORE) {
|
if (flags & SHUTDOWN_CORRUPT_INCORE) {
|
||||||
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
|
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
|
||||||
"Corruption of in-memory data detected. Shutting down filesystem");
|
"Corruption of in-memory data detected. Shutting down filesystem");
|
||||||
if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
|
if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
|
||||||
xfs_stack_trace();
|
xfs_stack_trace();
|
||||||
} else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
|
} else if (logerror) {
|
||||||
if (logerror) {
|
|
||||||
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
|
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
|
||||||
"Log I/O Error Detected. Shutting down filesystem");
|
"Log I/O Error Detected. Shutting down filesystem");
|
||||||
} else if (flags & SHUTDOWN_DEVICE_REQ) {
|
} else if (flags & SHUTDOWN_DEVICE_REQ) {
|
||||||
@ -515,11 +517,9 @@ xfs_do_force_shutdown(
|
|||||||
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
|
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
|
||||||
"I/O Error Detected. Shutting down filesystem");
|
"I/O Error Detected. Shutting down filesystem");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
|
|
||||||
xfs_alert(mp,
|
xfs_alert(mp,
|
||||||
"Please umount the filesystem and rectify the problem(s)");
|
"Please unmount the filesystem and rectify the problem(s)");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user