ext4 crypto: don't let data integrity writebacks fail with ENOMEM
authorTheodore Ts'o <tytso@mit.edu>
Sat, 26 Mar 2016 20:14:34 +0000 (16:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 May 2017 12:30:11 +0000 (14:30 +0200)
commit0a76f023e6f2073936cc87ff839b2aaeccc4fb9a
tree7d200a57c93a0536d3d593255c0690856902cc69
parentf0486aa7bc805639d6c8a861e2d82eca02be39b7
ext4 crypto: don't let data integrity writebacks fail with ENOMEM

commit c9af28fdd44922a6c10c9f8315718408af98e315 upstream.

We don't want the writeback triggered from the journal commit (in
data=writeback mode) to cause the journal to abort due to
generic_writepages() returning an ENOMEM error.  In addition, if
fsync() fails with ENOMEM, most applications will probably not do the
right thing.

So if we are doing a data integrity sync, and ext4_encrypt() returns
ENOMEM, we will submit any queued I/O to date, and then retry the
allocation using GFP_NOFAIL.

Google-Bug-Id: 27641567

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/crypto.c
fs/ext4/ext4.h
fs/ext4/page-io.c
fs/ext4/readpage.c