summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2001-04-14 05:26:28 +0000
committermckusick <mckusick@FreeBSD.org>2001-04-14 05:26:28 +0000
commit6a7a6ab20dfb94565a745e0bfbacf5ab788e846f (patch)
treebdc2528ca03872225e6771d56963c894959812f3
parentefb187afd627d04e95f8e2655dd3b31213823097 (diff)
downloadFreeBSD-src-6a7a6ab20dfb94565a745e0bfbacf5ab788e846f.zip
FreeBSD-src-6a7a6ab20dfb94565a745e0bfbacf5ab788e846f.tar.gz
This checkin adds support in ufs/ffs for the FS_NEEDSFSCK flag.
It is described in ufs/ffs/fs.h as follows: /* * Filesystem flags. * * Note that the FS_NEEDSFSCK flag is set and cleared only by the * fsck utility. It is set when background fsck finds an unexpected * inconsistency which requires a traditional foreground fsck to be * run. Such inconsistencies should only be found after an uncorrectable * disk error. A foreground fsck will clear the FS_NEEDSFSCK flag when * it has successfully cleaned up the filesystem. The kernel uses this * flag to enforce that inconsistent filesystems be mounted read-only. */ #define FS_UNCLEAN 0x01 /* filesystem not clean at mount */ #define FS_DOSOFTDEP 0x02 /* filesystem using soft dependencies */ #define FS_NEEDSFSCK 0x04 /* filesystem needs sync fsck before mount */
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c2
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c10
-rw-r--r--sys/ufs/ffs/fs.h15
3 files changed, 19 insertions, 8 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index f128d04..35e0d1b 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -339,7 +339,7 @@ restart:
goto out1;
copy_fs = (struct fs *)(nbp->b_data + blkoff(fs, SBOFF));
bcopy(fs, copy_fs, fs->fs_sbsize);
- if ((fs->fs_flags & FS_UNCLEAN) == 0)
+ if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0)
copy_fs->fs_clean = 1;
if (fs->fs_sbsize < SBSIZE)
bzero(&nbp->b_data[blkoff(fs, SBOFF) + fs->fs_sbsize],
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 17fa431..80bed87 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -193,7 +193,7 @@ ffs_mount(mp, path, data, ndp, p)
return (error);
}
fs->fs_ronly = 1;
- if ((fs->fs_flags & FS_UNCLEAN) == 0)
+ if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0)
fs->fs_clean = 1;
if ((error = ffs_sbupdate(ump, MNT_WAIT)) != 0) {
fs->fs_ronly = 0;
@@ -224,7 +224,8 @@ ffs_mount(mp, path, data, ndp, p)
if (fs->fs_clean == 0) {
fs->fs_flags |= FS_UNCLEAN;
if ((mp->mnt_flag & MNT_FORCE) ||
- (fs->fs_flags & FS_DOSOFTDEP)) {
+ ((fs->fs_flags & FS_NEEDSFSCK) == 0 &&
+ (fs->fs_flags & FS_DOSOFTDEP))) {
printf("WARNING: %s was not %s\n",
fs->fs_fsmnt, "properly dismounted");
} else {
@@ -586,7 +587,8 @@ ffs_mountfs(devvp, mp, p, malloctype)
if (fs->fs_clean == 0) {
fs->fs_flags |= FS_UNCLEAN;
if (ronly || (mp->mnt_flag & MNT_FORCE) ||
- (fs->fs_flags & FS_DOSOFTDEP)) {
+ ((fs->fs_flags & FS_NEEDSFSCK) == 0 &&
+ (fs->fs_flags & FS_DOSOFTDEP))) {
printf(
"WARNING: %s was not properly dismounted\n",
fs->fs_fsmnt);
@@ -805,7 +807,7 @@ ffs_unmount(mp, mntflags, p)
}
fs = ump->um_fs;
if (fs->fs_ronly == 0) {
- fs->fs_clean = fs->fs_flags & FS_UNCLEAN ? 0 : 1;
+ fs->fs_clean = fs->fs_flags & (FS_UNCLEAN|FS_NEEDSFSCK) ? 0 : 1;
error = ffs_sbupdate(ump, MNT_WAIT);
if (error) {
fs->fs_clean = 0;
diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h
index c11a9f8..b9cab9a 100644
--- a/sys/ufs/ffs/fs.h
+++ b/sys/ufs/ffs/fs.h
@@ -328,9 +328,18 @@ struct fs {
/*
* Filesystem flags.
- */
-#define FS_UNCLEAN 0x01 /* filesystem not clean at mount */
-#define FS_DOSOFTDEP 0x02 /* filesystem using soft dependencies */
+ *
+ * Note that the FS_NEEDSFSCK flag is set and cleared only by the
+ * fsck utility. It is set when background fsck finds an unexpected
+ * inconsistency which requires a traditional foreground fsck to be
+ * run. Such inconsistencies should only be found after an uncorrectable
+ * disk error. A foreground fsck will clear the FS_NEEDSFSCK flag when
+ * it has successfully cleaned up the filesystem. The kernel uses this
+ * flag to enforce that inconsistent filesystems be mounted read-only.
+ */
+#define FS_UNCLEAN 0x01 /* filesystem not clean at mount */
+#define FS_DOSOFTDEP 0x02 /* filesystem using soft dependencies */
+#define FS_NEEDSFSCK 0x04 /* filesystem needs sync fsck before mount */
/*
* Rotational layout table format types
OpenPOWER on IntegriCloud