]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ext4: fix a race in the ext4 shutdown path
authorHarshad Shirwadkar <harshads@google.com>
Wed, 10 Jan 2018 05:13:13 +0000 (00:13 -0500)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 23 Feb 2018 14:27:19 +0000 (08:27 -0600)
commit85aa3e35cf468d0c8711431c6468633f9de71dbd
treef3df0ad425e0c5cb5644a5d38d70678a7919bf21
parent1980a53c46af24350d591432a9c56f7230145434
ext4: fix a race in the ext4 shutdown path

BugLink: http://bugs.launchpad.net/bugs/1751131
commit abbc3f9395c76d554a9ed27d4b1ebfb5d9b0e4ca upstream.

This patch fixes a race between the shutdown path and bio completion
handling. In the ext4 direct io path with async io, after submitting a
bio to the block layer, if journal starting fails,
ext4_direct_IO_write() would bail out pretending that the IO
failed. The caller would have had no way of knowing whether or not the
IO was successfully submitted. So instead, we return -EIOCBQUEUED in
this case. Now, the caller knows that the IO was submitted.  The bio
completion handler takes care of the error.

Tested: Ran the shutdown xfstest test 461 in loop for over 2 hours across
4 machines resulting in over 400 runs. Verified that the race didn't
occur. Usually the race was seen in about 20-30 iterations.

Signed-off-by: Harshad Shirwadkar <harshads@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/ext4/inode.c