aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2018-10-18 02:20:39 -0400
committerDave Chinner <david@fromorbit.com>2018-10-18 02:20:39 -0400
commit56668a5cc420818b8e9c2197281d068552f80e46 (patch)
treeda5ebb43e62ed26409fd3f99e15264154ceacbdd
parent38b6238eb6b4f4b7fe5442670156c81b21516bee (diff)
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>
-rw-r--r--fs/xfs/xfs_fsops.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 7c00b8bedfe3..093c2b8d7e20 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -470,20 +470,13 @@ xfs_fs_goingdown(
470 */ 470 */
471void 471void
472xfs_do_force_shutdown( 472xfs_do_force_shutdown(
473 xfs_mount_t *mp, 473 struct xfs_mount *mp,
474 int flags, 474 int flags,
475 char *fname, 475 char *fname,
476 int lnnum) 476 int lnnum)
477{ 477{
478 int logerror; 478 bool logerror = flags & SHUTDOWN_LOG_IO_ERROR;
479
480 logerror = flags & SHUTDOWN_LOG_IO_ERROR;
481 479
482 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
483 xfs_notice(mp,
484 "%s(0x%x) called from line %d of file %s. Return address = "PTR_FMT,
485 __func__, flags, lnnum, fname, __return_address);
486 }
487 /* 480 /*
488 * No need to duplicate efforts. 481 * No need to duplicate efforts.
489 */ 482 */
@@ -499,27 +492,34 @@ xfs_do_force_shutdown(
499 if (xfs_log_force_umount(mp, logerror)) 492 if (xfs_log_force_umount(mp, logerror))
500 return; 493 return;
501 494
495 if (flags & SHUTDOWN_FORCE_UMOUNT) {
496 xfs_alert(mp,
497"User initiated shutdown received. Shutting down filesystem");
498 return;
499 }
500
501 xfs_notice(mp,
502"%s(0x%x) called from line %d of file %s. Return address = "PTR_FMT,
503 __func__, flags, lnnum, fname, __return_address);
504
502 if (flags & SHUTDOWN_CORRUPT_INCORE) { 505 if (flags & SHUTDOWN_CORRUPT_INCORE) {
503 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT, 506 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
504 "Corruption of in-memory data detected. Shutting down filesystem"); 507"Corruption of in-memory data detected. Shutting down filesystem");
505 if (XFS_ERRLEVEL_HIGH <= xfs_error_level) 508 if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
506 xfs_stack_trace(); 509 xfs_stack_trace();
507 } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) { 510 } else if (logerror) {
508 if (logerror) { 511 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
509 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR, 512 "Log I/O Error Detected. Shutting down filesystem");
510 "Log I/O Error Detected. Shutting down filesystem"); 513 } else if (flags & SHUTDOWN_DEVICE_REQ) {
511 } else if (flags & SHUTDOWN_DEVICE_REQ) { 514 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
512 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR, 515 "All device paths lost. Shutting down filesystem");
513 "All device paths lost. Shutting down filesystem"); 516 } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
514 } else if (!(flags & SHUTDOWN_REMOTE_REQ)) { 517 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
515 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR, 518 "I/O Error Detected. Shutting down filesystem");
516 "I/O Error Detected. Shutting down filesystem");
517 }
518 }
519 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
520 xfs_alert(mp,
521 "Please umount the filesystem and rectify the problem(s)");
522 } 519 }
520
521 xfs_alert(mp,
522 "Please unmount the filesystem and rectify the problem(s)");
523} 523}
524 524
525/* 525/*