Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102560422
D31712.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
D31712.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
@@ -3463,7 +3463,8 @@
static int
vn_deallocate_impl(struct vnode *vp, off_t *offset, off_t *length, int flags,
- int ioflag, struct ucred *active_cred, struct ucred *file_cred)
+ int ioflag, struct ucred *cred, struct ucred *active_cred,
+ struct ucred *file_cred)
{
struct mount *mp;
void *rl_cookie;
@@ -3510,7 +3511,7 @@
#endif
if (error == 0)
error = VOP_DEALLOCATE(vp, &off, &len, flags, ioflag,
- active_cred);
+ cred);
if ((ioflag & IO_NODELOCKED) == 0) {
VOP_UNLOCK(vp);
@@ -3530,17 +3531,24 @@
return (error);
}
+/*
+ * This function is supposed to be used in the situations where the deallocation
+ * is not triggered by a user request.
+ */
int
vn_deallocate(struct vnode *vp, off_t *offset, off_t *length, int flags,
int ioflag, struct ucred *active_cred, struct ucred *file_cred)
{
+ struct ucred *cred;
+
if (*offset < 0 || *length <= 0 || *length > OFF_MAX - *offset ||
flags != 0)
return (EINVAL);
if (vp->v_type != VREG)
return (ENODEV);
- return (vn_deallocate_impl(vp, offset, length, flags, ioflag,
+ cred = file_cred != NOCRED ? file_cred : active_cred;
+ return (vn_deallocate_impl(vp, offset, length, flags, ioflag, cred,
active_cred, file_cred));
}
@@ -3565,7 +3573,7 @@
switch (cmd) {
case SPACECTL_DEALLOC:
error = vn_deallocate_impl(vp, offset, length, flags, ioflag,
- active_cred, fp->f_cred);
+ active_cred, active_cred, fp->f_cred);
break;
default:
panic("vn_fspacectl: unknown cmd %d", cmd);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 2:05 AM (10 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14636823
Default Alt Text
D31712.diff (1 KB)
Attached To
Mode
D31712: vfs: Use file_cred for VOP_DEALLOCATE in vn_deallocate if non-NULL
Attached
Detach File
Event Timeline
Log In to Comment