From 14b283ae565930144ef5ace12483d602cc3e7539 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 28 Sep 2011 22:45:12 -0400 Subject: [PATCH] mke2fs: set s_max_mnt_count to -1 by default 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" --- misc/mke2fs.c | 6 ++++-- misc/util.c | 6 +++++- misc/util.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 3dcb3b7..c439e37 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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 diff --git a/misc/util.c b/misc/util.c index 05334a6..6c93e1c 100644 --- a/misc/util.c +++ b/misc/util.c @@ -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. " diff --git a/misc/util.h b/misc/util.h index 56a7765..f872c38 100644 --- a/misc/util.h +++ b/misc/util.h @@ -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); -- 1.8.3.1