Date: Sun, 10 May 2015 09:07:54 -0400 (EDT) From: Rick Macklem <rmacklem@uoguelph.ca> To: Doug Rabson <dfr@rabson.org> Cc: freebsd current <freebsd-current@freebsd.org>, Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= <trasz@freebsd.org>, David Boyd49 <David.Boyd49@twc.com> Subject: Re: nmount, mountd drops high order MNT_xx flags during a mount update Message-ID: <917688730.35175530.1431263274444.JavaMail.root@uoguelph.ca> In-Reply-To: <581797832.35173877.1431263005089.JavaMail.root@uoguelph.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_35175528_844751710.1431263274441 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Oops, I did my usual and forgot to attach the patch. Here it is, rick ----- Original Message ----- > Doug Rabson wrote: > > You could add a single integer-valued vfsopt which holds the > > high-order > > bits of f_flags? > > > I have created a patch that does this. It is on > https://reviews.freebsd.org/D2506 > (I have also attached it here, for those who don't use Phabricator.) > > Please review/comment on this. (Feel free to add yourself as a > reviewer, etc.) > > Also, David, if you can test this patch, it would be appreciated. > > Thanks for the suggestion Doug, rick > > > On 7 May 2015 at 02:10, Rick Macklem <rmacklem@uoguelph.ca> wrote: > > > > > David Boyd reported a problem to freebsd-current@ w.r.t. the > > > MNT_AUTOMOUNTED > > > flag getting cleared by mountd. > > > http://docs.FreeBSD.org/cgi/mid.cgi?1429477202.29812.38.camel > > > I just took a look at this and it's kinda ugly... > > > > > > mountd acquires a list of mounts via getmntinfo() and then does > > > an > > > nmount() for each of them to get rid of any exports. It uses > > > f_flags from the statfs returned by getmntinfo() as the 3rd > > > argument to nmount(). > > > --> Since nmount()s 3rd argument is a "int", it silently drops > > > any > > > MNT_xx flag in the high order 32bits of f_flags. At this > > > time, > > > it happens that MNT_AUTOMOUNTED is the only one, but... > > > > > > I can think of a couple of ways to fix this, but I don't like any > > > of > > > them;-) > > > > > > 1) I suppose mountd could check for each flag set in f_flags and > > > generate > > > a vfsopts string for it, but that means that every time a new > > > flag > > > that > > > can be updated is added to MNT_xx, this mountd.c code would have > > > to > > > updated. > > > --> Ugly!! > > > > > > 2) Require that all flags in MNT_UPDATEMASK be in the low order > > > 32bits. > > > I wouldn`t mind this except in means that the MNT_xx flags > > > must > > > be > > > redefined > > > and I don`t think that could get MFC`d. > > > > > > 3) Add a new newernmount(2) which has a 64bit flags argument > > > instead of > > > int. > > > > > > Hopefully someone can think of a nice way to fix this, rick > > > _______________________________________________ > > > freebsd-current@freebsd.org mailing list > > > http://lists.freebsd.org/mailman/listinfo/freebsd-current > > > To unsubscribe, send any mail to > > > "freebsd-current-unsubscribe@freebsd.org" > > > > > _______________________________________________ > > freebsd-current@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-current > > To unsubscribe, send any mail to > > "freebsd-current-unsubscribe@freebsd.org" > > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to > "freebsd-current-unsubscribe@freebsd.org" > ------=_Part_35175528_844751710.1431263274441 Content-Type: text/x-patch; name=highbits.patch Content-Disposition: attachment; filename=highbits.patch Content-Transfer-Encoding: base64 LS0tIGtlcm4vdmZzX21vdW50LmMuc2F2bW50CTIwMTUtMDUtMDkgMTk6MzA6MTQuMDAwMDAwMDAw IC0wNDAwCisrKyBrZXJuL3Zmc19tb3VudC5jCTIwMTUtMDUtMTAgMDg6MzQ6NDUuMDAwMDAwMDAw IC0wNDAwCkBAIC01MzcsNiArNTM3LDcgQEAgdmZzX2Rvbm1vdW50KHN0cnVjdCB0aHJlYWQgKnRk LCB1aW50NjRfdAogCXN0cnVjdCB2ZnNvcHQgKm9wdCwgKnRtcF9vcHQ7CiAJY2hhciAqZnN0eXBl LCAqZnNwYXRoLCAqZXJybXNnOwogCWludCBlcnJvciwgZnN0eXBlbGVuLCBmc3BhdGhsZW4sIGVy cm1zZ19sZW4sIGVycm1zZ19wb3M7CisJdWludDY0X3QgZnNmbGFnX2hpZ2g7CiAK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528_844751710.1431263274441--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?917688730.35175530.1431263274444.JavaMail.root>