Current-Users archive

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

RW lock panic while mounting a CD



Hi all,

I encountered this afternoon a lockdebug panic while trying to mount a
CD/DVD on a -current from June 13th. The panic message is:"Assertion
failed: "RW_COUNT(rw) != 0" failed"

with the following backtrace:

rw_vector_exit()
vlockmgr()
ffs_unlock()
VOP_UNLOCK()
spec_open()
VOP_OPEN()
cd9660_mount()

Reworking the locking in cd9660_mount() to keep `vp' locked for the
call to VOP_OPEN() allows me to mount CD correctly again (cf attached
patch).

- Arnaud
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 6a95da2..226df75 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -266,31 +266,34 @@ cd9660_mount(struct mount *mp, const char *path, void 
*data, size_t *data_len)
         */
        vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
        error = genfs_can_mount(devvp, VREAD, l->l_cred);
-       VOP_UNLOCK(devvp, 0);
-       if (error) {
-               vrele(devvp);
-               return (error);
-       }
+       if (error)
+               goto fail;
+
        if ((mp->mnt_flag & MNT_UPDATE) == 0) {
                error = VOP_OPEN(devvp, FREAD, FSCRED);
                if (error)
                        goto fail;
+
                error = iso_mountfs(devvp, mp, l, args);
                if (error) {
-                       vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
                        (void)VOP_CLOSE(devvp, FREAD, NOCRED);
-                       VOP_UNLOCK(devvp, 0);
                        goto fail;
                }
+
+               VOP_UNLOCK(devvp, 0);
        } else {
+               VOP_UNLOCK(devvp, 0);
                vrele(devvp);
+
                if (devvp != imp->im_devvp)
                        return (EINVAL);        /* needs translation */
        }
+
        return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
            mp->mnt_op->vfs_name, mp, l);
 
 fail:
+       VOP_UNLOCK(devvp, 0);
        vrele(devvp);
        return (error);
 }


Home | Main Index | Thread Index | Old Index