On Mon, Jul 24, 2017 at 11:26:49AM +0300, Nikolay Borisov wrote:
>
>
> On 21.07.2017 20:29, josef@xxxxxxxxxxxxxx wrote:
> > From: Josef Bacik <jbacik@xxxxxx>
> >
> > Readdir does dir_emit while under the btree lock. dir_emit can trigger
> > the page fault which means we can deadlock. Fix this by allocating a
> > buffer on opening a directory and copying the readdir into this buffer
> > and doing dir_emit from outside of the tree lock.
>
> So dir_emit essentially calls filldir which can fault on the user
> provided addresses. How could a fault there recurse back to the filesystem?
>
Thread A
readdir <holding tree lock>
dir_emit
<page fault>
down_read(mmap_sem)
Thread B
mmap write
down_write(mmap_sem)
page_mkwrite
wait_ordered_extents
Process C
finish_ordered_extent
insert_reserved_file_extent
try to lock leaf <hang>
Thanks,
Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html