Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jbd2: use GFP_NOFS for blkdev_issue_flush

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.

Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org

authored by

Shaohua Li and committed by
Theodore Ts'o
99aa7846 57f73c2c

+2 -2
+2 -2
fs/jbd2/commit.c
··· 723 723 if (commit_transaction->t_need_data_flush && 724 724 (journal->j_fs_dev != journal->j_dev) && 725 725 (journal->j_flags & JBD2_BARRIER)) 726 - blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); 726 + blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL); 727 727 728 728 /* Done it all: now write the commit record asynchronously. */ 729 729 if (JBD2_HAS_INCOMPAT_FEATURE(journal, ··· 859 859 if (JBD2_HAS_INCOMPAT_FEATURE(journal, 860 860 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) && 861 861 journal->j_flags & JBD2_BARRIER) { 862 - blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL); 862 + blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL); 863 863 } 864 864 865 865 if (err)