[PATCH] xfs: prevent deadlock in xfs_qm_shake()

Felix Blyakher felixb at sgi.com
Fri May 29 13:10:31 CDT 2009


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 at sgi.com>
Signed-off-by: Hedi Berriche <hedi at 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;
 }
 
 #endif /* __XFS_SUPPORT_KMEM_H__ */
-- 
1.5.4.rc3




More information about the xfs mailing list