From: Matthew Dillon Date: Thu, 8 Dec 2011 04:08:03 +0000 (-0800) Subject: kernel - Fix endless nfs error 70 during shutdown X-Git-Tag: v3.0.0~450 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/83a03e7ba91ea3de4a2af957d333f8b0ada36c56 kernel - Fix endless nfs error 70 during shutdown * When shutting down NFS rw mounts left over buffers may not be able to flush during a forced unmount. * When unable to flush during a forced unmount mark the bp EIO instead of ESTALE and also mark it B_INVAL to remove the buffer from the the vnode. --- diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index b68bd89..4cad5ad 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -1138,7 +1138,7 @@ nfs_request_setup(nfsm_info_t info) if (info->vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF) { m_freem(info->mreq); info->mreq = NULL; - return (ESTALE); + return (EIO); } nmp = VFSTONFS(info->vp->v_mount); req = kmalloc(sizeof(struct nfsreq), M_NFSREQ, M_WAITOK); diff --git a/sys/vfs/nfs/nfsm_subs.c b/sys/vfs/nfs/nfsm_subs.c index 2db5709..2cdc5f3 100644 --- a/sys/vfs/nfs/nfsm_subs.c +++ b/sys/vfs/nfs/nfsm_subs.c @@ -817,8 +817,18 @@ nfsm_request_bio(nfsm_info_t info, struct vnode *vp, int procnum, if (error != EINPROGRESS) { kprintf("nfsm_request_bio: early abort %d\n", error); bp = info->bio->bio_buf; - if (error) + if (error) { bp->b_flags |= B_ERROR; + if (error == EIO) /* unrecoverable */ + bp->b_flags |= B_INVAL; + } + + /* + * This can retry endlessly during a shutdown, change ESTALE + * to EIO in this case. + */ + if (shutdown_inprog && error == ESTALE) + error = EIO; bp->b_error = error; biodone(info->bio); }