[RFC]xfs: using GFP_NOFS for blkdev_issue_flush

Shaohua Li shli at kernel.org
Mon Apr 16 01:58:21 CDT 2012


On 4/16/12 2:49 PM, Shaohua Li wrote:
>
> flush request is issued in transaction commit code path usually, so
> looks using
> GFP_KERNEL to allocate memory for flush request bio falls into the classic
> deadlock issue (memory reclaim recursion). Use GFP_NOFS to avoid recursion
> from reclaim context. Per Dave Chinner, there is only blkdev_issue_flush
> might
> be buggy here. But using GFP_NOFS by default for all calls should not
> matter.
>
> Signed-off-by: Shaohua Li <shli at fusionio.com>
> ---
> fs/xfs/xfs_super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux/fs/xfs/xfs_super.c
> ===================================================================
> --- linux.orig/fs/xfs/xfs_super.c 2012-04-13 10:08:26.095496072 +0800
> +++ linux/fs/xfs/xfs_super.c 2012-04-13 10:08:42.555496865 +0800
> @@ -622,7 +622,7 @@ void
> xfs_blkdev_issue_flush(
> xfs_buftarg_t *buftarg)
> {
> - blkdev_issue_flush(buftarg->bt_bdev, GFP_KERNEL, NULL);
> + blkdev_issue_flush(buftarg->bt_bdev, GFP_NOFS, NULL);
> }
>
> STATIC void
>
Oops, I apologize for the html mail, it slipped to wrong imap server. 
below one has correct format.

flush request is issued in transaction commit code path usually, so 
looks using
GFP_KERNEL to allocate memory for flush request bio falls into the classic
deadlock issue (memory reclaim recursion). Use GFP_NOFS to avoid recursion
from reclaim context. Per Dave Chinner, there is only blkdev_issue_flush 
might
be buggy here. But using GFP_NOFS by default for all calls should not 
matter.

Signed-off-by: Shaohua Li <shli at fusionio.com>
---
  fs/xfs/xfs_super.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/fs/xfs/xfs_super.c
===================================================================
--- linux.orig/fs/xfs/xfs_super.c	2012-04-13 10:08:26.095496072 +0800
+++ linux/fs/xfs/xfs_super.c	2012-04-13 10:08:42.555496865 +0800
@@ -622,7 +622,7 @@ void
  xfs_blkdev_issue_flush(
  	xfs_buftarg_t		*buftarg)
  {
-	blkdev_issue_flush(buftarg->bt_bdev, GFP_KERNEL, NULL);
+	blkdev_issue_flush(buftarg->bt_bdev, GFP_NOFS, NULL);
  }

  STATIC void



More information about the xfs mailing list