Whamcloud - gitweb
mke2fs: set s_max_mnt_count to -1 by default
authorTheodore Ts'o <tytso@mit.edu>
Thu, 29 Sep 2011 02:45:12 +0000 (22:45 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 29 Sep 2011 03:20:56 +0000 (23:20 -0400)
If the enable_periodic_fsck option is false in /etc/mke2fs.conf (which
is also the default), s_max_mnt_count needs to be set to -1, instead
of 0.  Kernels newer than 3.0 will interpret 0 to disable periodic
checks, but older kernels will print a warning message on each mount,
which will annoy users.

Addresses-Debian-Bug: #632637

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/mke2fs.c
misc/util.c
misc/util.h

index 3dcb3b7..c439e37 100644 (file)
@@ -2196,7 +2196,8 @@ int main (int argc, char *argv[])
        ext2_filsys     fs;
        badblocks_list  bb_list = 0;
        unsigned int    journal_blocks;
-       unsigned int    i, max_mnt_count, checkinterval;
+       unsigned int    i, checkinterval;
+       int             max_mnt_count;
        int             val, hash_alg;
        int             flags;
        int             old_bitmaps;
@@ -2329,7 +2330,8 @@ int main (int argc, char *argv[])
                for (i = 0, val = 0 ; i < sizeof(fs->super->s_uuid); i++)
                        val += fs->super->s_uuid[i];
                fs->super->s_max_mnt_count += val % EXT2_DFL_MAX_MNT_COUNT;
-       }
+       } else
+               fs->super->s_max_mnt_count = -1;
 
        /*
         * Override the creator OS, if applicable
index 05334a6..6c93e1c 100644 (file)
@@ -278,8 +278,12 @@ unsigned int figure_journal_size(int size, ext2_filsys fs)
        return j_blocks;
 }
 
-void print_check_message(unsigned int mnt, unsigned int check)
+void print_check_message(int mnt, unsigned int check)
 {
+       if (mnt < 0)
+               mnt = 0;
+       if (!mnt && !check)
+               return;
        printf(_("This filesystem will be automatically "
                 "checked every %d mounts or\n"
                 "%g days, whichever comes first.  "
index 56a7765..f872c38 100644 (file)
@@ -23,5 +23,5 @@ extern void check_plausibility(const char *device);
 extern void parse_journal_opts(const char *opts);
 extern void check_mount(const char *device, int force, const char *type);
 extern unsigned int figure_journal_size(int size, ext2_filsys fs);
-extern void print_check_message(unsigned int, unsigned int);
+extern void print_check_message(int, unsigned int);
 extern void dump_mmp_msg(struct mmp_struct *mmp, const char *msg);