Date: Tue, 23 Jun 1998 11:30:03 -0400 (EDT) From: Luoqi Chen <luoqi@watermarkgroup.com> To: current@FreeBSD.ORG, rock@cs.uni-sb.de Subject: Re: softupdates and / Message-ID: <199806231530.LAA00998@lor.watermarkgroup.com>
next in thread | raw e-mail | index | archive | help
> Hi,
>
> I had some (hardware related) crashes lately and noticed that
> softupdates arenīt enabled if the filesystem was unclean. So after a
> crash I had to boot twice to re-enable softupdates on / again (no need
> to run tunefs though).
> Is this because soft updates are no mount option and so cannot be
> enabled later and soft updates arenīt enabled on an unclean fs for
> safety reasons?
> Or is this just a bug?
>
> Daniel
>
I believe this is a bug. After fsck fixes inconsistencies on the disk,
it will remount / with MNT_RELOAD flag to update the in-core superblock
image. For some reason, fsck might change fs_ronly flag in superblock
(to be more precise, it will change fs_ronly iff it has fixed the free
block count -- could any more knowledgeable person tell me why it is
doing that?!), and because of that, all the code to be called during
ro->rw update is bypassed, including enabling of softupdate.
You may try the following patch, (it also fixes the problem that an
unsuccessful mount update could change the in-core superblock), but
I think we should fix fsck not to modify the fs_ronly flag.
-lq
Index: ffs_vfsops.c
===================================================================
RCS file: /fun/cvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.83
diff -u -r1.83 ffs_vfsops.c
--- ffs_vfsops.c 1998/06/04 17:21:39 1.83
+++ ffs_vfsops.c 1998/06/23 15:10:22
@@ -148,6 +148,7 @@
register struct fs *fs;
int error, flags;
mode_t accessmode;
+ int ronly = 0;
/*
* Use NULL path to flag a root mount
@@ -207,6 +208,7 @@
fs = ump->um_fs;
devvp = ump->um_devvp;
err = 0;
+ ronly = fs->fs_ronly; /* MNT_RELOAD might change this */
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERW)
@@ -226,7 +228,7 @@
if (err) {
goto error_1;
}
- if (fs->fs_ronly && (mp->mnt_kern_flag & MNTK_WANTRDWR)) {
+ if (ronly && (mp->mnt_kern_flag & MNTK_WANTRDWR)) {
if (!fs->fs_clean) {
if (mp->mnt_flag & MNT_FORCE) {
printf("WARNING: %s was not properly dismounted.\n",fs->fs_fsmnt);
@@ -259,7 +261,7 @@
goto error_1;
}
- fs->fs_ronly = 0;
+ ronly = 0;
}
/*
* Soft updates is incompatible with "async",
@@ -271,10 +273,6 @@
if (mp->mnt_flag & MNT_SOFTDEP) {
mp->mnt_flag &= ~MNT_ASYNC;
}
- if (fs->fs_ronly == 0) {
- fs->fs_clean = 0;
- ffs_sbupdate(ump, MNT_WAIT);
- }
/* if not updating name...*/
if (args.fspec == 0) {
/*
@@ -410,7 +408,16 @@
error_1: /* no state to back out*/
success:
- return( err);
+ if (!err && path && (mp->mnt_flag & MNT_UPDATE)) {
+ /* update superblock after ro -> rw update */
+ fs = ump->um_fs;
+ if (!ronly && fs->fs_ronly) {
+ fs->fs_ronly = 0;
+ fs->fs_clean = 0;
+ ffs_sbupdate(ump, MNT_WAIT);
+ }
+ }
+ return (err);
}
/*
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806231530.LAA00998>
