Date: Mon, 13 Dec 2021 16:26:42 +0000 From: Rick Macklem <rmacklem@uoguelph.ca> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: RFC: What to do about Allocate in the NFS server for FreeBSD13? Message-ID: <YQXPR0101MB0968EEFD5AE3B86F1D2DF667DD749@YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM>
next in thread | raw e-mail | index | archive | help
Hi,=0A= =0A= There are two problems with Allocate in the NFSv4.2 server in FreeBSD13:=0A= 1 - It uses the thread credentials instead of the ones for the RPC.=0A= 2 - It does not ensure that file changes are committed to stable storage.= =0A= These problems are fixed by commit f0c9847a6c47 in main, which added=0A= ioflag and cred arguments to VOP_ALLOCATE().=0A= =0A= I can think of 3 ways to fix Allocate in FreeBSD13:=0A= 1 - Apply a *hackish* patch like this:=0A= + savcred =3D p->td_ucred;=0A= + td->td_ucred =3D cred;=0A= do {=0A= olen =3D len;=0A= error =3D VOP_ALLOCATE(vp, &off, &len);=0A= if (error =3D=3D 0 && len > 0 && olen > len)=0A= maybe_yield();=0A= } while (error =3D=3D 0 && len > 0 && olen > len);=0A= + p->td_ucred =3D savcred;=0A= if (error =3D=3D 0 && len > 0)=0A= error =3D NFSERR_IO;=0A= + if (error =3D=3D 0)=0A= + error =3D VOP_FSYNC(vp, MNT_WAIT, p);=0A= The worst part of it is temporarily setting td_ucred to cred.=0A= =0A= 2 - MFC'ng commit f0c9847a6c47. Normally changes to the=0A= VOP/VFS are not MFC'd. However, in this case, it might be=0A= ok to do so, since it is unlikely there is an out of source tree=0A= file system with a custom VOP_ALLOCATE() method?=0A= =0A= 3 - Just disable it. Currently it is disabled by default and it=0A= could just be wired down disabled.=0A= Allocate is not that useful, since ZFS does not support it.=0A= =0A= As an aside to this, the IETF NFSv4 working group seems to=0A= have agreed that NFS4ERR_NOTSUPP can be returned by a=0A= NFSv4.2 server on a 'per file system basis" instead of globally,=0A= since the Linux knfsd already does this.=0A= --> As such, Allocate can be enabled by default in main and=0A= could be enabled by default in FreeBSD13, if #1 or #2 was=0A= done.=0A= --> It still would not work for ZFS exports.=0A= =0A= So, what do you think is the preferred alternative?=0A= =0A= rick=0A=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YQXPR0101MB0968EEFD5AE3B86F1D2DF667DD749>