ext4: prevent data corruption with journaling + DAX
authorRoss Zwisler <ross.zwisler@linux.intel.com>
Thu, 12 Oct 2017 15:54:08 +0000 (11:54 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:48 +0000 (08:40 +0000)
commit22e5190899e8d159fe59e0c0e3b9a1085ee5d4e8
tree0e174ce26069b757d2640ba7e76fc602c0670279
parent713cb65003f1d1038d211606871b12ff555fb3f3
ext4: prevent data corruption with journaling + DAX

commit e9072d859df3e0f2c3ba450f0d1739595c2d5d13 upstream.

The current code has the potential for data corruption when changing an
inode's journaling mode, as that can result in a subsequent unsafe change
in S_DAX.

I've captured an instance of this data corruption in the following fstest:

https://patchwork.kernel.org/patch/9948377/

Prevent this data corruption from happening by disallowing changes to the
journaling mode if the '-o dax' mount option was used.  This means that for
a given filesystem we could have a mix of inodes using either DAX or
data journaling, but whatever state the inodes are in will be held for the
duration of the mount.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inode.c
fs/ext4/ioctl.c