NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/45607: mount_nilfs(8) on wedge panic



>Number:         45607
>Category:       kern
>Synopsis:       Mounting a NILFS(2) file system on a wedge panics the kernel
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 12 15:35:00 +0000 2011
>Originator:     Gregoire Sutre
>Release:        NetBSD 5.99.56 (2011-11-11)
>Organization:
>Environment:
System: NetBSD yosemite 5.99.56 NetBSD 5.99.56 (GENERIC) #0: Fri Nov 11 
17:26:37 CET 2011 
sutre@tahoe:/data/sutre/build-amd64/home/sutre/NetBSD/src/sys/arch/amd64/compile/GENERIC
 amd64
Architecture: x86_64
Machine: amd64
>Description:
I get a kernel panic when mounting a NILFS(2) file system on a wedge.
The reason is the following: when nilfs_mount_device() isn't able to
detect the device's size, it calls nilfs_unmount_device() before
registering the device in the global list of nilfs devices.  Then,
nilfs_unmount_device() attempts to remove the element from the list,
which leads to the kernel panic.

The patch below fixes the problem.  But mount_nilfs(8) still does not
work on wedges.  The patch only fixes the panic.

>How-To-Repeat:
Attempt to mount_nilfs(8) a NILFS(2) file system stored in a GPT
partition, detected as a dk(4) wedge.
>Fix:

Index: nilfs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/nilfs/nilfs_vfsops.c,v
retrieving revision 1.5
diff -U 5 -p -r1.5 nilfs_vfsops.c
--- nilfs_vfsops.c      11 Aug 2010 13:26:25 -0000      1.5
+++ nilfs_vfsops.c      12 Nov 2011 15:29:04 -0000
@@ -633,22 +633,22 @@ nilfs_mount_device(struct vnode *devvp, 
        nilfsdev->devvp         = devvp;
        nilfsdev->uncomitted_bl = 0;
        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) {
                /* remove all our information */
                nilfs_unmount_device(nilfsdev);
                return EINVAL;
        }
        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) {
                /* remove all our information */
                nilfs_unmount_device(nilfsdev);



Home | Main Index | Thread Index | Old Index