Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178042699
D58079.1795832083.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D58079.1795832083.diff
View Options
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -248,6 +248,7 @@
struct file *fp;
struct thread *td;
bool fdropped;
+ uint8_t fd_flags;
};
static int
@@ -263,6 +264,11 @@
fdm = VFSTOFDESC(mp);
if ((fdm->flags & FMNT_NODUP) != 0 && a->fp->f_type == DTYPE_VNODE) {
vp = a->fp->f_vnode;
+ /* f_flag is always between 1 and FMASK and < INT_MAX. */
+ if (a->fd_flags & UF_RESOLVE_BENEATH)
+ a->td->td_dupfd = a->fp->f_flag;
+ else
+ a->td->td_dupfd = 0;
vget(vp, lkflags | LK_RETRY);
*rvp = vp;
error = 0;
@@ -332,7 +338,8 @@
/*
* No rights to check since 'fp' isn't actually used.
*/
- if ((error = fget(td, fd, &cap_no_rights, &fp)) != 0)
+ if ((error = fget_cap(td, fd, &cap_no_rights, &arg.fd_flags,
+ &fp, NULL)) != 0)
goto bad;
/*
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1295,7 +1295,6 @@
goto bad;
}
- td->td_dupfd = 0;
NDFREE_PNBUF(&nd);
vp = nd.ni_vp;
@@ -1310,6 +1309,7 @@
if (fpp != NULL) {
MPASS(error == 0);
NDFREE_IOCTLCAPS(&nd);
+ td->td_dupfd = -1;
*fpp = fp;
return (0);
}
@@ -1324,10 +1324,12 @@
else
#endif
fcaps = NULL;
- if ((nd.ni_resflags & NIRES_BENEATH) != 0)
+ if ((nd.ni_resflags & NIRES_BENEATH) != 0 ||
+ td->td_dupfd > 0)
flags |= O_RESOLVE_BENEATH;
else
flags &= ~O_RESOLVE_BENEATH;
+ td->td_dupfd = -1;
error = finstall_refed(td, fp, &indx, flags, fcaps);
/* On success finstall_refed() consumes fcaps. */
if (error != 0) {
@@ -1343,6 +1345,7 @@
bad:
KASSERT(indx == -1, ("indx=%d, should be -1", indx));
NDFREE_IOCTLCAPS(&nd);
+ td->td_dupfd = -1;
falloc_abort(td, fp);
return (error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 28, 2:14 AM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42047766
Default Alt Text
D58079.1795832083.diff (1 KB)
Attached To
Mode
D58079: fdescfs: preserve FD_RESOLVE_BENEATH across nodup reopens
Attached
Detach File
Event Timeline