Re: [PATCH 2.3.48] initrd fix (Mike Galbraith)

From: Mike Galbraith (mikeg@weiden.de)
Date: Mon Feb 28 2000 - 23:59:47 EST


On Sun, 27 Feb 2000, Linus Torvalds wrote:

> Looks ok _except_ for this part that does
>
> - if (atomic_dec_and_test(&bdev->bd_openers)) {
> + if (atomic_dec_and_test(&bdev->bd_openers) && MAJOR(rdev) != RAMDISK_MAJOR) {
>
> in fs/block_dev.c..
>
> I see exactly what you're trying to do, I just disagree with it violently.
> I hate having these kinds of special cases in generic code - it turns them
> into non-generic code.
>
> It should be easily fixed in the initrd code itself, rather than in the
> generic code: turning it from a special case into a normal well-behaved
> case should be trivial. The way I would suggest is that initrd should just
> open the block device one extra time very early on, and then close the
> block device one extra time just before releasing all the initrd memory.
>
> Would you be willing to look at that solution instead?

Is this simple approach acceptable? If so, I'll cleanup and post.

rd.c:rd_init().. undo in rd_cleanup().
443 hardsect_size[MAJOR_NR] = rd_hardsec; /* Size of the RAM disk blo 444 blksize_size[MAJOR_NR] = rd_blocksizes; /* Avoid set_blocksize() 445
446 for (i = 0; i < NUM_RAMDISKS; i++) {
447 + struct block_device *bdev;
448 register_disk(NULL, MKDEV(MAJOR_NR,i), 1, &fd_fops, rd_size<<1);
449 + bdev = bdget(kdev_t_to_nr(MKDEV(MAJOR_NR,i)));
450 + atomic_inc(&bdev->bd_openers); /* avoid invalidate_buffers() */
451 }

        -Mike

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:21 EST