public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Felix Blyakher <felixb@sgi.com>
Cc: Hedi Berriche <hedi@sgi.com>, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: prevent deadlock in xfs_qm_shake()
Date: Fri, 29 May 2009 15:25:29 -0400	[thread overview]
Message-ID: <20090529192529.GA1599@infradead.org> (raw)
In-Reply-To: <1243620631-10749-2-git-send-email-felixb@sgi.com>

On Fri, May 29, 2009 at 01:10:31PM -0500, Felix Blyakher wrote:
> It's possible to recurse into filesystem from the memory
> allocation, which deadlocks in xfs_qm_shake(). Add check
> for __GFP_FS, and bailout if it is not set.
> 
> Signed-off-by: Felix Blyakher <felixb@sgi.com>
> Signed-off-by: Hedi Berriche <hedi@sgi.com>
> ---
>  fs/xfs/linux-2.6/kmem.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
> index af6843c..d8d2321 100644
> --- a/fs/xfs/linux-2.6/kmem.h
> +++ b/fs/xfs/linux-2.6/kmem.h
> @@ -103,7 +103,7 @@ extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast);
>  static inline int
>  kmem_shake_allow(gfp_t gfp_mask)
>  {
> -	return (gfp_mask & __GFP_WAIT) != 0;
> +	return ((gfp_mask & __GFP_WAIT && gfp_mask & __GFP_FS) != 0;

Looks good to me.  But this could be written simpler as:

	return ((gfp_mask & (__GFP_WAIT|__GFP_FS)) != 0;

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2009-05-29 19:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-29 18:10 XFS: prevent deadlock in quota code when recursing into filesystem Felix Blyakher
2009-05-29 18:10 ` [PATCH] xfs: prevent deadlock in xfs_qm_shake() Felix Blyakher
2009-05-29 19:25   ` Christoph Hellwig [this message]
2009-05-29 19:29     ` Felix Blyakher
2009-05-30 10:43     ` Andi Kleen
2009-05-30 14:57       ` Felix Blyakher
2009-05-30 16:14         ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090529192529.GA1599@infradead.org \
    --to=hch@infradead.org \
    --cc=felixb@sgi.com \
    --cc=hedi@sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox