--- //depot/vendor/freebsd/src/sys/nfs4client/nfs4_vnops.c 2008/04/16 11:35:15 +++ //depot/user/attilio/attilio_schedlock/nfs4client/nfs4_vnops.c 2008/05/25 17:00:32 @@ -2493,7 +2493,7 @@ int i; struct buf *nbp; struct nfsmount *nmp = VFSTONFS(vp->v_mount); - int error = 0, slptimeo = 0, slpflag = 0, retv, bvecpos; + int error = 0, slptimeo = 0, slpflag = 0, terr, retv, bvecpos; int passone = 1; u_quad_t off, endoff, toff; struct ucred* wcred = NULL; @@ -2688,13 +2688,16 @@ if (waitfor != MNT_WAIT || passone) continue; + terr = error; error = BUF_TIMELOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK, BO_MTX(bo), "nfsfsync", slpflag, slptimeo); if (error == 0) panic("nfs4_fsync: inconsistent lock"); - if (error == ENOLCK) + if (error == ENOLCK) { + error = terr; goto loop; + } if (nfs4_sigintr(nmp, NULL, td)) { error = EINTR; goto done; --- //depot/vendor/freebsd/src/sys/nfsclient/nfs_vnops.c 2008/04/16 11:35:15 +++ //depot/user/attilio/attilio_schedlock/nfsclient/nfs_vnops.c 2008/05/25 16:57:01 @@ -2738,7 +2738,7 @@ int i; struct buf *nbp; struct nfsmount *nmp = VFSTONFS(vp->v_mount); - int error = 0, slptimeo = 0, slpflag = 0, retv, bvecpos; + int error = 0, slptimeo = 0, slpflag = 0, terr, retv, bvecpos; int passone = 1; u_quad_t off, endoff, toff; struct ucred* wcred = NULL; @@ -2934,6 +2934,7 @@ if (waitfor != MNT_WAIT || passone) continue; + terr = error; error = BUF_TIMELOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK, BO_MTX(bo), "nfsfsync", slpflag, slptimeo); @@ -2941,8 +2942,10 @@ BUF_UNLOCK(bp); goto loop; } - if (error == ENOLCK) + if (error == ENOLCK) { + error = terr; goto loop; + } if (nfs_sigintr(nmp, NULL, td)) { error = EINTR; goto done;