summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormishra <none@none>2006-09-12 15:12:02 -0700
committermishra <none@none>2006-09-12 15:12:02 -0700
commit5b4dc236e7280fc192b049c0987f072ab71e69b6 (patch)
tree6d77da5b5400b74fb5c752eb2f5062a8bc3dd2a6
parent1da458186bf37cdb504233b8f280111f06521afb (diff)
downloadillumos-joyent-5b4dc236e7280fc192b049c0987f072ab71e69b6.tar.gz
6352196 fsck cannot open disk images
6367777 *fsck* svc:/system/filesystem/usr fails to start from milestone 'none' 6367948 new fsck_ufs(1M) has nits when dealing with already mounted file systems
-rw-r--r--usr/src/cmd/fs.d/ufs/fsck/main.c20
-rw-r--r--usr/src/cmd/fs.d/ufs/fsck/setup.c11
-rw-r--r--usr/src/cmd/svc/shell/fs_include.sh10
3 files changed, 28 insertions, 13 deletions
diff --git a/usr/src/cmd/fs.d/ufs/fsck/main.c b/usr/src/cmd/fs.d/ufs/fsck/main.c
index 57970fc67b..928b609998 100644
--- a/usr/src/cmd/fs.d/ufs/fsck/main.c
+++ b/usr/src/cmd/fs.d/ufs/fsck/main.c
@@ -470,7 +470,8 @@ recount:
}
if (!nflag && mountedfs == M_RW) {
- iscorrupt = 1;
+ (void) printf("FILESYSTEM MAY STILL BE INCONSISTENT.\n");
+ rerun = 1;
}
if (have_dups()) {
@@ -505,7 +506,13 @@ recount:
}
if (iscorrupt) {
- (void) printf("FILESYSTEM MAY STILL BE INCONSISTENT.\n");
+ if (mountedfs == M_RW)
+ (void) printf("FS IS MOUNTED R/W AND"
+ " FSCK DID ITS BEST TO FIX"
+ " INCONSISTENCIES.\n");
+ else
+ (void) printf("FILESYSTEM MAY STILL BE"
+ " INCONSISTENT.\n");
rerun = 1;
}
@@ -630,8 +637,13 @@ recount:
if (iscorrupt)
(void) printf("***** FILE SYSTEM IS BAD *****\n");
- if (rerun)
- (void) printf("\n***** PLEASE RERUN FSCK *****\n");
+ if (rerun) {
+ if (mountedfs == M_RW)
+ (void) printf("\n***** PLEASE RERUN FSCK ON UNMOUNTED"
+ " FILE SYSTEM *****\n");
+ else
+ (void) printf("\n***** PLEASE RERUN FSCK *****\n");
+ }
if ((exitstat == 0) &&
(((mountedfs != M_NOMNT) && !errorlocked) || hotroot)) {
diff --git a/usr/src/cmd/fs.d/ufs/fsck/setup.c b/usr/src/cmd/fs.d/ufs/fsck/setup.c
index a0d32b926c..7e6feedfd4 100644
--- a/usr/src/cmd/fs.d/ufs/fsck/setup.c
+++ b/usr/src/cmd/fs.d/ufs/fsck/setup.c
@@ -388,6 +388,7 @@ derive_devstr(const caddr_t dev, caddr_t devstr, size_t str_size)
break;
case S_IFREG:
rflag = 0;
+ (void) strlcpy(devstr, dev, str_size);
break;
case S_IFCHR:
case S_IFBLK:
@@ -460,7 +461,7 @@ check_mount_state(caddr_t devstr, size_t str_size)
pfatal("%s IS CURRENTLY MOUNTED%s.",
devstr, mountedfs == M_RW ? " READ/WRITE" : "");
} else {
- if (!nflag) {
+ if (!nflag && !mflag) {
pwarn("%s IS CURRENTLY MOUNTED READ/%s.",
devstr, mountedfs == M_RW ? "WRITE" :
"ONLY");
@@ -468,10 +469,6 @@ check_mount_state(caddr_t devstr, size_t str_size)
exitstat = EXMOUNTED;
errexit("Program terminated");
}
- } else {
- pwarn("%s IS CURRENTLY MOUNTED READ/%s.\n",
- devstr, mountedfs == M_RW ? "WRITE" :
- "ONLY");
}
}
} else if (is_dev && rflag) {
@@ -943,6 +940,10 @@ setup(caddr_t dev)
if (open_and_intro(devstr, corefs) == -1)
goto cleanup;
+ if (mflag && mounted(devstr, devstr,
+ sizeof (devstr)) == M_RW)
+ return (devstr);
+
/*
* Check log state
*/
diff --git a/usr/src/cmd/svc/shell/fs_include.sh b/usr/src/cmd/svc/shell/fs_include.sh
index 6771b0d2bb..55f817efd4 100644
--- a/usr/src/cmd/svc/shell/fs_include.sh
+++ b/usr/src/cmd/svc/shell/fs_include.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
@@ -159,6 +158,9 @@ checkfs() {
checkmessage "$1" "$2" "$3"
return 1
;;
+ 33) # already mounted
+ return 0
+ ;;
*) # fsck child process killed (+ error code 35)
checkmessage2 "$1" "$2" "$3" "$?"