Browse Source

ext4: prevent fsreentrance deadlock for inline_data

ext4_da_convert_inline_data_to_extent() invokes
grab_cache_page_write_begin().  grab_cache_page_write_begin performs
memory allocation, so fs-reentrance should be prohibited because we
are inside journal transaction.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Dmitry Monakhov 10 years ago
parent
commit
5cc28a9eaa
1 changed files with 6 additions and 5 deletions
  1. 6 5
      fs/ext4/inline.c

+ 6 - 5
fs/ext4/inline.c

@@ -870,6 +870,12 @@ retry_journal:
 			goto out_journal;
 			goto out_journal;
 	}
 	}
 
 
+	/*
+	 * We cannot recurse into the filesystem as the transaction
+	 * is already started.
+	 */
+	flags |= AOP_FLAG_NOFS;
+
 	if (ret == -ENOSPC) {
 	if (ret == -ENOSPC) {
 		ret = ext4_da_convert_inline_data_to_extent(mapping,
 		ret = ext4_da_convert_inline_data_to_extent(mapping,
 							    inode,
 							    inode,
@@ -882,11 +888,6 @@ retry_journal:
 		goto out;
 		goto out;
 	}
 	}
 
 
-	/*
-	 * We cannot recurse into the filesystem as the transaction
-	 * is already started.
-	 */
-	flags |= AOP_FLAG_NOFS;
 
 
 	page = grab_cache_page_write_begin(mapping, 0, flags);
 	page = grab_cache_page_write_begin(mapping, 0, flags);
 	if (!page) {
 	if (!page) {