提交 99128add 编写于 作者: J Jan Kara

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: NJan Kara <jack@suse.cz>
上级 e878167a
...@@ -3209,21 +3209,20 @@ static int ext3_do_update_inode(handle_t *handle, ...@@ -3209,21 +3209,20 @@ static int ext3_do_update_inode(handle_t *handle,
* *
* We are called from a few places: * We are called from a few places:
* *
* - Within generic_file_write() for O_SYNC files. * - Within generic_file_aio_write() -> generic_write_sync() for O_SYNC files.
* Here, there will be no transaction running. We wait for any running * Here, there will be no transaction running. We wait for any running
* transaction to commit. * transaction to commit.
* *
* - Within sys_sync(), kupdate and such. * - Within flush work (for sys_sync(), kupdate and such).
* We wait on commit, if tol to. * We wait on commit, if told to.
* *
* - Within prune_icache() (PF_MEMALLOC == true) * - Within iput_final() -> write_inode_now()
* Here we simply return. We can't afford to block kswapd on the * We wait on commit, if told to.
* journal commit.
* *
* In all cases it is actually safe for us to return without doing anything, * In all cases it is actually safe for us to return without doing anything,
* because the inode has been copied into a raw inode buffer in * because the inode has been copied into a raw inode buffer in
* ext3_mark_inode_dirty(). This is a correctness thing for O_SYNC and for * ext3_mark_inode_dirty(). This is a correctness thing for WB_SYNC_ALL
* knfsd. * writeback.
* *
* Note that we are absolutely dependent upon all inode dirtiers doing the * Note that we are absolutely dependent upon all inode dirtiers doing the
* right thing: they *must* call mark_inode_dirty() after dirtying info in * right thing: they *must* call mark_inode_dirty() after dirtying info in
...@@ -3235,13 +3234,13 @@ static int ext3_do_update_inode(handle_t *handle, ...@@ -3235,13 +3234,13 @@ static int ext3_do_update_inode(handle_t *handle,
* stuff(); * stuff();
* inode->i_size = expr; * inode->i_size = expr;
* *
* is in error because a kswapd-driven write_inode() could occur while * is in error because write_inode() could occur while `stuff()' is running,
* `stuff()' is running, and the new i_size will be lost. Plus the inode * and the new i_size will be lost. Plus the inode will no longer be on the
* will no longer be on the superblock's dirty inode list. * superblock's dirty inode list.
*/ */
int ext3_write_inode(struct inode *inode, struct writeback_control *wbc) int ext3_write_inode(struct inode *inode, struct writeback_control *wbc)
{ {
if (current->flags & PF_MEMALLOC) if (WARN_ON_ONCE(current->flags & PF_MEMALLOC))
return 0; return 0;
if (ext3_journal_current_handle()) { if (ext3_journal_current_handle()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册