Re: MM deadlock [was: Re: arca-vm-8...]

Stephen C. Tweedie (sct@redhat.com)
Sun, 10 Jan 1999 16:59:43 GMT


Hi,

On Sat, 9 Jan 1999 13:50:14 -0800 (PST), Linus Torvalds
<torvalds@transmeta.com> said:

> On Sat, 9 Jan 1999, Linus Torvalds wrote:
>>
>> The cleanest solution I can think of is actually to allow semaphores to be
>> recursive. I can do that with minimal overhead (just one extra instruction
>> in the non-contention case), so it's not too bad, and I've wanted to do it
>> for certain other things, but it's still a nasty piece of code to mess
>> around with.

Ack. I've been having a closer look, and making the superblock lock
recursive doesn't work: the ext2fs allocation code is definitely not
reentrant. In particular, the bitmap buffers can get evicted out from
under our feet if we reenter the block allocation code, leading to nasty
filesystem and/or memory corruption. The allocation code can also get
confused if the bitmap contents change between checking the group
descriptor for a block group and reading in the bitmap itself, leading
to potential ENOSPC errors turning up wrongly.

Preventing recursive VM access to the filesystem while we have the
superblock lock seems the only easy way out short of making the
allocation/truncate code fully reentrant.

On the other hand, it does look as if the inode deadlock is dealt with
OK if we just make that semaphore recursive; I can't see anywhere that
dies if we make that change. This does somewhat imply that we may need
to make a distinction between reentrant and non-reentrant semaphores if
we go down this route.

--Stephen.

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