svn commit: r189227 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/devfs

Edward Tomasz Napierala trasz at FreeBSD.org
Sun Mar 1 03:11:16 PST 2009


Author: trasz
Date: Sun Mar  1 11:11:14 2009
New Revision: 189227
URL: http://svn.freebsd.org/changeset/base/189227

Log:
  MFC r186911:
  
  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

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/fs/devfs/devfs_vnops.c

Modified: stable/7/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/7/sys/fs/devfs/devfs_vnops.c	Sun Mar  1 11:02:37 2009	(r189226)
+++ stable/7/sys/fs/devfs/devfs_vnops.c	Sun Mar  1 11:11:14 2009	(r189227)
@@ -481,12 +481,28 @@ devfs_close_f(struct file *fp, struct th
 	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));
 }


More information about the svn-src-all mailing list