Module Name:    src
Committed By:   dholland
Date:           Sun Nov 13 17:22:51 UTC 2011

Modified Files:
        src/sys/fs/nilfs: nilfs_vfsops.c

Log Message:
Avoid panic on error path, from PR 45607. The error path is exercised
because this is using DIOCGPART to get the volume size, which doesn't
work on wedges. It should be calling getdisksize() instead.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/fs/nilfs/nilfs_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/nilfs/nilfs_vfsops.c
diff -u src/sys/fs/nilfs/nilfs_vfsops.c:1.5 src/sys/fs/nilfs/nilfs_vfsops.c:1.6
--- src/sys/fs/nilfs/nilfs_vfsops.c:1.5	Wed Aug 11 13:26:25 2010
+++ src/sys/fs/nilfs/nilfs_vfsops.c	Sun Nov 13 17:22:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: nilfs_vfsops.c,v 1.5 2010/08/11 13:26:25 pgoyette Exp $ */
+/* $NetBSD: nilfs_vfsops.c,v 1.6 2011/11/13 17:22:51 dholland Exp $ */
 
 /*
  * Copyright (c) 2008, 2009 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.5 2010/08/11 13:26:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nilfs_vfsops.c,v 1.6 2011/11/13 17:22:51 dholland Exp $");
 #endif /* not lint */
 
 
@@ -635,6 +635,9 @@ nilfs_mount_device(struct vnode *devvp, 
 	cv_init(&nilfsdev->sync_cv, "nilfssyn");
 	STAILQ_INIT(&nilfsdev->mounts);
 
+	/* register nilfs_device in list */
+	SLIST_INSERT_HEAD(&nilfs_devices, nilfsdev, next_device);
+
 	/* get our device's size */
 	error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED);
 	if (error) {
@@ -644,9 +647,6 @@ nilfs_mount_device(struct vnode *devvp, 
 	}
 	nilfsdev->devsize = dpart.part->p_size * dpart.disklab->d_secsize;
 
-	/* register nilfs_device in list */
-	SLIST_INSERT_HEAD(&nilfs_devices, nilfsdev, next_device);
-
 	/* connect to the head for most recent files XXX really pass mp and args? */
 	error = nilfs_mount_base(nilfsdev, mp, args);
 	if (error) {

Reply via email to