Bug 770172

Summary: mount manpage from F16 util-linux describes somewhat weird option (which does not even work)
Product: [Fedora] Fedora Reporter: Michal Jaegermann <michal>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: esandeen, gansalmon, itamar, jonathan, kernel-maint, kzak, madhu.chinakonda
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-3.1.9-1.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-01-15 20:11:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Jaegermann 2011-12-23 21:46:19 UTC
Description of problem:

In a section "Mount options for ext2" one can find, among other things, this:

       check={none|nocheck}
              No  checking is done at mount time. This is the default. This is
              fast.  It is wise to invoke e2fsck(8) every now and  then,  e.g.
              at boot time.

OK, so if this is a default that how one can invoke a non-default behaviour? In other words: what is a supposed use for the above?

Moreover when I tried to add '-o check=nocheck' when attempting to mount ext2 file system, with and without explicitely specifying a system type, then I got:

mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Log says 'Unrecognized mount option "check=nocheck" or missing value'.

With this "option" omitted /dev/sdb1 mounts, as ext2, without throwing any tantrums.

Version-Release number of selected component (if applicable):
util-linux-2.20.1-2.1.fc16

Additional info:
I bumped into that because in the past mount, at least for various ext? file systems, accepted '-o nocheck,...'.  This does not work anymore and breaks some existing scripts after F14->F16 changeover.  Oh, well....

Comment 1 Karel Zak 2012-01-10 12:54:19 UTC
The info in the man page is incorrect. The correct is "check=none" *or* "nocheck" according to the kernel docs. 
 
Anyway, the option does not make sense. It's default behaviour and non-default behaviour is unsupported. I'll update the man page. Thanks for your report.

> I bumped into that because in the past mount, at least for various ext? file
> systems, accepted '-o nocheck,...'.  This does not work anymore and breaks some
> existing scripts after F14->F16 changeover.  Oh, well....

The Fedora kernel uses ext4 driver to mount ext2 and ext3 filesystems. Unfortunately, it seems that this solution is not 100% backwardly compatible with the original ext2 and ext3 drivers.... reassigning to kernel guys.

Comment 2 Karel Zak 2012-01-10 13:04:22 UTC
Note, the mount.8 man pages fixed by util-linux upstream commit c6238085a12baa45d7270e73a181c20b81586bee.

Comment 3 Josh Boyer 2012-01-10 14:42:27 UTC
(In reply to comment #1)
> The info in the man page is incorrect. The correct is "check=none" *or*
> "nocheck" according to the kernel docs. 
> 
> Anyway, the option does not make sense. It's default behaviour and non-default
> behaviour is unsupported. I'll update the man page. Thanks for your report.

As Karel said, the non-default behavior (check=normal, check=strict) is unsupported.  The check= and nocheck options are basically just silently eaten on ext2/ext3.

> > I bumped into that because in the past mount, at least for various ext? file
> > systems, accepted '-o nocheck,...'.  This does not work anymore and breaks some
> > existing scripts after F14->F16 changeover.  Oh, well....
> 
> The Fedora kernel uses ext4 driver to mount ext2 and ext3 filesystems.
> Unfortunately, it seems that this solution is not 100% backwardly compatible
> with the original ext2 and ext3 drivers.... reassigning to kernel guys.

Eric, does this patch seem reasonable for upstream (ignore bugzilla line wrapping)?

---

From ea75f7357e3a881bd1bd0db5e483fc6a8681567b Mon Sep 17 00:00:00 2001
From: Josh Boyer <jwboyer>
Date: Tue, 10 Jan 2012 09:39:02 -0500
Subject: [PATCH] ext4: Support "check=none" "nocheck" mount options

The ext2/ext3 filesystems supported "check=none" and "nocheck" as mount options
even though that was already the default behavior and it essentially did
nothing.  When using ext4 to mount ext2/ext3 filesystems, that mount option
causes the mount to fail.  That isn't as backward compatible as it could be,
so add support to ext4 to accept the option.

Signed-off-by: Josh Boyer <jwboyer>
---
 fs/ext4/super.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3e1329e..5ff09e7 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1333,7 +1333,7 @@ enum {
 	Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
 	Opt_inode_readahead_blks, Opt_journal_ioprio,
 	Opt_dioread_nolock, Opt_dioread_lock,
-	Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
+	Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable, Opt_nocheck,
 };
 
 static const match_table_t tokens = {
@@ -1409,6 +1409,8 @@ static const match_table_t tokens = {
 	{Opt_init_itable, "init_itable=%u"},
 	{Opt_init_itable, "init_itable"},
 	{Opt_noinit_itable, "noinit_itable"},
+	{Opt_nocheck, "check=none"},
+	{Opt_nocheck, "nocheck"},
 	{Opt_err, NULL},
 };
 
@@ -1905,6 +1907,9 @@ set_qf_format:
 		case Opt_noinit_itable:
 			clear_opt(sb, INIT_INODE_TABLE);
 			break;
+		case Opt_nocheck:
+			/* ext2/ext3 used to "support" this option.  Silently eat it */
+			break;
 		default:
 			ext4_msg(sb, KERN_ERR,
 			       "Unrecognized mount option \"%s\" "
-- 
1.7.7.5

Comment 4 Eric Sandeen 2012-01-10 15:50:02 UTC
Josh, that seems ok.  Looks like _CHECK is a complete do-nothing?  It's only ever "cleared" (having been impossible to set) even in ext2?

Yay, more cruft to carry along!  But that looks like the right plan.

Thanks,
-Eric

Comment 5 Josh Boyer 2012-01-10 17:45:04 UTC
I tested this locally with a loopback filesystem.  Before the patch:

[jwboyer@vader ~]$ sudo mount -o loop ./ext2.img /mnt/
[jwboyer@vader ~]$ ls /mnt/
lost+found
[jwboyer@vader ~]$ sudo umount /mnt
[jwboyer@vader ~]$ sudo mount -o loop,nocheck ./ext2.img /mnt/
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

[jwboyer@vader ~]$ 

After:

[jwboyer@vader ~]$ sudo mount -o loop,nocheck ./ext2.img /mnt
[jwboyer@vader ~]$ ls /mnt
lost+found
[jwboyer@vader ~]$ sudo umount /mnt
[jwboyer@vader ~]$ sudo mount -o loop,check=none ./ext2.img /mnt
[jwboyer@vader ~]$ sudo umount /mnt

Patch sent upstream:

http://patchwork.ozlabs.org/patch/135270/

Comment 6 Josh Boyer 2012-01-10 18:26:32 UTC
I committed the patch to Rawhide and f16.  F15 isn't impacted because we still build the ext2 module there instead of use ext4.

Comment 7 Fedora Update System 2012-01-13 20:58:07 UTC
kernel-3.1.9-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/kernel-3.1.9-1.fc16

Comment 8 Fedora Update System 2012-01-15 20:11:28 UTC
kernel-3.1.9-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.