Date: Sat, 19 Feb 2011 16:32:30 +0200 From: Jaakko Heinonen <jh@FreeBSD.org> To: freebsd-hackers@FreeBSD.org Cc: Craig Rodrigues <rodrigc@crodrigues.org> Subject: Re: [patch] nmount ro, rw and negated option handling Message-ID: <20110219143230.GA1539@a91-153-123-205.elisa-laajakaista.fi> In-Reply-To: <20110125172340.GA1535@a91-153-123-205.elisa-laajakaista.fi> References: <20110114122454.GA4805@jh> <20110119083407.GA51372@crodrigues.org> <20110119151210.GA2182@a91-153-123-205.elisa-laajakaista.fi> <20110125172340.GA1535@a91-153-123-205.elisa-laajakaista.fi>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2011-01-25, Jaakko Heinonen wrote:
> Another related bug is in vfs_domount_update(): if VFS_MOUNT() succeeds
> but vfs_export() fails, old mount flags and options are restored. I
> think this shouldn't happen when VFS_MOUNT() has been already
> successfully completed and this is the final reason why FFS fs_ronly and
> the MNT_RDONLY flag get out of sync. Does the patch below look sane?
>
> %%%
> Index: sys/kern/vfs_mount.c
> ===================================================================
> --- sys/kern/vfs_mount.c (revision 217792)
> +++ sys/kern/vfs_mount.c (working copy)
I have committed an updated version as r218852.
Unless there are objections, I plan to commit something like this next:
Recognize "ro", "rdonly", "norw", "rw" and "noro" as equal options in
vfs_equalopts(). This allows vfs_sanitizeopts() to filter redundant
occurrences of these options. It was possible that for example both "ro"
and "rw" options became active concurrently.
PR: kern/133614
%%%
Index: sys/kern/vfs_mount.c
===================================================================
--- sys/kern/vfs_mount.c (revision 218446)
+++ sys/kern/vfs_mount.c (working copy)
@@ -175,6 +175,27 @@ vfs_deleteopt(struct vfsoptlist *opts, c
}
}
+static int
+vfs_isopt_ro(const char *opt)
+{
+
+ if (strcmp(opt, "ro") == 0 || strcmp(opt, "rdonly") == 0 ||
+ strcmp(opt, "norw") == 0)
+ return (1);
+ else
+ return (0);
+}
+
+static int
+vfs_isopt_rw(const char *opt)
+{
+
+ if (strcmp(opt, "rw") == 0 || strcmp(opt, "noro") == 0)
+ return (1);
+ else
+ return (0);
+}
+
/*
* Check if options are equal (with or without the "no" prefix).
*/
@@ -203,6 +224,11 @@ vfs_equalopts(const char *opt1, const ch
if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0)
return (1);
}
+ /* "ro" / "rdonly" / "norw" / "rw" / "noro" */
+ if ((vfs_isopt_ro(opt1) || vfs_isopt_rw(opt1)) &&
+ (vfs_isopt_ro(opt2) || vfs_isopt_rw(opt2)))
+ return (1);
+
return (0);
}
%%%
--
Jaakko
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110219143230.GA1539>
