diff options
Diffstat (limited to 'fs/btrfs')
| -rw-r--r-- | fs/btrfs/ctree.h | 13 | ||||
| -rw-r--r-- | fs/btrfs/disk-io.c | 5 | ||||
| -rw-r--r-- | fs/btrfs/extent_io.c | 3 | ||||
| -rw-r--r-- | fs/btrfs/file.c | 3 | ||||
| -rw-r--r-- | fs/btrfs/inode.c | 15 | ||||
| -rw-r--r-- | fs/btrfs/ioctl.c | 10 | ||||
| -rw-r--r-- | fs/btrfs/ordered-data.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/relocation.c | 2 | ||||
| -rw-r--r-- | fs/btrfs/send.c | 10 | ||||
| -rw-r--r-- | fs/btrfs/super.c | 49 | ||||
| -rw-r--r-- | fs/btrfs/transaction.c | 7 | ||||
| -rw-r--r-- | fs/btrfs/volumes.c | 4 |
12 files changed, 85 insertions, 38 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index c38734a07a65..0d195b507660 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -3341,10 +3341,22 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | |||
| 3341 | /* super.c */ | 3341 | /* super.c */ |
| 3342 | int btrfs_parse_options(struct btrfs_root *root, char *options); | 3342 | int btrfs_parse_options(struct btrfs_root *root, char *options); |
| 3343 | int btrfs_sync_fs(struct super_block *sb, int wait); | 3343 | int btrfs_sync_fs(struct super_block *sb, int wait); |
| 3344 | |||
| 3345 | #ifdef CONFIG_PRINTK | ||
| 3346 | __printf(2, 3) | ||
| 3344 | void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...); | 3347 | void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...); |
| 3348 | #else | ||
| 3349 | static inline __printf(2, 3) | ||
| 3350 | void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...) | ||
| 3351 | { | ||
| 3352 | } | ||
| 3353 | #endif | ||
| 3354 | |||
| 3355 | __printf(5, 6) | ||
| 3345 | void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, | 3356 | void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, |
| 3346 | unsigned int line, int errno, const char *fmt, ...); | 3357 | unsigned int line, int errno, const char *fmt, ...); |
| 3347 | 3358 | ||
| 3359 | |||
| 3348 | void __btrfs_abort_transaction(struct btrfs_trans_handle *trans, | 3360 | void __btrfs_abort_transaction(struct btrfs_trans_handle *trans, |
| 3349 | struct btrfs_root *root, const char *function, | 3361 | struct btrfs_root *root, const char *function, |
| 3350 | unsigned int line, int errno); | 3362 | unsigned int line, int errno); |
| @@ -3385,6 +3397,7 @@ do { \ | |||
| 3385 | (errno), fmt, ##args); \ | 3397 | (errno), fmt, ##args); \ |
| 3386 | } while (0) | 3398 | } while (0) |
| 3387 | 3399 | ||
| 3400 | __printf(5, 6) | ||
| 3388 | void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, | 3401 | void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function, |
| 3389 | unsigned int line, int errno, const char *fmt, ...); | 3402 | unsigned int line, int errno, const char *fmt, ...); |
| 3390 | 3403 | ||
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 29c69e60d3b0..22e98e04c2ea 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -1116,7 +1116,7 @@ void clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root, | |||
| 1116 | spin_unlock(&root->fs_info->delalloc_lock); | 1116 | spin_unlock(&root->fs_info->delalloc_lock); |
| 1117 | btrfs_panic(root->fs_info, -EOVERFLOW, | 1117 | btrfs_panic(root->fs_info, -EOVERFLOW, |
| 1118 | "Can't clear %lu bytes from " | 1118 | "Can't clear %lu bytes from " |
| 1119 | " dirty_mdatadata_bytes (%lu)", | 1119 | " dirty_mdatadata_bytes (%llu)", |
| 1120 | buf->len, | 1120 | buf->len, |
| 1121 | root->fs_info->dirty_metadata_bytes); | 1121 | root->fs_info->dirty_metadata_bytes); |
| 1122 | } | 1122 | } |
| @@ -1616,8 +1616,6 @@ static int cleaner_kthread(void *arg) | |||
| 1616 | struct btrfs_root *root = arg; | 1616 | struct btrfs_root *root = arg; |
| 1617 | 1617 | ||
| 1618 | do { | 1618 | do { |
| 1619 | vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE); | ||
| 1620 | |||
| 1621 | if (!(root->fs_info->sb->s_flags & MS_RDONLY) && | 1619 | if (!(root->fs_info->sb->s_flags & MS_RDONLY) && |
| 1622 | mutex_trylock(&root->fs_info->cleaner_mutex)) { | 1620 | mutex_trylock(&root->fs_info->cleaner_mutex)) { |
| 1623 | btrfs_run_delayed_iputs(root); | 1621 | btrfs_run_delayed_iputs(root); |
| @@ -1649,7 +1647,6 @@ static int transaction_kthread(void *arg) | |||
| 1649 | do { | 1647 | do { |
| 1650 | cannot_commit = false; | 1648 | cannot_commit = false; |
| 1651 | delay = HZ * 30; | 1649 | delay = HZ * 30; |
| 1652 | vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE); | ||
| 1653 | mutex_lock(&root->fs_info->transaction_kthread_mutex); | 1650 | mutex_lock(&root->fs_info->transaction_kthread_mutex); |
| 1654 | 1651 | ||
| 1655 | spin_lock(&root->fs_info->trans_lock); | 1652 | spin_lock(&root->fs_info->trans_lock); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 49085f2336d2..4c878476bb91 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -929,7 +929,8 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits, | |||
| 929 | 929 | ||
| 930 | 930 | ||
| 931 | /** | 931 | /** |
| 932 | * convert_extent - convert all bits in a given range from one bit to another | 932 | * convert_extent_bit - convert all bits in a given range from one bit to |
| 933 | * another | ||
| 933 | * @tree: the io tree to search | 934 | * @tree: the io tree to search |
| 934 | * @start: the start offset in bytes | 935 | * @start: the start offset in bytes |
| 935 | * @end: the end offset in bytes (inclusive) | 936 | * @end: the end offset in bytes (inclusive) |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 9aa01ec2138d..5caf285c6e4d 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
| @@ -1379,7 +1379,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
| 1379 | ssize_t err = 0; | 1379 | ssize_t err = 0; |
| 1380 | size_t count, ocount; | 1380 | size_t count, ocount; |
| 1381 | 1381 | ||
| 1382 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); | 1382 | sb_start_write(inode->i_sb); |
| 1383 | 1383 | ||
| 1384 | mutex_lock(&inode->i_mutex); | 1384 | mutex_lock(&inode->i_mutex); |
| 1385 | 1385 | ||
| @@ -1469,6 +1469,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
| 1469 | num_written = err; | 1469 | num_written = err; |
| 1470 | } | 1470 | } |
| 1471 | out: | 1471 | out: |
| 1472 | sb_end_write(inode->i_sb); | ||
| 1472 | current->backing_dev_info = NULL; | 1473 | current->backing_dev_info = NULL; |
| 1473 | return num_written ? num_written : err; | 1474 | return num_written ? num_written : err; |
| 1474 | } | 1475 | } |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 6ba80b902877..ec154f954646 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -324,7 +324,8 @@ static noinline int add_async_extent(struct async_cow *cow, | |||
| 324 | * If this code finds it can't get good compression, it puts an | 324 | * If this code finds it can't get good compression, it puts an |
| 325 | * entry onto the work queue to write the uncompressed bytes. This | 325 | * entry onto the work queue to write the uncompressed bytes. This |
| 326 | * makes sure that both compressed inodes and uncompressed inodes | 326 | * makes sure that both compressed inodes and uncompressed inodes |
| 327 | * are written in the same order that pdflush sent them down. | 327 | * are written in the same order that the flusher thread sent them |
| 328 | * down. | ||
| 328 | */ | 329 | */ |
| 329 | static noinline int compress_file_range(struct inode *inode, | 330 | static noinline int compress_file_range(struct inode *inode, |
| 330 | struct page *locked_page, | 331 | struct page *locked_page, |
| @@ -4249,7 +4250,7 @@ static void btrfs_dentry_release(struct dentry *dentry) | |||
| 4249 | } | 4250 | } |
| 4250 | 4251 | ||
| 4251 | static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, | 4252 | static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, |
| 4252 | struct nameidata *nd) | 4253 | unsigned int flags) |
| 4253 | { | 4254 | { |
| 4254 | struct dentry *ret; | 4255 | struct dentry *ret; |
| 4255 | 4256 | ||
| @@ -4903,7 +4904,7 @@ out_unlock: | |||
| 4903 | } | 4904 | } |
| 4904 | 4905 | ||
| 4905 | static int btrfs_create(struct inode *dir, struct dentry *dentry, | 4906 | static int btrfs_create(struct inode *dir, struct dentry *dentry, |
| 4906 | umode_t mode, struct nameidata *nd) | 4907 | umode_t mode, bool excl) |
| 4907 | { | 4908 | { |
| 4908 | struct btrfs_trans_handle *trans; | 4909 | struct btrfs_trans_handle *trans; |
| 4909 | struct btrfs_root *root = BTRFS_I(dir)->root; | 4910 | struct btrfs_root *root = BTRFS_I(dir)->root; |
| @@ -6631,6 +6632,7 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
| 6631 | u64 page_start; | 6632 | u64 page_start; |
| 6632 | u64 page_end; | 6633 | u64 page_end; |
| 6633 | 6634 | ||
| 6635 | sb_start_pagefault(inode->i_sb); | ||
| 6634 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); | 6636 | ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); |
| 6635 | if (!ret) { | 6637 | if (!ret) { |
| 6636 | ret = file_update_time(vma->vm_file); | 6638 | ret = file_update_time(vma->vm_file); |
| @@ -6720,12 +6722,15 @@ again: | |||
| 6720 | unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); | 6722 | unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); |
| 6721 | 6723 | ||
| 6722 | out_unlock: | 6724 | out_unlock: |
| 6723 | if (!ret) | 6725 | if (!ret) { |
| 6726 | sb_end_pagefault(inode->i_sb); | ||
| 6724 | return VM_FAULT_LOCKED; | 6727 | return VM_FAULT_LOCKED; |
| 6728 | } | ||
| 6725 | unlock_page(page); | 6729 | unlock_page(page); |
| 6726 | out: | 6730 | out: |
| 6727 | btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE); | 6731 | btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE); |
| 6728 | out_noreserve: | 6732 | out_noreserve: |
| 6733 | sb_end_pagefault(inode->i_sb); | ||
| 6729 | return ret; | 6734 | return ret; |
| 6730 | } | 6735 | } |
| 6731 | 6736 | ||
| @@ -6997,7 +7002,7 @@ void btrfs_destroy_inode(struct inode *inode) | |||
| 6997 | struct btrfs_ordered_extent *ordered; | 7002 | struct btrfs_ordered_extent *ordered; |
| 6998 | struct btrfs_root *root = BTRFS_I(inode)->root; | 7003 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 6999 | 7004 | ||
| 7000 | WARN_ON(!list_empty(&inode->i_dentry)); | 7005 | WARN_ON(!hlist_empty(&inode->i_dentry)); |
| 7001 | WARN_ON(inode->i_data.nrpages); | 7006 | WARN_ON(inode->i_data.nrpages); |
| 7002 | WARN_ON(BTRFS_I(inode)->outstanding_extents); | 7007 | WARN_ON(BTRFS_I(inode)->outstanding_extents); |
| 7003 | WARN_ON(BTRFS_I(inode)->reserved_extents); | 7008 | WARN_ON(BTRFS_I(inode)->reserved_extents); |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a1fbca0a1003..9df50fa8a078 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -195,6 +195,10 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 195 | if (!inode_owner_or_capable(inode)) | 195 | if (!inode_owner_or_capable(inode)) |
| 196 | return -EACCES; | 196 | return -EACCES; |
| 197 | 197 | ||
| 198 | ret = mnt_want_write_file(file); | ||
| 199 | if (ret) | ||
| 200 | return ret; | ||
| 201 | |||
| 198 | mutex_lock(&inode->i_mutex); | 202 | mutex_lock(&inode->i_mutex); |
| 199 | 203 | ||
| 200 | ip_oldflags = ip->flags; | 204 | ip_oldflags = ip->flags; |
| @@ -209,10 +213,6 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 209 | } | 213 | } |
| 210 | } | 214 | } |
| 211 | 215 | ||
| 212 | ret = mnt_want_write_file(file); | ||
| 213 | if (ret) | ||
| 214 | goto out_unlock; | ||
| 215 | |||
| 216 | if (flags & FS_SYNC_FL) | 216 | if (flags & FS_SYNC_FL) |
| 217 | ip->flags |= BTRFS_INODE_SYNC; | 217 | ip->flags |= BTRFS_INODE_SYNC; |
| 218 | else | 218 | else |
| @@ -275,9 +275,9 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 275 | inode->i_flags = i_oldflags; | 275 | inode->i_flags = i_oldflags; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | mnt_drop_write_file(file); | ||
| 279 | out_unlock: | 278 | out_unlock: |
| 280 | mutex_unlock(&inode->i_mutex); | 279 | mutex_unlock(&inode->i_mutex); |
| 280 | mnt_drop_write_file(file); | ||
| 281 | return ret; | 281 | return ret; |
| 282 | } | 282 | } |
| 283 | 283 | ||
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 643335a4fe3c..051c7fe551dd 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
| @@ -596,7 +596,7 @@ void btrfs_start_ordered_extent(struct inode *inode, | |||
| 596 | /* | 596 | /* |
| 597 | * pages in the range can be dirty, clean or writeback. We | 597 | * pages in the range can be dirty, clean or writeback. We |
| 598 | * start IO on any dirty ones so the wait doesn't stall waiting | 598 | * start IO on any dirty ones so the wait doesn't stall waiting |
| 599 | * for pdflush to find them | 599 | * for the flusher thread to find them |
| 600 | */ | 600 | */ |
| 601 | if (!test_bit(BTRFS_ORDERED_DIRECT, &entry->flags)) | 601 | if (!test_bit(BTRFS_ORDERED_DIRECT, &entry->flags)) |
| 602 | filemap_fdatawrite_range(inode->i_mapping, start, end); | 602 | filemap_fdatawrite_range(inode->i_mapping, start, end); |
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index c5dbd9149679..4da08652004d 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
| @@ -1241,7 +1241,7 @@ static int __must_check __add_reloc_root(struct btrfs_root *root) | |||
| 1241 | if (rb_node) { | 1241 | if (rb_node) { |
| 1242 | btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " | 1242 | btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " |
| 1243 | "for start=%llu while inserting into relocation " | 1243 | "for start=%llu while inserting into relocation " |
| 1244 | "tree\n"); | 1244 | "tree\n", node->bytenr); |
| 1245 | kfree(node); | 1245 | kfree(node); |
| 1246 | return -EEXIST; | 1246 | return -EEXIST; |
| 1247 | } | 1247 | } |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index bf232c88a0bf..fb5ffe95f869 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/posix_acl_xattr.h> | 25 | #include <linux/posix_acl_xattr.h> |
| 26 | #include <linux/radix-tree.h> | 26 | #include <linux/radix-tree.h> |
| 27 | #include <linux/crc32c.h> | 27 | #include <linux/crc32c.h> |
| 28 | #include <linux/vmalloc.h> | ||
| 28 | 29 | ||
| 29 | #include "send.h" | 30 | #include "send.h" |
| 30 | #include "backref.h" | 31 | #include "backref.h" |
| @@ -1993,7 +1994,7 @@ static int open_cur_inode_file(struct send_ctx *sctx) | |||
| 1993 | { | 1994 | { |
| 1994 | int ret = 0; | 1995 | int ret = 0; |
| 1995 | struct btrfs_key key; | 1996 | struct btrfs_key key; |
| 1996 | struct vfsmount *mnt; | 1997 | struct path path; |
| 1997 | struct inode *inode; | 1998 | struct inode *inode; |
| 1998 | struct dentry *dentry; | 1999 | struct dentry *dentry; |
| 1999 | struct file *filp; | 2000 | struct file *filp; |
| @@ -2020,10 +2021,11 @@ static int open_cur_inode_file(struct send_ctx *sctx) | |||
| 2020 | goto out; | 2021 | goto out; |
| 2021 | } | 2022 | } |
| 2022 | 2023 | ||
| 2023 | mnt = mntget(sctx->mnt); | 2024 | path.mnt = sctx->mnt; |
| 2024 | filp = dentry_open(dentry, mnt, O_RDONLY | O_LARGEFILE, current_cred()); | 2025 | path.dentry = dentry; |
| 2026 | filp = dentry_open(&path, O_RDONLY | O_LARGEFILE, current_cred()); | ||
| 2027 | dput(dentry); | ||
| 2025 | dentry = NULL; | 2028 | dentry = NULL; |
| 2026 | mnt = NULL; | ||
| 2027 | if (IS_ERR(filp)) { | 2029 | if (IS_ERR(filp)) { |
| 2028 | ret = PTR_ERR(filp); | 2030 | ret = PTR_ERR(filp); |
| 2029 | goto out; | 2031 | goto out; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 073c2368f459..83d6f9f9c220 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
| @@ -100,10 +100,6 @@ static void __save_error_info(struct btrfs_fs_info *fs_info) | |||
| 100 | fs_info->fs_state = BTRFS_SUPER_FLAG_ERROR; | 100 | fs_info->fs_state = BTRFS_SUPER_FLAG_ERROR; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | /* NOTE: | ||
| 104 | * We move write_super stuff at umount in order to avoid deadlock | ||
| 105 | * for umount hold all lock. | ||
| 106 | */ | ||
| 107 | static void save_error_info(struct btrfs_fs_info *fs_info) | 103 | static void save_error_info(struct btrfs_fs_info *fs_info) |
| 108 | { | 104 | { |
| 109 | __save_error_info(fs_info); | 105 | __save_error_info(fs_info); |
| @@ -125,6 +121,7 @@ static void btrfs_handle_error(struct btrfs_fs_info *fs_info) | |||
| 125 | } | 121 | } |
| 126 | } | 122 | } |
| 127 | 123 | ||
| 124 | #ifdef CONFIG_PRINTK | ||
| 128 | /* | 125 | /* |
| 129 | * __btrfs_std_error decodes expected errors from the caller and | 126 | * __btrfs_std_error decodes expected errors from the caller and |
| 130 | * invokes the approciate error response. | 127 | * invokes the approciate error response. |
| @@ -167,7 +164,7 @@ void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, | |||
| 167 | va_end(args); | 164 | va_end(args); |
| 168 | } | 165 | } |
| 169 | 166 | ||
| 170 | const char *logtypes[] = { | 167 | static const char * const logtypes[] = { |
| 171 | "emergency", | 168 | "emergency", |
| 172 | "alert", | 169 | "alert", |
| 173 | "critical", | 170 | "critical", |
| @@ -185,21 +182,49 @@ void btrfs_printk(struct btrfs_fs_info *fs_info, const char *fmt, ...) | |||
| 185 | struct va_format vaf; | 182 | struct va_format vaf; |
| 186 | va_list args; | 183 | va_list args; |
| 187 | const char *type = logtypes[4]; | 184 | const char *type = logtypes[4]; |
| 185 | int kern_level; | ||
| 188 | 186 | ||
| 189 | va_start(args, fmt); | 187 | va_start(args, fmt); |
| 190 | 188 | ||
| 191 | if (fmt[0] == '<' && isdigit(fmt[1]) && fmt[2] == '>') { | 189 | kern_level = printk_get_level(fmt); |
| 192 | memcpy(lvl, fmt, 3); | 190 | if (kern_level) { |
| 193 | lvl[3] = '\0'; | 191 | size_t size = printk_skip_level(fmt) - fmt; |
| 194 | fmt += 3; | 192 | memcpy(lvl, fmt, size); |
| 195 | type = logtypes[fmt[1] - '0']; | 193 | lvl[size] = '\0'; |
| 194 | fmt += size; | ||
| 195 | type = logtypes[kern_level - '0']; | ||
| 196 | } else | 196 | } else |
| 197 | *lvl = '\0'; | 197 | *lvl = '\0'; |
| 198 | 198 | ||
| 199 | vaf.fmt = fmt; | 199 | vaf.fmt = fmt; |
| 200 | vaf.va = &args; | 200 | vaf.va = &args; |
| 201 | |||
| 201 | printk("%sBTRFS %s (device %s): %pV", lvl, type, sb->s_id, &vaf); | 202 | printk("%sBTRFS %s (device %s): %pV", lvl, type, sb->s_id, &vaf); |
| 203 | |||
| 204 | va_end(args); | ||
| 205 | } | ||
| 206 | |||
| 207 | #else | ||
| 208 | |||
| 209 | void __btrfs_std_error(struct btrfs_fs_info *fs_info, const char *function, | ||
| 210 | unsigned int line, int errno, const char *fmt, ...) | ||
| 211 | { | ||
| 212 | struct super_block *sb = fs_info->sb; | ||
| 213 | |||
| 214 | /* | ||
| 215 | * Special case: if the error is EROFS, and we're already | ||
| 216 | * under MS_RDONLY, then it is safe here. | ||
| 217 | */ | ||
| 218 | if (errno == -EROFS && (sb->s_flags & MS_RDONLY)) | ||
| 219 | return; | ||
| 220 | |||
| 221 | /* Don't go through full error handling during mount */ | ||
| 222 | if (sb->s_flags & MS_BORN) { | ||
| 223 | save_error_info(fs_info); | ||
| 224 | btrfs_handle_error(fs_info); | ||
| 225 | } | ||
| 202 | } | 226 | } |
| 227 | #endif | ||
| 203 | 228 | ||
| 204 | /* | 229 | /* |
| 205 | * We only mark the transaction aborted and then set the file system read-only. | 230 | * We only mark the transaction aborted and then set the file system read-only. |
| @@ -1081,7 +1106,8 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
| 1081 | } | 1106 | } |
| 1082 | 1107 | ||
| 1083 | bdev = fs_devices->latest_bdev; | 1108 | bdev = fs_devices->latest_bdev; |
| 1084 | s = sget(fs_type, btrfs_test_super, btrfs_set_super, fs_info); | 1109 | s = sget(fs_type, btrfs_test_super, btrfs_set_super, flags | MS_NOSEC, |
| 1110 | fs_info); | ||
| 1085 | if (IS_ERR(s)) { | 1111 | if (IS_ERR(s)) { |
| 1086 | error = PTR_ERR(s); | 1112 | error = PTR_ERR(s); |
| 1087 | goto error_close_devices; | 1113 | goto error_close_devices; |
| @@ -1095,7 +1121,6 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
| 1095 | } else { | 1121 | } else { |
| 1096 | char b[BDEVNAME_SIZE]; | 1122 | char b[BDEVNAME_SIZE]; |
| 1097 | 1123 | ||
| 1098 | s->s_flags = flags | MS_NOSEC; | ||
| 1099 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); | 1124 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); |
| 1100 | btrfs_sb(s)->bdev_holder = fs_type; | 1125 | btrfs_sb(s)->bdev_holder = fs_type; |
| 1101 | error = btrfs_fill_super(s, fs_devices, data, | 1126 | error = btrfs_fill_super(s, fs_devices, data, |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 3ee8d58e97ad..27c26004e050 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -335,6 +335,8 @@ again: | |||
| 335 | if (!h) | 335 | if (!h) |
| 336 | return ERR_PTR(-ENOMEM); | 336 | return ERR_PTR(-ENOMEM); |
| 337 | 337 | ||
| 338 | sb_start_intwrite(root->fs_info->sb); | ||
| 339 | |||
| 338 | if (may_wait_transaction(root, type)) | 340 | if (may_wait_transaction(root, type)) |
| 339 | wait_current_trans(root); | 341 | wait_current_trans(root); |
| 340 | 342 | ||
| @@ -345,6 +347,7 @@ again: | |||
| 345 | } while (ret == -EBUSY); | 347 | } while (ret == -EBUSY); |
| 346 | 348 | ||
| 347 | if (ret < 0) { | 349 | if (ret < 0) { |
| 350 | sb_end_intwrite(root->fs_info->sb); | ||
| 348 | kmem_cache_free(btrfs_trans_handle_cachep, h); | 351 | kmem_cache_free(btrfs_trans_handle_cachep, h); |
| 349 | return ERR_PTR(ret); | 352 | return ERR_PTR(ret); |
| 350 | } | 353 | } |
| @@ -548,6 +551,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, | |||
| 548 | btrfs_trans_release_metadata(trans, root); | 551 | btrfs_trans_release_metadata(trans, root); |
| 549 | trans->block_rsv = NULL; | 552 | trans->block_rsv = NULL; |
| 550 | 553 | ||
| 554 | sb_end_intwrite(root->fs_info->sb); | ||
| 555 | |||
| 551 | if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) && | 556 | if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) && |
| 552 | should_end_transaction(trans, root)) { | 557 | should_end_transaction(trans, root)) { |
| 553 | trans->transaction->blocked = 1; | 558 | trans->transaction->blocked = 1; |
| @@ -1579,6 +1584,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
| 1579 | put_transaction(cur_trans); | 1584 | put_transaction(cur_trans); |
| 1580 | put_transaction(cur_trans); | 1585 | put_transaction(cur_trans); |
| 1581 | 1586 | ||
| 1587 | sb_end_intwrite(root->fs_info->sb); | ||
| 1588 | |||
| 1582 | trace_btrfs_transaction_commit(root); | 1589 | trace_btrfs_transaction_commit(root); |
| 1583 | 1590 | ||
| 1584 | btrfs_scrub_continue(root); | 1591 | btrfs_scrub_continue(root); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 3f4e70e171ed..88b969aeeb71 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -1745,10 +1745,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
| 1745 | 1745 | ||
| 1746 | device->fs_devices = root->fs_info->fs_devices; | 1746 | device->fs_devices = root->fs_info->fs_devices; |
| 1747 | 1747 | ||
| 1748 | /* | ||
| 1749 | * we don't want write_supers to jump in here with our device | ||
| 1750 | * half setup | ||
| 1751 | */ | ||
| 1752 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); | 1748 | mutex_lock(&root->fs_info->fs_devices->device_list_mutex); |
| 1753 | list_add_rcu(&device->dev_list, &root->fs_info->fs_devices->devices); | 1749 | list_add_rcu(&device->dev_list, &root->fs_info->fs_devices->devices); |
| 1754 | list_add(&device->dev_alloc_list, | 1750 | list_add(&device->dev_alloc_list, |
