Re: [testcase] madvise->semaphore deadlock 2.4.0

Andrew Morton (andrewm@uow.edu.au)
Tue, 09 Jan 2001 23:15:48 +1100


Mike Galbraith wrote:
>
> Greetings,
>
> While trying to configure ftpsearch, the process hangs while running
> it's madvise confidence test below. It appears to be taking a fault
> in madvise_fixup_middle():atomic_add(2, &vma->vm_file->f_count) and
> immediately deadlocking forever on mm->mmap_sem per IKD. (Virgin 2.4.0
> agrees)
>

This should fix it.

We're still in disagreement with the HPUX 11 manpage though.
HP say that MADV_DONTNEED requires an underlying file,
and thus implies that MADV_WILLNEED doesn't need an
underlying file. We have it the other way round, which
seems more sensible.

--- linux-2.4.0/mm/filemap.c Fri Jan 5 21:37:20 2001
+++ linux-akpm/mm/filemap.c Tue Jan 9 23:05:00 2001
@@ -1835,7 +1835,8 @@
n->vm_end = end;
setup_read_behavior(n, behavior);
n->vm_raend = 0;
- get_file(n->vm_file);
+ if (n->vm_file)
+ get_file(n->vm_file);
if (n->vm_ops && n->vm_ops->open)
n->vm_ops->open(n);
lock_vma_mappings(vma);
@@ -1861,7 +1862,8 @@
n->vm_pgoff += (n->vm_start - vma->vm_start) >> PAGE_SHIFT;
setup_read_behavior(n, behavior);
n->vm_raend = 0;
- get_file(n->vm_file);
+ if (n->vm_file)
+ get_file(n->vm_file);
if (n->vm_ops && n->vm_ops->open)
n->vm_ops->open(n);
lock_vma_mappings(vma);
@@ -1893,7 +1895,8 @@
right->vm_pgoff += (right->vm_start - left->vm_start) >> PAGE_SHIFT;
left->vm_raend = 0;
right->vm_raend = 0;
- atomic_add(2, &vma->vm_file->f_count);
+ if (vma->vm_file)
+ atomic_add(2, &vma->vm_file->f_count);

if (vma->vm_ops && vma->vm_ops->open) {
vma->vm_ops->open(left);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/