From nobody Sat Dec 18 22:34:40 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3409F19007F6; Sat, 18 Dec 2021 22:34:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JGgdX6lYwz3sWY; Sat, 18 Dec 2021 22:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7830170F8; Sat, 18 Dec 2021 22:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BIMYea2079836; Sat, 18 Dec 2021 22:34:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BIMYeIG079835; Sat, 18 Dec 2021 22:34:40 GMT (envelope-from git) Date: Sat, 18 Dec 2021 22:34:40 GMT Message-Id: <202112182234.1BIMYeIG079835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 18f5b477ee66 - stable/13 - vfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 18f5b477ee66f0e55d6e1badda745b453f9f7bd8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639866881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Xk4svUYBI25NiiCu5H7UWYBjddxKSAKk/5wOjkxQoCY=; b=LH2hizRcriMxdEhK5JNkULGYZ7zPeFKcUvQ6Qs42R1N21Ctnm2rsVfvBaztIskwVW/x76q QRIkibd/wv1fLjHddx3s+gtYQtv7/ECdv20cSkg96Xqmv9R1GEPSVCCzoZWEDg6PRaPW+n 5Ds4Ds7Pge3RVVqYTDIgFYAE+/VJDBSy4xphISu82Ei9mz86MvC+WoYx739oI2GWps/TTK rndQathR2HQGeoItQuY0oLRXtR+aGIv+ukEcmM3jlci5lc/38barR2oh/4RtujAcQ7jkGq +GJVNBxo94JaPuS70YLvGIE/bfZeTXIwj/5R3MxYJp4GBY64VDAjuvQlN/xQ9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639866881; a=rsa-sha256; cv=none; b=DJtLHQx7KO5CZ2gLtaJqgbhrDb2S9KnWkmtdnijNutXE78gRxhzpukSx/LzLmrePY3bfNZ RsHSjiaoPAEWmjPldZ4hsKQeguX9IjpStn9yk/aj1P+ke1m/VESGNtmaBD3YuqyChv/L4c 2anYUNNHItQk+6AqiJh4baMiIlsEoGGj1GAM/gMq1S9UEbL0eJyvcmZZa+NiRIsSMQDQRh 2CIzIs2mK5aXzobtsRwivGoI5nlmRgQtY8CBxqEiQw/68HxwYP4J1f9/Jox0QDrNbNVQua SGChGjgmkc/7o8Z6YA/1T+ZmsygoVJ1pqOwLTq35Zi5C8ZVi8RMfCxLC7C86yw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=18f5b477ee66f0e55d6e1badda745b453f9f7bd8 commit 18f5b477ee66f0e55d6e1badda745b453f9f7bd8 Author: Rick Macklem AuthorDate: 2021-11-06 20:26:43 +0000 Commit: Rick Macklem CommitDate: 2021-12-18 22:30:25 +0000 vfs: Add "ioflag" and "cred" arguments to VOP_ALLOCATE When the NFSv4.2 server does a VOP_ALLOCATE(), it needs the operation to be done for the RPC's credential and not td_ucred. It also needs the writing to be done synchronously. This patch adds "ioflag" and "cred" arguments to VOP_ALLOCATE() and modifies vop_stdallocate() to use these arguments. The VOP_ALLOCATE.9 man page will be patched separately. (cherry picked from commit f0c9847a6c477430d6fff647b12e9e9e2b461f2a) --- sys/fs/nfsclient/nfs_clvnops.c | 2 +- sys/fs/nfsserver/nfs_nfsdport.c | 2 +- sys/kern/vfs_default.c | 10 +++++----- sys/kern/vfs_vnops.c | 3 ++- sys/kern/vnode_if.src | 2 ++ 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 5ae731d1b5e3..fefec912cfae 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -3751,7 +3751,7 @@ nfs_allocate(struct vop_allocate_args *ap) if ((uint64_t)alen > nfs_maxalloclen) alen = nfs_maxalloclen; error = nfsrpc_allocate(vp, *ap->a_offset, alen, - &nfsva, &attrflag, td->td_ucred, td, NULL); + &nfsva, &attrflag, ap->a_cred, td, NULL); } if (error == 0) { *ap->a_offset += alen; diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index bd833f1c375a..c63e24378ef5 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -6418,7 +6418,7 @@ nfsvno_allocate(struct vnode *vp, off_t off, off_t len, struct ucred *cred, */ do { olen = len; - error = VOP_ALLOCATE(vp, &off, &len); + error = VOP_ALLOCATE(vp, &off, &len, IO_SYNC, cred); if (error == 0 && len > 0 && olen > len) maybe_yield(); } while (error == 0 && len > 0 && olen > len); diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 5a233603631e..018660310e68 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -961,7 +961,7 @@ vop_stdallocate(struct vop_allocate_args *ap) len = *ap->a_len; offset = *ap->a_offset; - error = VOP_GETATTR(vp, vap, td->td_ucred); + error = VOP_GETATTR(vp, vap, ap->a_cred); if (error != 0) goto out; fsize = vap->va_size; @@ -998,12 +998,12 @@ vop_stdallocate(struct vop_allocate_args *ap) */ VATTR_NULL(vap); vap->va_size = offset + len; - error = VOP_SETATTR(vp, vap, td->td_ucred); + error = VOP_SETATTR(vp, vap, ap->a_cred); if (error != 0) goto out; VATTR_NULL(vap); vap->va_size = fsize; - error = VOP_SETATTR(vp, vap, td->td_ucred); + error = VOP_SETATTR(vp, vap, ap->a_cred); if (error != 0) goto out; } @@ -1029,7 +1029,7 @@ vop_stdallocate(struct vop_allocate_args *ap) auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_READ; auio.uio_td = td; - error = VOP_READ(vp, &auio, 0, td->td_ucred); + error = VOP_READ(vp, &auio, ap->a_ioflag, ap->a_cred); if (error != 0) break; if (auio.uio_resid > 0) { @@ -1050,7 +1050,7 @@ vop_stdallocate(struct vop_allocate_args *ap) auio.uio_rw = UIO_WRITE; auio.uio_td = td; - error = VOP_WRITE(vp, &auio, 0, td->td_ucred); + error = VOP_WRITE(vp, &auio, ap->a_ioflag, ap->a_cred); if (error != 0) break; diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index afb1c6799825..bde0403b2a51 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3470,7 +3470,8 @@ vn_fallocate(struct file *fp, off_t offset, off_t len, struct thread *td) error = mac_vnode_check_write(td->td_ucred, fp->f_cred, vp); if (error == 0) #endif - error = VOP_ALLOCATE(vp, &offset, &len); + error = VOP_ALLOCATE(vp, &offset, &len, 0, + td->td_ucred); VOP_UNLOCK(vp); vn_finished_write(mp); diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index ef4eef7f55f3..bc89ff57c631 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -705,6 +705,8 @@ vop_allocate { IN struct vnode *vp; INOUT off_t *offset; INOUT off_t *len; + IN int ioflag; + IN struct ucred *cred; };