2 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "xfs_types.h"
23 #include "xfs_trans.h"
26 #include "xfs_mount.h"
27 #include "xfs_bmap_btree.h"
28 #include "xfs_dinode.h"
29 #include "xfs_inode.h"
30 #include "xfs_error.h"
33 * Force a shutdown of the filesystem instantly while keeping
34 * the filesystem consistent. We don't do an unmount here; just shutdown
35 * the shop, make sure that absolutely nothing persistent happens to
36 * this filesystem after this point.
39 xfs_do_force_shutdown(
47 logerror
= flags
& SHUTDOWN_LOG_IO_ERROR
;
49 if (!(flags
& SHUTDOWN_FORCE_UMOUNT
)) {
51 "%s(0x%x) called from line %d of file %s. Return address = 0x%p",
52 __func__
, flags
, lnnum
, fname
, __return_address
);
55 * No need to duplicate efforts.
57 if (XFS_FORCED_SHUTDOWN(mp
) && !logerror
)
61 * This flags XFS_MOUNT_FS_SHUTDOWN, makes sure that we don't
62 * queue up anybody new on the log reservations, and wakes up
63 * everybody who's sleeping on log reservations to tell them
66 if (xfs_log_force_umount(mp
, logerror
))
69 if (flags
& SHUTDOWN_CORRUPT_INCORE
) {
70 xfs_alert_tag(mp
, XFS_PTAG_SHUTDOWN_CORRUPT
,
71 "Corruption of in-memory data detected. Shutting down filesystem");
72 if (XFS_ERRLEVEL_HIGH
<= xfs_error_level
)
74 } else if (!(flags
& SHUTDOWN_FORCE_UMOUNT
)) {
76 xfs_alert_tag(mp
, XFS_PTAG_SHUTDOWN_LOGERROR
,
77 "Log I/O Error Detected. Shutting down filesystem");
78 } else if (flags
& SHUTDOWN_DEVICE_REQ
) {
79 xfs_alert_tag(mp
, XFS_PTAG_SHUTDOWN_IOERROR
,
80 "All device paths lost. Shutting down filesystem");
81 } else if (!(flags
& SHUTDOWN_REMOTE_REQ
)) {
82 xfs_alert_tag(mp
, XFS_PTAG_SHUTDOWN_IOERROR
,
83 "I/O Error Detected. Shutting down filesystem");
86 if (!(flags
& SHUTDOWN_FORCE_UMOUNT
)) {
88 "Please umount the filesystem and rectify the problem(s)");