Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F111610561
D36722.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36722.diff
View Options
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -3894,19 +3894,13 @@
off_t inoff, outoff;
bool consecutive, must_commit, tryoutcred;
- ret = ret2 = 0;
- nmp = VFSTONFS(invp->v_mount);
- mtx_lock(&nmp->nm_mtx);
/* NFSv4.2 Copy is not permitted for infile == outfile. */
- if (!NFSHASNFSV4(nmp) || nmp->nm_minorvers < NFSV42_MINORVERSION ||
- (nmp->nm_privflag & NFSMNTP_NOCOPY) != 0 || invp == outvp) {
- mtx_unlock(&nmp->nm_mtx);
- error = vn_generic_copy_file_range(ap->a_invp, ap->a_inoffp,
- ap->a_outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags,
- ap->a_incred, ap->a_outcred, ap->a_fsizetd);
- return (error);
+ if (invp == outvp) {
+generic_copy:
+ return (vn_generic_copy_file_range(invp, ap->a_inoffp,
+ outvp, ap->a_outoffp, ap->a_lenp, ap->a_flags,
+ ap->a_incred, ap->a_outcred, ap->a_fsizetd));
}
- mtx_unlock(&nmp->nm_mtx);
/* Lock both vnodes, avoiding risk of deadlock. */
do {
@@ -3933,6 +3927,23 @@
if (error != 0)
return (error);
+ /*
+ * More reasons to avoid nfs copy: not NFSv4.2, or explicitly
+ * disabled.
+ */
+ nmp = VFSTONFS(invp->v_mount);
+ mtx_lock(&nmp->nm_mtx);
+ if (!NFSHASNFSV4(nmp) || nmp->nm_minorvers < NFSV42_MINORVERSION ||
+ (nmp->nm_privflag & NFSMNTP_NOCOPY) != 0) {
+ mtx_unlock(&nmp->nm_mtx);
+ VOP_UNLOCK(invp);
+ VOP_UNLOCK(outvp);
+ if (mp != NULL)
+ vn_finished_write(mp);
+ goto generic_copy;
+ }
+ mtx_unlock(&nmp->nm_mtx);
+
/*
* Do the vn_rlimit_fsize() check. Should this be above the VOP layer?
*/
@@ -3959,6 +3970,7 @@
error = ncl_flush(outvp, MNT_WAIT, curthread, 1, 0);
/* Do the actual NFSv4.2 RPC. */
+ ret = ret2 = 0;
len = *ap->a_lenp;
mtx_lock(&nmp->nm_mtx);
if ((nmp->nm_privflag & NFSMNTP_NOCONSECUTIVE) == 0)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 6, 11:57 PM (11 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17021844
Default Alt Text
D36722.diff (1 KB)
Attached To
Mode
D36722: nfsclient: access v_mount only after the vnode is locked
Attached
Detach File
Event Timeline
Log In to Comment