Re: swapon crashes computer

Manfred Spraul (masp0008@stud.uni-sb.de)
Sat, 27 Mar 1999 18:21:20 +0100


Guest section DW wrote:
> Maybe the cleanest patch would have set_blocksize return the original
> value, so that a failed swapon can restore the original state of affairs:

I've read the source code of set_blocksize(), and I think that
sys_swapon() must not call set_blocksize() if the device is in use:

set_blocksize() clears the buffer cache, and this will cause
problems if a filesystem is working with these buffers at the
same time. You do not even need an SMP computer:
set_blocksize() calls wait_on_buffer().

I remember that there was a thread a while ago that set_blocksize()
clears the contents of a ramdisk, and I'm sure that get/set_blocksize()
will cause problem if the computer is not idle.

I think we should add a "busy"-flag to blk_dev_struct.
- sys_swapon() tests and sets that flag
- sys_mount() tests and sets that flag
- sys_umount() clear that flag
- sys_swapoff() clears that flag
- the raid drivers should use that flag as well.

What do you think about this solution?
Is blk_dev_struct the correct structure, or should I add a new
array?

--
	Manfred

- 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/