aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-06-12 10:20:45 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-31 01:45:52 -0400
commitb2b5ef5c8e89f19b68c174bf246f3ca212dbf0bc (patch)
tree05bc5ec6d01f45307eed33082f9f1c288c907999 /fs/btrfs/inode.c
parent2c22b337b5bbb497c41b348b2357b7070ed5ba88 (diff)
btrfs: Convert to new freezing mechanism
We convert btrfs_file_aio_write() to use new freeze check. We also add proper freeze protection to btrfs_page_mkwrite(). We also add freeze protection to the transaction mechanism to avoid starting transactions on frozen filesystem. At minimum this is necessary to stop iput() of unlinked file to change frozen filesystem during truncation. Checks in cleaner_kthread() and transaction_kthread() can be safely removed since btrfs_freeze() will lock the mutexes and thus block the threads (and they shouldn't have anything to do anyway). CC: linux-btrfs@vger.kernel.org CC: Chris Mason <chris.mason@oracle.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fb8d671d00e6..f4d901786b3c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6620,6 +6620,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
6620 u64 page_start; 6620 u64 page_start;
6621 u64 page_end; 6621 u64 page_end;
6622 6622
6623 sb_start_pagefault(inode->i_sb);
6623 ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); 6624 ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE);
6624 if (!ret) { 6625 if (!ret) {
6625 ret = file_update_time(vma->vm_file); 6626 ret = file_update_time(vma->vm_file);
@@ -6709,12 +6710,15 @@ again:
6709 unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); 6710 unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS);
6710 6711
6711out_unlock: 6712out_unlock:
6712 if (!ret) 6713 if (!ret) {
6714 sb_end_pagefault(inode->i_sb);
6713 return VM_FAULT_LOCKED; 6715 return VM_FAULT_LOCKED;
6716 }
6714 unlock_page(page); 6717 unlock_page(page);
6715out: 6718out:
6716 btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE); 6719 btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE);
6717out_noreserve: 6720out_noreserve:
6721 sb_end_pagefault(inode->i_sb);
6718 return ret; 6722 return ret;
6719} 6723}
6720 6724