Update crypto patches
[ext4-patch-queue.git] / prevent-fs-reentrant-deadlock-for-inline-data
blob8e2d4861054a4b840bc420e6ea5f7c50b9a8c895
1 ext4: prevent fsreentrance deadlock for inline_data
3 From: Dmitry Monakhov <dmonakhov@openvz.org>
5 ext4_da_convert_inline_data_to_extent() invokes
6 grab_cache_page_write_begin().  grab_cache_page_write_begin performs
7 memory allocation, so fs-reentrance should be prohibited because we
8 are inside journal transaction.
10 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 ---
13  fs/ext4/inline.c | 11 ++++++-----
14  1 file changed, 6 insertions(+), 5 deletions(-)
16 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
17 index 3ea6269..efdcede 100644
18 --- a/fs/ext4/inline.c
19 +++ b/fs/ext4/inline.c
20 @@ -870,6 +870,12 @@ retry_journal:
21                         goto out_journal;
22         }
24 +       /*
25 +        * We cannot recurse into the filesystem as the transaction
26 +        * is already started.
27 +        */
28 +       flags |= AOP_FLAG_NOFS;
30         if (ret == -ENOSPC) {
31                 ret = ext4_da_convert_inline_data_to_extent(mapping,
32                                                             inode,
33 @@ -882,11 +888,6 @@ retry_journal:
34                 goto out;
35         }
37 -       /*
38 -        * We cannot recurse into the filesystem as the transaction
39 -        * is already started.
40 -        */
41 -       flags |= AOP_FLAG_NOFS;
43         page = grab_cache_page_write_begin(mapping, 0, flags);
44         if (!page) {