2005-04-16 15:20:36 -07:00
|
|
|
/*
|
2006-06-19 08:39:53 +10:00
|
|
|
* Copyright (c) 2000-2006 Silicon Graphics, Inc.
|
2005-11-02 14:58:39 +11:00
|
|
|
* All Rights Reserved.
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
2005-11-02 14:58:39 +11:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
2005-04-16 15:20:36 -07:00
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
2005-11-02 14:58:39 +11:00
|
|
|
* This program is distributed in the hope that it would be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
2005-11-02 14:58:39 +11:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
|
|
|
#include "xfs.h"
|
2005-11-02 14:38:42 +11:00
|
|
|
#include "xfs_fs.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
#include "xfs_types.h"
|
2005-11-02 14:38:42 +11:00
|
|
|
#include "xfs_bit.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
#include "xfs_log.h"
|
|
|
|
#include "xfs_trans.h"
|
|
|
|
#include "xfs_sb.h"
|
|
|
|
#include "xfs_ag.h"
|
|
|
|
#include "xfs_mount.h"
|
|
|
|
#include "xfs_bmap_btree.h"
|
2005-11-02 14:38:42 +11:00
|
|
|
#include "xfs_dinode.h"
|
|
|
|
#include "xfs_inode.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
#include "xfs_error.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Force a shutdown of the filesystem instantly while keeping
|
|
|
|
* the filesystem consistent. We don't do an unmount here; just shutdown
|
|
|
|
* the shop, make sure that absolutely nothing persistent happens to
|
|
|
|
* this filesystem after this point.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
xfs_do_force_shutdown(
|
2007-08-30 17:20:31 +10:00
|
|
|
xfs_mount_t *mp,
|
2005-04-16 15:20:36 -07:00
|
|
|
int flags,
|
|
|
|
char *fname,
|
|
|
|
int lnnum)
|
|
|
|
{
|
|
|
|
int logerror;
|
|
|
|
|
2006-06-09 14:58:38 +10:00
|
|
|
logerror = flags & SHUTDOWN_LOG_IO_ERROR;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2006-06-09 14:58:38 +10:00
|
|
|
if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
|
2011-03-07 10:08:35 +11:00
|
|
|
xfs_notice(mp,
|
|
|
|
"%s(0x%x) called from line %d of file %s. Return address = 0x%p",
|
|
|
|
__func__, flags, lnnum, fname, __return_address);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* No need to duplicate efforts.
|
|
|
|
*/
|
|
|
|
if (XFS_FORCED_SHUTDOWN(mp) && !logerror)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This flags XFS_MOUNT_FS_SHUTDOWN, makes sure that we don't
|
|
|
|
* queue up anybody new on the log reservations, and wakes up
|
2006-06-09 14:58:38 +10:00
|
|
|
* everybody who's sleeping on log reservations to tell them
|
|
|
|
* the bad news.
|
2005-04-16 15:20:36 -07:00
|
|
|
*/
|
|
|
|
if (xfs_log_force_umount(mp, logerror))
|
|
|
|
return;
|
|
|
|
|
2006-06-09 14:58:38 +10:00
|
|
|
if (flags & SHUTDOWN_CORRUPT_INCORE) {
|
2011-03-07 10:02:35 +11:00
|
|
|
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
|
|
|
|
"Corruption of in-memory data detected. Shutting down filesystem");
|
|
|
|
if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
|
2005-04-16 15:20:36 -07:00
|
|
|
xfs_stack_trace();
|
2006-06-09 14:58:38 +10:00
|
|
|
} else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
|
2005-04-16 15:20:36 -07:00
|
|
|
if (logerror) {
|
2011-03-07 10:02:35 +11:00
|
|
|
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
|
|
|
|
"Log I/O Error Detected. Shutting down filesystem");
|
2006-06-09 14:58:38 +10:00
|
|
|
} else if (flags & SHUTDOWN_DEVICE_REQ) {
|
2011-03-07 10:02:35 +11:00
|
|
|
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
|
|
|
|
"All device paths lost. Shutting down filesystem");
|
2006-06-09 14:58:38 +10:00
|
|
|
} else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
|
2011-03-07 10:02:35 +11:00
|
|
|
xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
|
|
|
|
"I/O Error Detected. Shutting down filesystem");
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
}
|
2006-06-09 14:58:38 +10:00
|
|
|
if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
|
2011-03-07 10:08:35 +11:00
|
|
|
xfs_alert(mp,
|
|
|
|
"Please umount the filesystem and rectify the problem(s)");
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
}
|