Bug 141050

Summary: fstab(5): Problem with userquota, groupquota parameters in /etc/fstab
Product: Base System Reporter: Piotr Matuszczyk <piotr.matuszczyk>
Component: kernAssignee: Andriy Gapon <avg>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 8.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
vfs_mount.diff none

Description Piotr Matuszczyk 2009-12-01 10:40:00 UTC
I`m installed FreeBSD 8.0-RELEASE on my Dell PE860 machine. I got source of system from cvs -> cvsup4.freebsd.org.
After compiled world and kernel, and installed world, kernel I put to /etc/fstab this line:

/dev/da0s1a / ufs rw,groupquota,userquota,noatime 1 1

I reboot the system and after kernel started I got this error:

---cut here---
Trying to mount root from ufs:/dev/da0s1a
mount option <groupquota> is unknown
mount option <userquota> is unknown
ROOT MOUNT ERROR: mount option <userquota> is unknown
If you have invalid mount options, reboot, and first try the following from the loader prompt:

      set vfs.root.mountfrom.options=rw
---cut here--

Of course "set vfs.root.mountfrom.options=rw" lets the system correctly starts, but I want userquota, groupquota in options for mount the root partitions.

How-To-Repeat: 1) Clean install FreeBSD 8.0-RELEASE from CD/DVD or from cvs.
2) Put 'userquota,groupquota' options to line of root partition in /etc/fstab file
3) Reboot the system
Comment 1 Piotr Matuszczyk 2009-12-01 11:38:08 UTC
I forgot to add that of course I have:

'options         QUOTA'

in my kernel.

---
Piotr Matuszczyk <piotr.matuszczyk@expro.pl>
IT Administrator

Expro sp. z o.o.
ul. Kolista 25
40-486 Katowice
-=-=-=-=-=-=-=-=-
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2009-12-01 17:26:06 UTC
Responsible Changed
From-To: freebsd-amd64->freebsd-bugs

Reclassify.
Comment 3 Mateusz Guzik 2009-12-02 21:33:32 UTC
Quotas are managed by quotaon/quotaoff (8), so mount(8) ignores quota-related
options. Given that I believe it's safe to just omit those while mounting /.
(Quotas will be enabled later by quotaon just like for non-root filesystems.)

This patch should fix your issue:
http://student.agh.edu.pl/~mjguzik/vfs_mount.diff

--
Mateusz Guzik
Comment 4 Piotr Matuszczyk 2009-12-09 14:07:31 UTC
I understand what You are talking about.

But, Your patch causes mount to ignore during system boot options 'userquota' and 'groupquota'.
I think, it's a bit senselessly to modify the system with your patch, I can do the same simply by putting in '/etc/fstab' options 'rw,noatime'. 

Secondly in the man for 'fstab' these two options are clearly described how to use them in the context of the 'fstab' file and what they indicate. If these two options in Freebsd 8.0 were supposed to be withdrawn, I beleive that there would be any information about it. 

So if there is no information about it, and the options are still in man in FreeBSD 8.0, putting this options in 'fstab' file should behave the same as in older versions of Freebsd system.

For this reason I am daring to claim, that it is a bug in the FreeBSD 8.0.

---
Piotr Matuszczyk <piotr.matuszczyk@expro.pl>
IT Administrator
-=-=-=-=-=-=-=-=-
Comment 5 Svyatoslav Lempert 2010-04-01 01:18:41 UTC
Hello!

This patch really fix problem with enable quotas on the root (/)
mountpoint, we use this patch for our servers (i386 and amd64
systems).
Please check and if possible assign this.

Thanks in advance for your attention,

I have re-attached patch file from Piotr Matuszczyk
<piotr.matuszczyk@expro.pl> to PR-report, if it possible, I think,
category must be
changed to:
Category: kern
Class: change-request

-- 
Svyatoslav
Comment 6 Mr. Zsolt 2010-04-01 15:40:55 UTC
Hello,

I had the same error in the same environtment. The patch that was sent by 
Mateusz Guzik and Svyatoslav Lempert is the same. Anyway, Piotr Matuszczyk 
has right, this patch only ignores "userquota" and "groupquota" settings in 
/etc/fstab. I made a try with this patch and it works for me on 8.0-p2 but 
this can't be the final solution for the problem.
The situation is if you have "userquota" and/or "groupquota" options in your 
/etc/fstab and you reboot your Freebsd, the error messages will appears but 
you can continue the booting process (eg. typeing ufs:/dev/ad0s1a). After 
the succesfully boot, your quotas will works fine on the root filesystem 
too, you only need to have a kernel with "options QUOTA" and 
quota_enable="YES" line in your /etc/rc.conf. This is enough for it, 
whatever is in fstab's man page. I don't understand clearly why we need to 
put "userquota" and/or "groupquota" options in /etc/fstab but the quota 
system will works fine without that settings.

However, the "userquota" and/or "groupquota" options works fine without any 
patch or fix on non-root filesystems.

Best regards: Zemancsik Zsolt
Systems Engineer
Comment 7 Andriy Gapon freebsd_committer freebsd_triage 2010-04-29 10:37:58 UTC
Responsible Changed
From-To: freebsd-bugs->avg

I'd like to handle this issue.
Comment 8 Andriy Gapon freebsd_committer freebsd_triage 2010-04-29 10:50:57 UTC
This is not a configuration problem but rather a loader/kernel problem.
The issue was introduced in r193192.
loader now builds vfs.root.mountfrom and vfs.root.mountfrom.options kenv
variables based on fstab contents, vfs.root.mountfrom.options is then passed as
mount options by kernel.
But userquota, groupquota options are meant only for userland and are not
expected by UFS/FFS kernel code.
So, either loader should be made aware of these options and should not include
them in vfs.root.mountfrom.options, or UFS/FFS kernel code should know anout
these options and should simply ignore them.
The latter approach is what patches in this PR implement.  I think that this
approach is indeed simpler and, perhaps, nicer than putting too much knowledge
into loader.

Thank you for the patches, I will try to get them committed.

-- 
Andriy Gapon
Comment 9 Andriy Gapon freebsd_committer freebsd_triage 2010-04-29 11:12:41 UTC
http://www.freebsd.org/cgi/query-pr.cgi?pr=141050

I'd like to fix the issue with the following patch.
Could you please review and/or test it?
Thanks!

Index: sys/ufs/ffs/ffs_vfsops.c
===================================================================
--- sys/ufs/ffs/ffs_vfsops.c	(revision 207366)
+++ sys/ufs/ffs/ffs_vfsops.c	(working copy)
@@ -124,10 +124,16 @@
 #endif
 };

+/*
+ * Note that userquota and groupquota options are not currently used
+ * by UFS/FFS code and generally mount(8) does not pass those options
+ * from userland, but they can be passed by loader(8) via
+ * vfs.root.mountfrom.options.
+ */
 static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr",
-    "noclusterw", "noexec", "export", "force", "from", "multilabel",
-    "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow", "sync",
-    "union", NULL };
+    "noclusterw", "noexec", "export", "force", "from", "groupquota",
+    "multilabel", "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow",
+    "sync", "union", "userquota", NULL };

 static int
 ffs_mount(struct mount *mp)

-- 
Andriy Gapon
Comment 10 dfilter service freebsd_committer freebsd_triage 2010-05-19 10:32:20 UTC
Author: avg
Date: Wed May 19 09:32:11 2010
New Revision: 208293
URL: http://svn.freebsd.org/changeset/base/208293

Log:
  ffs_mount: accept and drop userland-only options that can be passed from
  loader(8)
  
  In r193192 loader(8) has grown an ability to pass root mount options
  from fstab via vfs.root.mountfrom.options.  Unfortunately, some options
  that can be present in fstab are for userland only and lead to root
  mounting failure when seen by kernel.
  Rather than teaching loader about FFS-specific options that should be
  filtered out, ffs_mount recognizes those options as valid, but ignores
  and deletes[1] them.
  
  [1] is suggested by jh.
  
  PR:		kern/141050
  Reported by:	many
  Reviewed by:	jh, bde
  MFC after:	4 days

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Wed May 19 09:30:41 2010	(r208292)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Wed May 19 09:32:11 2010	(r208293)
@@ -124,10 +124,16 @@ static struct buf_ops ffs_ops = {
 #endif
 };
 
+/*
+ * Note that userquota and groupquota options are not currently used
+ * by UFS/FFS code and generally mount(8) does not pass those options
+ * from userland, but they can be passed by loader(8) via
+ * vfs.root.mountfrom.options.
+ */
 static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr",
-    "noclusterw", "noexec", "export", "force", "from", "multilabel", 
-    "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow", "sync",
-    "union", NULL };
+    "noclusterw", "noexec", "export", "force", "from", "groupquota",
+    "multilabel", "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow",
+    "sync", "union", "userquota", NULL };
 
 static int
 ffs_mount(struct mount *mp)
@@ -157,6 +163,9 @@ ffs_mount(struct mount *mp)
 		    UMA_ALIGN_PTR, 0);
 	}
 
+	vfs_deleteopt(mp->mnt_optnew, "groupquota");
+	vfs_deleteopt(mp->mnt_optnew, "userquota");
+
 	fspec = vfs_getopts(mp->mnt_optnew, "from", &error);
 	if (error)
 		return (error);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 11 Andriy Gapon freebsd_committer freebsd_triage 2010-05-19 11:47:52 UTC
State Changed
From-To: open->patched

A fix is committed to head.
Comment 12 dfilter service freebsd_committer freebsd_triage 2010-05-23 08:22:00 UTC
Author: avg
Date: Sun May 23 07:21:50 2010
New Revision: 208435
URL: http://svn.freebsd.org/changeset/base/208435

Log:
  MFC r208293: ffs_mount: accept and drop userland-only options that can
  be passed from loader(8)
  
  PR:		kern/141050

Modified:
  stable/8/sys/ufs/ffs/ffs_vfsops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/geom/sched/   (props changed)

Modified: stable/8/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/8/sys/ufs/ffs/ffs_vfsops.c	Sun May 23 07:04:21 2010	(r208434)
+++ stable/8/sys/ufs/ffs/ffs_vfsops.c	Sun May 23 07:21:50 2010	(r208435)
@@ -125,10 +125,16 @@ static struct buf_ops ffs_ops = {
 #endif
 };
 
+/*
+ * Note that userquota and groupquota options are not currently used
+ * by UFS/FFS code and generally mount(8) does not pass those options
+ * from userland, but they can be passed by loader(8) via
+ * vfs.root.mountfrom.options.
+ */
 static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr",
-    "noclusterw", "noexec", "export", "force", "from", "multilabel", 
-    "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow", "sync",
-    "union", NULL };
+    "noclusterw", "noexec", "export", "force", "from", "groupquota",
+    "multilabel", "nfsv4acls", "snapshot", "nosuid", "suiddir", "nosymfollow",
+    "sync", "union", "userquota", NULL };
 
 static int
 ffs_mount(struct mount *mp)
@@ -158,6 +164,9 @@ ffs_mount(struct mount *mp)
 		    UMA_ALIGN_PTR, 0);
 	}
 
+	vfs_deleteopt(mp->mnt_optnew, "groupquota");
+	vfs_deleteopt(mp->mnt_optnew, "userquota");
+
 	fspec = vfs_getopts(mp->mnt_optnew, "from", &error);
 	if (error)
 		return (error);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 13 Andriy Gapon freebsd_committer freebsd_triage 2010-05-23 08:30:18 UTC
State Changed
From-To: patched->closed

The problem should now be resolved in head and stable/8. 
It is not present in other branches.