xfs
[Top] [All Lists]

Re: [PATCH] fix qsort breakage

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH] fix qsort breakage
From: Andrew Morton <akpm@xxxxxxxxxx>
Date: Tue, 02 Jul 2002 14:33:52 -0700
Cc: linux-xfs@xxxxxxxxxxx
References: <20020504121512.A8534@infradead.org>
Sender: owner-linux-xfs@xxxxxxxxxxx
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).

-


<Prev in Thread] Current Thread [Next in Thread>