Page MenuHomeFreeBSD

D11489.id30448.diff
No OneTemporary

D11489.id30448.diff

Index: sys/kern/subr_uio.c
===================================================================
--- sys/kern/subr_uio.c
+++ sys/kern/subr_uio.c
@@ -206,31 +206,32 @@
static int
uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault)
{
- struct thread *td;
struct iovec *iov;
size_t cnt;
int error, newflags, save;
- td = curthread;
error = 0;
KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
("uiomove: mode"));
- KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == td,
+ KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread,
("uiomove proc"));
- if (!nofault)
- WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
- "Calling uiomove()");
-
- /* XXX does it make a sense to set TDP_DEADLKTREAT for UIO_SYSSPACE ? */
- newflags = TDP_DEADLKTREAT;
- if (uio->uio_segflg == UIO_USERSPACE && nofault) {
- /*
- * Fail if a non-spurious page fault occurs.
- */
- newflags |= TDP_NOFAULTING | TDP_RESETSPUR;
+
+ if (uio->uio_segflg == UIO_USERSPACE) {
+ newflags = TDP_DEADLKTREAT;
+ if (nofault) {
+ /*
+ * Fail if a non-spurious page fault occurs.
+ */
+ newflags |= TDP_NOFAULTING | TDP_RESETSPUR;
+ } else {
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
+ "Calling uiomove()");
+ }
+ save = curthread_pflags_set(newflags);
+ } else {
+ KASSERT(nofault == 0, ("uiomove: nofault"));
}
- save = curthread_pflags_set(newflags);
while (n > 0 && uio->uio_resid) {
iov = uio->uio_iov;
@@ -272,7 +273,8 @@
n -= cnt;
}
out:
- curthread_pflags_restore(save);
+ if (uio->uio_segflg == UIO_USERSPACE)
+ curthread_pflags_restore(save);
return (error);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 22, 3:50 PM (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25881160
Default Alt Text
D11489.id30448.diff (1 KB)

Event Timeline