aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-02-28 03:09:24 -0500
committerJan Kara <jack@suse.cz>2014-03-04 06:19:25 -0500
commit99128addc964d4429d1bb9be5fa9e03ce85b1e68 (patch)
treef2c1c61aa45dd04bdd301193185420bea7c81071
parente878167af92fda03eb3a8597eec24128d4d47c43 (diff)
ext3: Update PF_MEMALLOC handling in ext3_write_inode()
The special handling of PF_MEMALLOC callers in ext3_write_inode() shouldn't be necessary as there shouldn't be any. Warn about it. Also update comment before the function as it seems somewhat outdated. Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/ext3/inode.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 491f022c476a..2fef98abb207 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -3209,21 +3209,20 @@ out_brelse:
3209 * 3209 *
3210 * We are called from a few places: 3210 * We are called from a few places:
3211 * 3211 *
3212 * - Within generic_file_write() for O_SYNC files. 3212 * - Within generic_file_aio_write() -> generic_write_sync() for O_SYNC files.
3213 * Here, there will be no transaction running. We wait for any running 3213 * Here, there will be no transaction running. We wait for any running
3214 * transaction to commit. 3214 * transaction to commit.
3215 * 3215 *
3216 * - Within sys_sync(), kupdate and such. 3216 * - Within flush work (for sys_sync(), kupdate and such).
3217 * We wait on commit, if tol to. 3217 * We wait on commit, if told to.
3218 * 3218 *
3219 * - Within prune_icache() (PF_MEMALLOC == true) 3219 * - Within iput_final() -> write_inode_now()
3220 * Here we simply return. We can't afford to block kswapd on the 3220 * We wait on commit, if told to.
3221 * journal commit.
3222 * 3221 *
3223 * In all cases it is actually safe for us to return without doing anything, 3222 * In all cases it is actually safe for us to return without doing anything,
3224 * because the inode has been copied into a raw inode buffer in 3223 * because the inode has been copied into a raw inode buffer in
3225 * ext3_mark_inode_dirty(). This is a correctness thing for O_SYNC and for 3224 * ext3_mark_inode_dirty(). This is a correctness thing for WB_SYNC_ALL
3226 * knfsd. 3225 * writeback.
3227 * 3226 *
3228 * Note that we are absolutely dependent upon all inode dirtiers doing the 3227 * Note that we are absolutely dependent upon all inode dirtiers doing the
3229 * right thing: they *must* call mark_inode_dirty() after dirtying info in 3228 * right thing: they *must* call mark_inode_dirty() after dirtying info in
@@ -3235,13 +3234,13 @@ out_brelse:
3235 * stuff(); 3234 * stuff();
3236 * inode->i_size = expr; 3235 * inode->i_size = expr;
3237 * 3236 *
3238 * is in error because a kswapd-driven write_inode() could occur while 3237 * is in error because write_inode() could occur while `stuff()' is running,
3239 * `stuff()' is running, and the new i_size will be lost. Plus the inode 3238 * and the new i_size will be lost. Plus the inode will no longer be on the
3240 * will no longer be on the superblock's dirty inode list. 3239 * superblock's dirty inode list.
3241 */ 3240 */
3242int ext3_write_inode(struct inode *inode, struct writeback_control *wbc) 3241int ext3_write_inode(struct inode *inode, struct writeback_control *wbc)
3243{ 3242{
3244 if (current->flags & PF_MEMALLOC) 3243 if (WARN_ON_ONCE(current->flags & PF_MEMALLOC))
3245 return 0; 3244 return 0;
3246 3245
3247 if (ext3_journal_current_handle()) { 3246 if (ext3_journal_current_handle()) {