Re: [Patch] deadlock on write in tmpfs

From: Stephen C. Tweedie (sct@redhat.com)
Date: Tue May 01 2001 - 11:32:10 EST


hi,

On Tue, May 01, 2001 at 03:39:47PM +0200, Christoph Rohland wrote:
>
> tmpfs deadlocks when writing into a file from a mapping of the same
> file.
>
> So I see two choices:
>
> 1) Do not serialise the whole of shmem_getpage_locked but protect
> critical pathes with the spinlock and do retries after sleeps
> 2) Add another semaphore to serialize shmem_getpage_locked and
> shmem_truncate
>
> I tried some time to get 1) done but the retry logic became way too
> complicated. So the attached patch implements 2)
>
> I still think it's ugly to add another semaphore, but it works.

If the locking is for a completely different reason, then a different
semaphore is quite appropriate. In this case you're trying to lock
the shm internal info structures, which is quite different from the
sort of inode locking which the VFS tries to do itself, so the new
semaphore appears quite clean --- and definitely needed.

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



This archive was generated by hypermail 2b29 : Mon May 07 2001 - 21:00:12 EST