diff options
author | Jan Kara <jack@suse.cz> | 2011-05-23 18:23:35 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-05-26 07:26:45 -0400 |
commit | ea13a86463fd0c26c2c209c53dc46b8eff81bad4 (patch) | |
tree | 405ca6ff2b6ca3078a1023814c1ea7525cf03797 /include/linux/buffer_head.h | |
parent | 24da4fab5a617ecbf0f0c64e7ba7703383faa411 (diff) |
vfs: Block mmapped writes while the fs is frozen
We should not allow file modification via mmap while the filesystem is
frozen. So block in block_page_mkwrite() while the filesystem is frozen.
We cannot do the blocking wait in __block_page_mkwrite() since e.g. ext4
will want to call that function with transaction started in some cases
and that would deadlock. But we can at least do the non-blocking reliable
check in __block_page_mkwrite() which is the hardest part anyway.
We have to check for frozen filesystem with the page marked dirty and under
page lock with which we then return from ->page_mkwrite(). Only that way we
cannot race with writeback done by freezing code - either we mark the page
dirty after the writeback has started, see freezing in progress and block, or
writeback will wait for our page lock which is released only when the fault is
done and then writeback will writeout and writeprotect the page again.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/buffer_head.h')
-rw-r--r-- | include/linux/buffer_head.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 2bf6a9136a94..503c8a6b3079 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -230,6 +230,8 @@ static inline int block_page_mkwrite_return(int err) | |||
230 | return VM_FAULT_NOPAGE; | 230 | return VM_FAULT_NOPAGE; |
231 | if (err == -ENOMEM) | 231 | if (err == -ENOMEM) |
232 | return VM_FAULT_OOM; | 232 | return VM_FAULT_OOM; |
233 | if (err == -EAGAIN) | ||
234 | return VM_FAULT_RETRY; | ||
233 | /* -ENOSPC, -EDQUOT, -EIO ... */ | 235 | /* -ENOSPC, -EDQUOT, -EIO ... */ |
234 | return VM_FAULT_SIGBUS; | 236 | return VM_FAULT_SIGBUS; |
235 | } | 237 | } |