patch-2.4.17 linux/fs/super.c

Next file: linux/fs/sysv/ChangeLog
Previous file: linux/fs/reiserfs/tail_conversion.c
Back to the patch index
Back to the overall index

diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.16/fs/super.c linux/fs/super.c
@@ -537,6 +537,7 @@
 	struct inode *inode;
 	struct block_device *bdev;
 	struct block_device_operations *bdops;
+	devfs_handle_t de;
 	struct super_block * s;
 	struct nameidata nd;
 	struct list_head *p;
@@ -560,13 +561,15 @@
 		goto out;
 	bd_acquire(inode);
 	bdev = inode->i_bdev;
-	bdops = devfs_get_ops ( devfs_get_handle_from_inode (inode) );
+	de = devfs_get_handle_from_inode (inode);
+	bdops = devfs_get_ops (de);         /*  Increments module use count  */
 	if (bdops) bdev->bd_op = bdops;
 	/* Done with lookups, semaphore down */
 	dev = to_kdev_t(bdev->bd_dev);
 	if (!(flags & MS_RDONLY))
 		mode |= FMODE_WRITE;
 	error = blkdev_get(bdev, mode, 0, BDEV_FS);
+	devfs_put_ops (de);   /*  Decrement module use count now we're safe  */
 	if (error)
 		goto out;
 	check_disk_change(dev);
@@ -999,12 +1002,13 @@
 	bdev = bdget(kdev_t_to_nr(ROOT_DEV));
 	if (!bdev)
 		panic(__FUNCTION__ ": unable to allocate root device");
-	bdev->bd_op = devfs_get_ops (handle);
+	bdev->bd_op = devfs_get_ops (handle); /* Increments module use count */
 	path_start = devfs_generate_path (handle, path + 5, sizeof (path) - 5);
 	mode = FMODE_READ;
 	if (!(root_mountflags & MS_RDONLY))
 		mode |= FMODE_WRITE;
 	retval = blkdev_get(bdev, mode, 0, BDEV_FS);
+	devfs_put_ops (handle); /* Decrement module use count now we're safe */
 	if (retval == -EROFS) {
 		root_mountflags |= MS_RDONLY;
 		goto retry;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)