Fix handling of D_GIANTOK

It was meant to suppress only the printf(), not the subsequent injection
of Giant-protected thunks for various file operations.

Fixes:		fbeb4ccac9
Reported by:	pho
Tested by:	pho
MFC after:	6 days
Pointy hat:	markj
This commit is contained in:
Mark Johnston 2021-06-07 14:25:26 -04:00
parent 05c2d94a08
commit 887c753c9f

View File

@ -665,10 +665,13 @@ prep_cdevsw(struct cdevsw *devsw, int flags)
devsw->d_kqfilter = dead_kqfilter;
}
if ((devsw->d_flags & (D_NEEDGIANT | D_GIANTOK)) == D_NEEDGIANT) {
printf("WARNING: Device \"%s\" is Giant locked and may be "
"deleted before FreeBSD 14.0.\n",
devsw->d_name == NULL ? "???" : devsw->d_name);
if ((devsw->d_flags & D_NEEDGIANT) != 0) {
if ((devsw->d_flags & D_GIANTOK) == 0) {
printf(
"WARNING: Device \"%s\" is Giant locked and may be "
"deleted before FreeBSD 14.0.\n",
devsw->d_name == NULL ? "???" : devsw->d_name);
}
if (devsw->d_gianttrick == NULL) {
memcpy(dsw2, devsw, sizeof *dsw2);
devsw->d_gianttrick = dsw2;