Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150015966
D42554.id129982.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
D42554.id129982.diff
View Options
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -3046,6 +3046,7 @@
off_t *outoffp, size_t *lenp, unsigned int flags, struct ucred *incred,
struct ucred *outcred, struct thread *fsize_td)
{
+ struct mount *inmp, *outmp;
int error;
size_t len;
uint64_t uval;
@@ -3075,20 +3076,47 @@
if (len == 0)
goto out;
+ inmp = invp->v_mount;
+ outmp = outvp->v_mount;
+ if (inmp == NULL || outmp == NULL) {
+ error = EBADF;
+ goto out;
+ }
+
+ for (;;) {
+ error = vfs_busy(inmp, 0);
+ if (error != 0)
+ goto out;
+ error = vfs_busy(outmp, MBF_NOWAIT);
+ if (error != 0) {
+ vfs_unbusy(inmp);
+ if (error == ENOENT) {
+ error = vfs_busy(outmp, 0);
+ if (error == 0) {
+ vfs_unbusy(outmp);
+ continue;
+ }
+ }
+ goto out;
+ }
+ break;
+ }
+
/*
* If the two vnodes are for the same file system type, call
* VOP_COPY_FILE_RANGE(), otherwise call vn_generic_copy_file_range()
* which can handle copies across multiple file system types.
*/
*lenp = len;
- if (invp->v_mount == outvp->v_mount ||
- strcmp(invp->v_mount->mnt_vfc->vfc_name,
- outvp->v_mount->mnt_vfc->vfc_name) == 0)
+ if (inmp == outmp || strcmp(inmp->mnt_vfc->vfc_name,
+ outmp->mnt_vfc->vfc_name) == 0)
error = VOP_COPY_FILE_RANGE(invp, inoffp, outvp, outoffp,
lenp, flags, incred, outcred, fsize_td);
else
error = vn_generic_copy_file_range(invp, inoffp, outvp,
outoffp, lenp, flags, incred, outcred, fsize_td);
+ vfs_unbusy(outmp);
+ vfs_unbusy(inmp);
out:
return (error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 29, 6:54 PM (11 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30547694
Default Alt Text
D42554.id129982.diff (1 KB)
Attached To
Mode
D42554: vn_copy_file_range(): busy both in and out mp around call to VOP_COPY_FILE_RANGE()
Attached
Detach File
Event Timeline
Log In to Comment