Fix up tracepoints and add signed off by for btrfs patches
[ext4-patch-queue.git] / forbid-journal_async_commit-in-data-ordered-mode
blob5bf5f217837a1509b11e37a76a51d215068c3ff1
1 ext4: forbid journal_async_commit in data=ordered mode
3 From: Jan Kara <jack@suse.cz>
5 Option journal_async_commit breaks gurantees of data=ordered mode as it
6 sends only a single cache flush after writing a transaction commit
7 block. Thus even though the transaction including the commit block is
8 fully stored on persistent storage, file data may still linger in drives
9 caches and will be lost on power failure. Since all checksums match on
10 journal recovery, we replay the transaction thus possibly exposing stale
11 user data.
13 To fix this data exposure issue, remove the possibility to use
14 journal_async_commit in data=ordered mode.
16 Signed-off-by: Jan Kara <jack@suse.cz>
17 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
18 ---
19  fs/ext4/super.c | 6 ++++++
20  1 file changed, 6 insertions(+)
22 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
23 index b53c243a142b..c62445cb01ca 100644
24 --- a/fs/ext4/super.c
25 +++ b/fs/ext4/super.c
26 @@ -1701,6 +1701,12 @@ static int parse_options(char *options, struct super_block *sb,
27                         return 0;
28                 }
29         }
30 +       if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA &&
31 +           test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
32 +               ext4_msg(sb, KERN_ERR, "can't mount with journal_async_commit "
33 +                        "in data=ordered mode");
34 +               return 0;
35 +       }
36         return 1;
37  }