-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andriy Gapon wrote:
> It is quite possible that I messed my local src repo, but this is what I see 
> in
> stable/7 r191214. fsck(8) describes -C option, fsck mentions this option in 
> its
> usage message, but:
> 
> $ fsck -C
> fsck_ufs: illegal option -- C
> usage: fsck_ufs [-BCFpfny] [-b block] [-c level] [-m mode] filesystem ...
> 
> Am I he only one to see this?

I think this is a bug (caused by revision 190357).  Part of that commit
reverts a previous changeset (see attachment).

Cheers,
- --
Xin LI <delp...@delphij.net>    http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)

iEYEARECAAYFAkn189wACgkQi+vbBBjt66DFfgCePFgPWcWqzjbdU0JvulvX5tFR
d2YAn0FOHlhMbJYG8ow1dS0E48N5S0FE
=v0n/
-----END PGP SIGNATURE-----
Index: sbin/fsck_ffs/setup.c
===================================================================
--- sbin/fsck_ffs/setup.c       (revision 191561)
+++ sbin/fsck_ffs/setup.c       (working copy)
@@ -65,7 +65,7 @@
 /*
  * Read in a superblock finding an alternate if necessary.
  * Return 1 if successful, 0 if unsuccessful, -1 if file system
- * is already clean (preen mode only).
+ * is already clean (ckclean and preen mode only).
  */
 int
 setup(char *dev)
@@ -201,7 +201,7 @@
                pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag);
                bflag = 0;
        }
-       if (skipclean && preen && sblock.fs_clean) {
+       if (skipclean && ckclean && sblock.fs_clean) {
                pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
                return (-1);
        }
Index: sbin/fsck_ffs/fsck_ffs.8
===================================================================
--- sbin/fsck_ffs/fsck_ffs.8    (revision 191561)
+++ sbin/fsck_ffs/fsck_ffs.8    (working copy)
@@ -29,7 +29,7 @@
 .\"    @(#)fsck.8      8.4 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd January 20, 2009
+.Dd January 25, 2009
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -46,9 +46,9 @@
 .Ar ...
 .Sh DESCRIPTION
 The specified disk partitions and/or file systems are checked.
-In "preen" mode the clean flag of each file system's superblock is examined
-and only those file systems that
-are not marked clean are checked.
+In "preen" or "check clean" mode the clean flag of each file system's
+superblock is examined and only those file systems that are not marked clean
+are checked.
 File systems are marked clean when they are unmounted,
 when they have been mounted read-only, or when
 .Nm
@@ -175,6 +175,14 @@
 the super block for the file system.
 An alternate super block is usually located at block 32 for UFS1,
 and block 160 for UFS2.
+.It Fl C
+Check if file system was dismouted cleanly.
+If so, skip file system checks (like "preen").
+However, if the file system was not cleanly dismounted, do full checks,
+is if
+.Nm
+was invoked without
+.Fl C .
 .It Fl c
 Convert the file system to the specified level.
 Note that the level of a file system can only be raised.
Index: sbin/fsck_ffs/main.c
===================================================================
--- sbin/fsck_ffs/main.c        (revision 191561)
+++ sbin/fsck_ffs/main.c        (working copy)
@@ -82,7 +82,7 @@
        sync();
        skipclean = 1;
        damagedflag = 0;
-       while ((ch = getopt(argc, argv, "b:Bc:dDfFm:npy")) != -1) {
+       while ((ch = getopt(argc, argv, "b:Bc:CdDfFm:npy")) != -1) {
                switch (ch) {
                case 'b':
                        skipclean = 0;
@@ -132,6 +132,10 @@
 
                case 'p':
                        preen++;
+                       /*FALLTHROUGH*/
+
+               case 'C':
+                       ckclean++;
                        break;
 
                case 'y':
@@ -151,7 +155,7 @@
 
        if (signal(SIGINT, SIG_IGN) != SIG_IGN)
                (void)signal(SIGINT, catch);
-       if (preen)
+       if (ckclean)
                (void)signal(SIGQUIT, catchquit);
        signal(SIGINFO, infohandler);
        if (bkgrdflag) {
@@ -216,7 +220,7 @@
        errmsg[0] = '\0';
 
        cdevname = filesys;
-       if (debug && preen)
+       if (debug && ckclean)
                pwarn("starting\n");
        /*
         * Make best effort to get the disk name. Check first to see
@@ -251,7 +255,7 @@
                        exit(7);        /* Filesystem clean, report it now */
                exit(0);
        }
-       if (preen && skipclean) {
+       if (ckclean && skipclean) {
                /*
                 * If file system is gjournaled, check it here.
                 */
@@ -302,7 +306,7 @@
                                            "CANNOT RUN IN BACKGROUND\n");
                                }
                                if ((sblock.fs_flags & FS_UNCLEAN) == 0 &&
-                                   skipclean && preen) {
+                                   skipclean && ckclean) {
                                        /*
                                         * file system is clean;
                                         * skip snapshot and report it clean
Index: sbin/fsck_ffs/fsck.h
===================================================================
--- sbin/fsck_ffs/fsck.h        (revision 191561)
+++ sbin/fsck_ffs/fsck.h        (working copy)
@@ -271,6 +271,7 @@
 int    bflag;                  /* location of alternate super block */
 int    debug;                  /* output debugging info */
 char   damagedflag;            /* run in damaged mode */
+char   ckclean;                /* only do work if not cleanly unmounted */
 int    cvtlevel;               /* convert to newer file system format */
 int    bkgrdcheck;             /* determine if background check is possible */
 int    bkgrdsumadj;            /* whether the kernel have ability to adjust 
superblock summary */
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"

Reply via email to