FreeBSD Bugzilla – Attachment 247343 Details for
Bug 276002
nfscl: data corruption using both copy_file_range and mmap'd I/O
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Flush invp cache; invalidate outvp cache.
1.patch (text/plain), 2.28 KB, created by
Konstantin Belousov
on 2023-12-30 00:19:08 UTC
(
hide
)
Description:
Flush invp cache; invalidate outvp cache.
Filename:
MIME Type:
Creator:
Konstantin Belousov
Created:
2023-12-30 00:19:08 UTC
Size:
2.28 KB
patch
obsolete
>diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c >index a690e988b4b3..dec38b51703e 100644 >--- a/sys/fs/nfsclient/nfs_clvnops.c >+++ b/sys/fs/nfsclient/nfs_clvnops.c >@@ -3872,13 +3872,14 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap) > struct vnode *invp = ap->a_invp; > struct vnode *outvp = ap->a_outvp; > struct mount *mp; >+ vm_object_t invp_obj; > struct nfsvattr innfsva, outnfsva; > struct vattr va, *vap; > struct uio io; > struct nfsmount *nmp; > size_t len, len2; > ssize_t r; >- int error, inattrflag, outattrflag, ret, ret2; >+ int error, inattrflag, outattrflag, ret, ret2, invp_lock; > off_t inoff, outoff; > bool consecutive, must_commit, tryoutcred; > >@@ -3891,6 +3892,9 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap) > return (ENOSYS); > } > >+relock: >+ invp_lock = LK_SHARED; >+ > /* Lock both vnodes, avoiding risk of deadlock. */ > do { > mp = NULL; >@@ -3898,14 +3902,14 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap) > if (error == 0) { > error = vn_lock(outvp, LK_EXCLUSIVE); > if (error == 0) { >- error = vn_lock(invp, LK_SHARED | LK_NOWAIT); >+ error = vn_lock(invp, invp_lock | LK_NOWAIT); > if (error == 0) > break; > VOP_UNLOCK(outvp); > if (mp != NULL) > vn_finished_write(mp); > mp = NULL; >- error = vn_lock(invp, LK_SHARED); >+ error = vn_lock(invp, invp_lock); > if (error == 0) > VOP_UNLOCK(invp); > } >@@ -3953,10 +3957,25 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap) > * stable storage before the Copy RPC. This is done in case the > * server reboots during the Copy and needs to be redone. > */ >- if (error == 0) >+ if (error == 0) { >+ invp_obj = invp->v_object; >+ if (invp_obj != NULL && vm_object_mightbedirty(invp_obj)) { >+ if (invp_lock != LK_EXCLUSIVE) { >+ invp_lock = LK_EXCLUSIVE; >+ VOP_UNLOCK(invp); >+ VOP_UNLOCK(outvp); >+ if (mp != NULL) >+ vn_finished_write(mp); >+ goto relock; >+ } >+ VM_OBJECT_WLOCK(invp_obj); >+ vm_object_page_clean(invp_obj, 0, 0, OBJPC_SYNC); >+ VM_OBJECT_WUNLOCK(invp_obj); >+ } > error = ncl_flush(invp, MNT_WAIT, curthread, 1, 0); >+ } > if (error == 0) >- error = ncl_flush(outvp, MNT_WAIT, curthread, 1, 0); >+ error = ncl_vinvalbuf(outvp, V_SAVE, curthread, 0); > > /* Do the actual NFSv4.2 RPC. */ > ret = ret2 = 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 276002
:
247343
|
247346
|
247360
|
247424
|
248653
|
248770
|
248807
|
249298
|
250535