All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush
@ 2012-04-13  2:27 Shaohua Li
  2012-04-15 22:44 ` Dave Chinner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shaohua Li @ 2012-04-13  2:27 UTC (permalink / raw)
  To: linux-ext4, linux-fsdevel, tytso


flush request is issued in transaction commit code path, so looks using
GFP_KERNEL to allocate memory for flush request bio falls into the classic
deadlock issue.  I saw btrfs and dm get it right, but ext4, xfs and md are
using GFP_KERNEL, which makes me confused. Hoping filesystem developers
clarify.

Signed-off-by: Shaohua Li <shli@fusionio.com>
---
  fs/jbd2/commit.c |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux/fs/jbd2/commit.c
===================================================================
--- linux.orig/fs/jbd2/commit.c	2012-04-13 09:57:51.785506925 +0800
+++ linux/fs/jbd2/commit.c	2012-04-13 09:58:29.585498773 +0800
@@ -723,7 +723,7 @@ start_journal_io:
  	if (commit_transaction->t_need_data_flush &&
  	    (journal->j_fs_dev != journal->j_dev) &&
  	    (journal->j_flags & JBD2_BARRIER))
-		blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
+		blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL);

  	/* Done it all: now write the commit record asynchronously. */
  	if (JBD2_HAS_INCOMPAT_FEATURE(journal,
@@ -859,7 +859,7 @@ wait_for_iobuf:
  	if (JBD2_HAS_INCOMPAT_FEATURE(journal,
  				      JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) &&
  	    journal->j_flags & JBD2_BARRIER) {
-		blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL);
+		blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL);
  	}

  	if (err)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush
  2012-04-13  2:27 [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush Shaohua Li
@ 2012-04-15 22:44 ` Dave Chinner
  2012-04-17  9:58 ` Jan Kara
  2012-04-24  1:53 ` Ted Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2012-04-15 22:44 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-ext4, linux-fsdevel, tytso

On Fri, Apr 13, 2012 at 10:27:35AM +0800, Shaohua Li wrote:
> 
> flush request is issued in transaction commit code path, so looks using
> GFP_KERNEL to allocate memory for flush request bio falls into the classic
> deadlock issue.  I saw btrfs and dm get it right, but ext4, xfs and md are
> using GFP_KERNEL, which makes me confused. Hoping filesystem developers
> clarify.

Only one of the 5 calls XFS makes to blkdev_issue_flush() is
questionable. Probably should use GFP_NOFS by default, though, so we
don't trip over this problem...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush
  2012-04-13  2:27 [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush Shaohua Li
  2012-04-15 22:44 ` Dave Chinner
@ 2012-04-17  9:58 ` Jan Kara
  2012-04-24  1:53 ` Ted Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2012-04-17  9:58 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-ext4, linux-fsdevel, tytso

On Fri 13-04-12 10:27:35, Shaohua Li wrote:
> 
> flush request is issued in transaction commit code path, so looks using
> GFP_KERNEL to allocate memory for flush request bio falls into the classic
> deadlock issue.  I saw btrfs and dm get it right, but ext4, xfs and md are
> using GFP_KERNEL, which makes me confused. Hoping filesystem developers
> clarify.
> 
> Signed-off-by: Shaohua Li <shli@fusionio.com>
  Yeah, ext4 (jbd2) should use GFP_NOFS since we are in a kjournald and
reclaim could possibly need to start a transaction thus blocking on
kjournald. So you have my:
  Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> ---
>  fs/jbd2/commit.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux/fs/jbd2/commit.c
> ===================================================================
> --- linux.orig/fs/jbd2/commit.c	2012-04-13 09:57:51.785506925 +0800
> +++ linux/fs/jbd2/commit.c	2012-04-13 09:58:29.585498773 +0800
> @@ -723,7 +723,7 @@ start_journal_io:
>  	if (commit_transaction->t_need_data_flush &&
>  	    (journal->j_fs_dev != journal->j_dev) &&
>  	    (journal->j_flags & JBD2_BARRIER))
> -		blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
> +		blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL);
> 
>  	/* Done it all: now write the commit record asynchronously. */
>  	if (JBD2_HAS_INCOMPAT_FEATURE(journal,
> @@ -859,7 +859,7 @@ wait_for_iobuf:
>  	if (JBD2_HAS_INCOMPAT_FEATURE(journal,
>  				      JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) &&
>  	    journal->j_flags & JBD2_BARRIER) {
> -		blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL);
> +		blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL);
>  	}
> 
>  	if (err)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush
  2012-04-13  2:27 [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush Shaohua Li
  2012-04-15 22:44 ` Dave Chinner
  2012-04-17  9:58 ` Jan Kara
@ 2012-04-24  1:53 ` Ted Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Ted Ts'o @ 2012-04-24  1:53 UTC (permalink / raw)
  To: Shaohua Li; +Cc: linux-ext4, linux-fsdevel

On Fri, Apr 13, 2012 at 10:27:35AM +0800, Shaohua Li wrote:
> 
> flush request is issued in transaction commit code path, so looks using
> GFP_KERNEL to allocate memory for flush request bio falls into the classic
> deadlock issue.  I saw btrfs and dm get it right, but ext4, xfs and md are
> using GFP_KERNEL, which makes me confused. Hoping filesystem developers
> clarify.
> 
> Signed-off-by: Shaohua Li <shli@fusionio.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-24  1:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13  2:27 [RFC]jbd2: use GFP_NOFS for blkdev_issue_flush Shaohua Li
2012-04-15 22:44 ` Dave Chinner
2012-04-17  9:58 ` Jan Kara
2012-04-24  1:53 ` Ted Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.