看板 DFBSD_bugs 關於我們 聯絡資訊
On Thu, Nov 19, 2009 at 08:40:46AM +0000, Stathis Kamperis (via DragonFly issue tracker) wrote: > > Stathis Kamperis <ekamperi@gmail.com> added the comment: > > Ping! > > Anyone interested with time and clue to review the patch ? > I'd like to push it at some point, before it gets too stale, but ain't gonna > happen if at least someone else gives me a thumbs up. I noticed that I can't remount nullfs by mount(8). The patched mount_null accepts only one argument (the mountpoint to be remounted) when MNT_UPDATE is specified either by -u or by -o update, but what mount(8) passes to filesystem-specific mount commands like this: # mount -ur /mnt/pt -> mount_${foo} -o ro -o update /path/to/special /mnt/pt # mount -uw /mnt/pt -> mount_${foo} -o noro -o update /path/to/special /mnt/pt I think that the following patch on top of yours does this for you, although I only tested it slightly. diff --git a/sbin/mount_null/mount_null.c b/sbin/mount_null/mount_null.c index b9c595a..9e02b6d 100644 --- a/sbin/mount_null/mount_null.c +++ b/sbin/mount_null/mount_null.c @@ -88,29 +88,20 @@ main(int argc, char **argv) argv += optind; /* - * Only the mount point need be specified in update mode. + * Resolve target and source with realpath(3). Only the mount point + * needs be specified in update mode, but mount(8) passes us two + * arguments, the second of which is the source directory. */ - if (mntflags & MNT_UPDATE) { - if (argc != 1) { - usage(); - /* not reached */ - } + if ((mntflags & MNT_UPDATE) && argc == 1) { + args.target = NULL; checkpath(argv[0], source); - error = getvfsbyname("null", &vfc); - if (error) - err(1, "getvfsbyname"); - if (mount(vfc.vfc_name, source, mntflags, &args)) - err(1, "mount"); - exit(0); - } - - if (argc < 2) + } else if (argc == 2) { + args.target = target; + checkpath(argv[0], target); + checkpath(argv[1], source); + } else usage(); - /* resolve target and source with realpath(3) */ - checkpath(argv[0], target); - checkpath(argv[1], source); - /* * Mount points that did not use distinct paths (e.g. / on /mnt) * used to be disallowed because mount linkages were stored in @@ -118,7 +109,6 @@ main(int argc, char **argv) * stores mount linkages in the namecache topology and does not * have this problem, so paths no longer need to be distinct. */ - args.target = target; error = getvfsbyname("null", &vfc); if (error && vfsisloadable("null")) {