Index: sys/kern/vfs_vnops.c.sav2 =================================================================== --- sys/kern/vfs_vnops.c.sav2 +++ sys/kern/vfs_vnops.c.sav2 @@ -3012,7 +3012,12 @@ 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 * 1000000 + tm.tv_nsec / 1000; holein = holeout = 0; savlen = len = *lenp; error = 0; @@ -3094,8 +3099,11 @@ * Note that some file systems such as NFSv3, NFSv4.0 and NFSv4.1 may * support holes on the server, but do not support FIOSEEKHOLE. */ + nanouptime(&tm); + curtime = tm.tv_sec; + curtime = curtime * 1000000 + tm.tv_nsec / 1000; 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; @@ -3177,7 +3185,11 @@ xfer -= (*inoffp % blksize); } /* Loop copying the data block. */ - while (copylen > 0 && error == 0 && !eof) { + nanouptime(&tm); + curtime = tm.tv_sec; + curtime = curtime * 1000000 + tm.tv_nsec / 1000; + while (copylen > 0 && error == 0 && !eof && + curtime < stoptime) { if (copylen < xfer) xfer = copylen; error = vn_lock(invp, LK_SHARED); @@ -3221,6 +3233,9 @@ } } xfer = blksize; + nanouptime(&tm); + curtime = tm.tv_sec; + curtime = curtime * 1000000 + tm.tv_nsec / 1000; } } out: