Don't panic with "vinvalbuf: dirty bufs" when the mounted device that was

being written to goes away.

Reviewed by:	kib, scottl
Approved by:	rwatson (mentor)
Sponsored by:	FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2009-01-08 19:13:34 +00:00
parent 673c4fe419
commit 71624181c8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186911

View File

@ -540,12 +540,28 @@ devfs_close_f(struct file *fp, struct thread *td)
return (error);
}
/* ARGSUSED */
static int
devfs_fsync(struct vop_fsync_args *ap)
{
if (!vn_isdisk(ap->a_vp, NULL))
int error;
struct bufobj *bo;
struct devfs_dirent *de;
if (!vn_isdisk(ap->a_vp, &error)) {
bo = &ap->a_vp->v_bufobj;
de = ap->a_vp->v_data;
if (error == ENXIO && bo->bo_dirty.bv_cnt > 0) {
printf("Device %s went missing before all of the data "
"could be written to it; expect data loss.\n",
de->de_dirent->d_name);
error = vop_stdfsync(ap);
if (bo->bo_dirty.bv_cnt != 0 || error != 0)
panic("devfs_fsync: vop_stdfsync failed.");
}
return (0);
}
return (vop_stdfsync(ap));
}