[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fix qsort breakage



Christoph Hellwig wrote:
> 
> Qsort in the XFS tree has two problems:
> 
>  o allocates memory using GFP_KERNEL although called from under i_sem
>    (possible deadlock)

The page allocator will never take an i_sem.  Note how generic_file_write()
performs tons of GFP_HIGHUSER allocations inside i_sem.  No deadlocks
there.

qsort should take gfp_flags as an argument. Or not perform any allocation,
as you've described.

But the code seems OK as-is.  Suggest you stick with the more
robust GFP_KERNEL.

(It'd be nice to stick that qsort in lib/qsort.c, rather than making
it XFS-private, btw).

-