Subject: Re: More fsck problems?
To: Dave Huang <khym@bga.com>
From: enami tsugutomo <enami@cv.sony.co.jp>
List: current-users
Date: 09/24/1997 17:35:28
Dave Huang <khym@bga.com> writes:

> On Wed, 24 Sep 1997, Jason Thorpe wrote:
> > Looks like fsck_ffs isn't setting the "clean" bit, so the kernel complains
> > the next time.  Gack.
> 
> Ah, but the clean bit _is_ being set for /usr, just not for /.

I just read the diff -D '2 weeks ago' very roughly.  And found that
the following code is added to fsck_ffs/main.c.  Since the argument of
ckfini() is `markclean', it can read as `if / is mounted as read-only,
then markclean', can't it?  If so, it's strange.

enami.

@@ -309,7 +296,19 @@
                        bwrite(fswritefd, (char *)&sblock,
                            fsbtodb(&sblock, cgsblock(&sblock, cylno)), SBSIZE);
        }
-       ckfini(1);
+       if (!hotroot()) {
+               ckfini(1);
+       } else {
+               struct statfs stfs_buf;
+               /*
+                * Check to see if root is mounted read-write.
+                */
+               if (statfs("/", &stfs_buf) == 0)
+                       flags = stfs_buf.f_flags;
+               else
+                       flags = 0;
+               ckfini(flags & MNT_RDONLY);
+       }
        free(blockmap);
        free(statemap);
        free((char *)lncntp);