Index: sys/kern/vfs_vnops.c.sav2 =================================================================== --- sys/kern/vfs_vnops.c.sav2 +++ sys/kern/vfs_vnops.c.sav2 @@ -3012,7 +3012,13 @@ size_t copylen, len, savlen; char *dat; long holein, holeout; + uint64_t curtime, stoptime; + struct timespec tm; + nanouptime(&tm); + stoptime = tm.tv_sec + 1; + stoptime = stoptime * 1000000000 + tm.tv_nsec; + curtime = 0; holein = holeout = 0; savlen = len = *lenp; error = 0; @@ -3095,7 +3101,7 @@ * support holes on the server, but do not support FIOSEEKHOLE. */ eof = false; - while (len > 0 && error == 0 && !eof) { + while (len > 0 && error == 0 && !eof && curtime < stoptime) { endoff = 0; /* To shut up compilers. */ cantseek = true; startoff = *inoffp; @@ -3156,6 +3162,10 @@ *inoffp += xfer; *outoffp += xfer; len -= xfer; + nanouptime(&tm); + curtime = tm.tv_sec; + curtime = curtime * 1000000000 + + tm.tv_nsec; } } copylen = MIN(len, endoff - startoff); @@ -3177,7 +3187,8 @@ xfer -= (*inoffp % blksize); } /* Loop copying the data block. */ - while (copylen > 0 && error == 0 && !eof) { + while (copylen > 0 && error == 0 && !eof && + curtime < stoptime) { if (copylen < xfer) xfer = copylen; error = vn_lock(invp, LK_SHARED); @@ -3221,6 +3232,9 @@ } } xfer = blksize; + nanouptime(&tm); + curtime = tm.tv_sec; + curtime = curtime * 1000000000 + tm.tv_nsec; } } out: