id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
8aef7e8f8de2d900da892085edbf14ea35fe6881
Analyze and fix the following issue in the Linux kernel code: bq27x00_battery: use unaligned access helper
Problem Details: Remove hand-rolled get_unaligned_be16, this points to a possible bug as bq27x00_read does another endian byteswap which sparse notices: drivers/power/bq27x00_battery.c:81:14: warning: cast to restricted __be16 Which should probably be checked. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com...
```diff diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index 62d4948e8206..0c056fcc01ce 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c @@ -23,8 +23,8 @@ #include <linux/platform_device.h> #include <linux/power_supply.h> #include <linux/idr.h> - #in...
6a9037887ccea92152b034edeb15d453d1a98555
Analyze and fix the following issue in the Linux kernel code: power_supply: fix dependency of tosa_battery
Problem Details: tosa_battery should also depend on wm97xx_ts as it uses dac-accessing functions from that module. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
```diff diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index b2bd104b9869..ae095a498db4 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -51,7 +51,7 @@ config BATTERY_OLPC config BATTERY_TOSA tristate "Sharp SL-6000 (tosa) battery" - depends on MACH_TOSA && MFD_TC6393XB + depends on MA...
6ef190cc92e33565accff6a320f0e7d90480bfe7
Analyze and fix the following issue in the Linux kernel code: IPoIB: Fix crash when path record fails after path flush
Problem Details: Commit ee1e2c82 ("IPoIB: Refresh paths instead of flushing them on SM change events") changed how paths are flushed on an SM event. This change introduces a problem if the path record query triggered by fails, causing path->ah to become NULL. A later successful path query will then trigger WARN_ON() ...
```diff diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 1b1df5cc4113..e9ca3cb57d52 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -404,7 +404,7 @@ static void path_rec_completion(int status, struct net_...
c9da4bad5b80c3d9884e2c6ad8d2091252c32d5e
Analyze and fix the following issue in the Linux kernel code: IPoIB: Fix crash when path record fails after path flush
Problem Details: Commit ee1e2c82 ("IPoIB: Refresh paths instead of flushing them on SM change events") changed how paths are flushed on an SM event. This change introduces a problem if the path record query triggered by fails, causing path->ah to become NULL. A later successful path query will then trigger WARN_ON() ...
```diff diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 1b1df5cc4113..e9ca3cb57d52 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -404,7 +404,7 @@ static void path_rec_completion(int status, struct net_...
7c6db4e050601f359081fde418ca6dc4fc2d0011
Analyze and fix the following issue in the Linux kernel code: ACPI: EC: do transaction from interrupt context
Problem Details: It is easier and faster to do transaction directly from interrupt context rather than waking control thread. Also, cleaner GPE storm avoidance is implemented. References: http://bugzilla.kernel.org/show_bug.cgi?id=9998 http://bugzilla.kernel.org/show_bug.cgi?id=10724 http://bugzilla.kernel.org/sho...
```diff diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 13593f9f2197..7f0d81c0ec99 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1,7 +1,7 @@ /* - * ec.c - ACPI Embedded Controller Driver (v2.0) + * ec.c - ACPI Embedded Controller Driver (v2.1) * - * Copyright (C) 2006, 2007 Alexey Starikovsk...
ef40a685311bef053dedd833a72dffaf25669dda
Analyze and fix the following issue in the Linux kernel code: Revert "ehea: fix mutex and spinlock use"
Problem Details: This reverts commit 2eefbd63d0c85daa1317636474c226e236beba81. On request by driver author and Jeff Garzik. Signed-off-by: David S. Miller <davem@davemloft.net>
```diff diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index c765ec609462..b70c5314f537 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c @@ -219,11 +219,9 @@ static void ehea_update_firmware_handles(void) } out_update: - mutex_lock(&ehea_fw_handles.lock); kfr...
4434c33c7f233a7ee5dcaf357fbf795818ea8861
Analyze and fix the following issue in the Linux kernel code: Btrfs: fix sleep with spinlock held during unmount
Problem Details: The code to free block groups needs to drop the space info spin lock before calling btrfs_remove_free_space_cache (which can schedule). This is safe because at unmount time, nobody else is going to play with the block groups. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5258923d621f..fe4e11b31a43 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3157,9 +3157,13 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info) block_group = rb_entry(n, struct btrfs_block_group_cache, c...
9b49c9b9f93e148815f2544d0c91f43b6d72eea9
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix allocation completions in tree log replay
Problem Details: After a crash, the tree log code uses btrfs_alloc_logged_extent to record allocations of data extents that it finds in the log tree. These come in basically random order, which does not fit how btrfs_remove_free_space() expects to be called. btrfs_remove_free_space was changed to support recording an...
```diff diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 01c26e8ae555..f1d9b6bc23ba 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -306,11 +306,45 @@ int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group, ret = link_free_space(block_group...
24e8fc498e9618338854bfbcf8d1d737e0bf1775
Analyze and fix the following issue in the Linux kernel code: ALSA: remove unneeded power_mutex lock in snd_pcm_drop
Problem Details: The power_mutex lock in snd_pcm_drop may cause a possible deadlock chain, and above all, it's unneeded. Let's get rid of it. Signed-off-by: Takashi Iwai <tiwai@suse.de>
```diff diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index c49b9d9e303c..c487025d3457 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream) card = substream->pcm->card; if (runtime->status->state ==...
34353029534a08e41cfb8be647d734b9ce9ebff8
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix race against disk_i_size updates
Problem Details: The code to update the on disk i_size happens before the ordered_extent record is removed. So, it is possible for multiple ordered_extent completion routines to run at the same time, and to find each other in the ordered tree. The end result is they both decide not to update disk_i_size, leaving it t...
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2e7d82ec5d18..adb169d739ce 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -608,9 +608,11 @@ nocow: add_pending_csums(trans, inode, ordered_extent->file_offset, &ordered_extent->list); + mutex_lock(&BTRFS_I(inode)->extent_mutex); btrfs_o...
ef8bbdfe7e12dc9b4e80756f6d606c4639c65851
Analyze and fix the following issue in the Linux kernel code: Btrfs: fix cache_block_group error handling
Problem Details: cache block group had a few bugs in the error handling code, this makes sure paths get properly released and the correct return value goes out. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index c0bb6b9ac4c6..1c10ffc837c8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -66,7 +66,7 @@ static int cache_block_group(struct btrfs_root *root, struct btrfs_block_group_cache *block_group) { struct btrfs_path *pat...
f25956cc582f5954033cca3f9488c0a5d5193541
Analyze and fix the following issue in the Linux kernel code: Fix leaf overflow check in btrfs_insert_empty_items
Problem Details: It was incorrectly adding an extra sizeof(struct btrfs_item) and causing false positives (oops) Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index ab07557bac07..18e84472abb5 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2737,8 +2737,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans, nritems = btrfs_header_nritems(leaf); data_end = leaf_data_end(root, leaf); - if (btrf...
23a07867b78ee0f33b01466e52bb608c336b26ee
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix mismerge in block header checks
Problem Details: I had incorrectly disabled the check for the block number being correct in the header block. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 57fbf107e59f..f6f7821d43a5 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -346,7 +346,7 @@ int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); found_start =...
9623f9a3894ec95fe140ee5460bb840ac53bc6a0
Analyze and fix the following issue in the Linux kernel code: Btrfs: Disable the dir fsync optimization to skip logging the dir sometimes
Problem Details: More testing has turned up a bug, disable this for now. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index bfa710800963..56de3fb2d8d5 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -2686,8 +2686,7 @@ next_slot: ins_nr = 0; } WARN_ON(ins_nr); - if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode) && - BTRFS_I(inode)->log_dirty...
98509cfc5a6857bddcfe4b19a9539726655ec9bd
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix releasepage to properly keep dirty and writeback pages
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 42bf99168056..ecb74b720262 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -346,7 +346,7 @@ int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); found_start =...
4bef084857ab8fe71cf49eae349c25e440a49150
Analyze and fix the following issue in the Linux kernel code: Btrfs: Tree logging fixes
Problem Details: * Pin down data blocks to prevent them from being reallocated like so: trans 1: allocate file extent trans 2: free file extent trans 3: free file extent during old snapshot deletion trans 3: allocate file extent to new file trans 3: fsync new file Before the tree logging code, this was legal because ...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a4373db5967a..42bf99168056 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -307,9 +307,7 @@ int csum_dirty_buffer(struct btrfs_root *root, struct page *page) goto err; } found_level = btrfs_header_level(eb); - spin_lock(&root->fs_info...
6527cdbe68a27a2ee745f36d001aa32d0f46f370
Analyze and fix the following issue in the Linux kernel code: Btrfs: Update find free objectid function for orphan cleanup code
Problem Details: Orphan items use BTRFS_ORPHAN_OBJECTID (-5UUL) as key objectid. This affects the find free objectid functions, inode objectid can easily overflow after orphan file cleanup. --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 754c738ec2e8..2ed6918f32e5 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -82,9 +82,10 @@ struct btrfs_ordered_sum; #define BTRFS_TREE_LOG_FIXUP_OBJECTID -7ULL /* - * All files have objectids higher than this. + * All files have objectids in th...
b214107eda845f9a5851ae198f5b972e0dc30c45
Analyze and fix the following issue in the Linux kernel code: Btrfs: trivial sparse fixes
Problem Details: Fix a bunch of trivial sparse complaints. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 6cd4e929bd4d..ab07557bac07 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2749,7 +2749,6 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans, BUG_ON(slot < 0); if (slot != nritems) { - int i; unsigned int old_data = btrfs_it...
95819c05732c511338b43c115ffbcee978c02888
Analyze and fix the following issue in the Linux kernel code: Btrfs: optimize btrget/set/removexattr
Problem Details: btrfs actually stores the whole xattr name, including the prefix ondisk, so using the generic resolver that strips off the prefix is not very helpful. Instead do the real ondisk xattrs manually and only use the generic resolver for synthetic xattrs like ACLs. (Sorry Josef for guiding you towards the ...
```diff diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2f865311460c..867eaf1f8efb 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -42,17 +42,18 @@ static void btrfs_update_cached_acl(struct inode *inode, static struct posix_acl *btrfs_get_acl(struct inode *inode, int type) { - int size, name_index; + int si...
639cb58675ce9b507eed9c3d6b3335488079b21a
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix variable init during csum creation
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index f861bd506928..6dbe88b9d7d4 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -325,6 +325,7 @@ again: item = btrfs_lookup_csum(trans, root, path, objectid, offset, 1); if (!IS_ERR(item)) { leaf = path->nodes[0]; + ret = 0; go...
d54a83901055bb0bffca64fa09fce4d897274870
Analyze and fix the following issue in the Linux kernel code: Clean up btrfs_get_parent() a little more, fix a free-after-free bug
Problem Details: Date: Tue, 19 Aug 2008 22:33:04 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 36cbc6872fd0..292b0b24c302 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -165,23 +165,32 @@ static struct dentry *btrfs_get_parent(struct dentry *child) key.offset = (u64)-1; ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); + if (r...
2d4d9fbd6efa858dfa009518fca1ab85a73fd848
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix NFS exporting of subvol roots.
Problem Details: Date: Tue, 19 Aug 2008 22:20:17 +0100 btrfs_lookup_fs_root() only finds subvol roots which have already been seen and put into the cache. For btrfs_get_dentry() we actually have to go to the medium -- so use btrfs_read_fs_root_no_name() instead. In btrfs_get_parent(), notice when we've hit the root of...
```diff diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index a913b9befe68..36cbc6872fd0 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -71,11 +71,18 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, struct dentry *result; struct btrfs_key key; + key.objectid = root_obj...
87acb4ef9b2991e1c453b78d71bce2ef994ef1ff
Analyze and fix the following issue in the Linux kernel code: Simplify btrfs_get_parent(), fix use-after-free bug
Problem Details: Date: Mon, 18 Aug 2008 22:50:22 +0100 Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 797b4cbc3786..a913b9befe68 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -147,7 +147,6 @@ static struct dentry *btrfs_get_parent(struct dentry *child) struct btrfs_key key; struct btrfs_path *path; struct extent_buffer *leaf; - u32 nrite...
be6e8dc0ba84029997075a1ec77b4ddb863cbe15
Analyze and fix the following issue in the Linux kernel code: NFS support for btrfs - v3
Problem Details: Date: Mon, 21 Jul 2008 02:01:56 +0530 Here's an implementation of NFS support for btrfs. It relies on the fixes which are going in to 2.6.28 for the NFS readdir/lookup deadlock. This uses the btrfs_iget helper introduced previously. [dwmw2: Tidy up a little, switch to d_obtain_alias() w/compat routin...
```diff diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile index a4b38177abdb..75f8818cbfee 100644 --- a/fs/btrfs/Makefile +++ b/fs/btrfs/Makefile @@ -7,7 +7,7 @@ btrfs-y := super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \ transaction.o bit-radix.o inode.o file.o tree-defrag.o \ extent_map....
7c2fe32a238eb12422beca5cbd5194a594baa559
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix add_extent_mapping to check for duplicates across the whole range
Problem Details: add_extent_mapping was allowing the insertion of overlapping extents. This never used to happen because it only inserted the extents from disk and those were never overlapping. But, with the data=ordered code, the disk and memory representations of the file are not the same. add_extent_mapping needs ...
```diff diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 954b047639ab..78ced11d18c7 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -207,7 +207,14 @@ int add_extent_mapping(struct extent_map_tree *tree, int ret = 0; struct extent_map *merge = NULL; struct rb_node *rb; + struct ex...
5036f53868ae943704ae69a192d21225dc914c35
Analyze and fix the following issue in the Linux kernel code: Btrfs: fix RHEL test for ClearPageFsMisc
Problem Details: Newer RHEL5 kernels define both ClearPageFSMisc and ClearPageChecked, so test for both before redefining. Signed-off-by: Eric Sandeen <sandeen@redhat.com> --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index f90e5a7ac161..c88f1e16ce2d 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1648,7 +1648,7 @@ int btrfs_csum_truncate(struct btrfs_trans_handle *trans, /* inode.c */ /* RHEL and EL kernels have a patch that renames PG_checked to FsMisc */ -#ifde...
7ea394f1192bee1af67ea4762c88ef4b7b0487a8
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix nodatacow for the new data=ordered mode
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 116aee21bf77..f90e5a7ac161 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1403,7 +1403,8 @@ static inline struct dentry *fdentry(struct file *file) { } /* extent-tree.c */ -int btrfs_cross_ref_exists(struct btrfs_root *root, +int btrfs_cross_r...
7d2b4daa67379960477568abda62b8ba9ee3a8aa
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix the multi-bio code to save the original bio for completion
Problem Details: The multi-bio code is responsible for duplicating blocks in raid1 and single spindle duplication. It has counters to make sure all of the locations for a given extent are properly written before io completion is returned to the higher layers. But, it didn't always complete the same bio it was given, ...
```diff diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0de51e37e789..09311b3066df 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2070,6 +2070,7 @@ static int end_bio_multi_stripe(struct bio *bio, #endif { struct btrfs_multi_bio *multi = bio->bi_private; + int is_orig_bio = 0; #if LINUX_...
b48652c101cce7a54379a49cc0cf854cec2c94e2
Analyze and fix the following issue in the Linux kernel code: Btrfs: Various small fixes.
Problem Details: This trivial patch contains two locking fixes and a off by one fix. --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 676e4bd65c52..db200e6baf7e 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -548,7 +548,7 @@ int btrfs_ordered_update_i_size(struct inode *inode, */ test = rb_entry(node, struct btrfs_ordered_extent, rb_node); if...
d7a029a89ef370e74b63f18b81498d90d1ee3cc1
Analyze and fix the following issue in the Linux kernel code: Btrfs: Don't corrupt ram in shrink_extent_tree, leak it instead
Problem Details: Far from the perfect fix, but these structs are small. TODO for the next release. The block group cache structs are referenced in many different places, and it isn't safe to just free them while resizing. A real fix will be a larger change to the allocator so that it doesn't have to carry about the ...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 1aeb695078b9..dbde12881244 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3437,8 +3437,10 @@ next: key.objectid, key.objectid + key.offset - 1, (unsigned int)-1, GFP_NOFS); + /* memset(shrink_block_group, ...
9ca9ee09c176a814189063c8b88f75c8f8e4ad19
Analyze and fix the following issue in the Linux kernel code: Btrfs: fix ioctl-initiated transactions vs wait_current_trans()
Problem Details: Commit 597:466b27332893 (btrfs_start_transaction: wait for commits in progress) breaks the transaction start/stop ioctls by making btrfs_start_transaction conditionally wait for the next transaction to start. If an application artificially is holding a transaction open, things deadlock. This workarou...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 9b025960bbde..62499dd761b7 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -518,6 +518,7 @@ struct btrfs_fs_info { u64 generation; u64 last_trans_committed; + u64 open_ioctl_trans; unsigned long mount_opt; u64 max_extent; u64 max_inline;...
61b4944018449003ac5f9757f4d125dce519cf51
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix streaming read performance with checksumming on
Problem Details: Large streaming reads make for large bios, which means each entry on the list async work queues represents a large amount of data. IO congestion throttling on the device was kicking in before the async worker threads decided a single thread was busy and needed some help. The end result was that a str...
```diff diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 5fe6a0d532ed..bc2980c433ef 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c @@ -160,7 +160,7 @@ void btrfs_init_workers(struct btrfs_workers *workers, int max) INIT_LIST_HEAD(&workers->idle_list); spin_lock_init(&workers-...
33958dc6d38fb4ca7e62273855fcb2db7e616263
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix verify_parent_transid
Problem Details: It was incorrectly clearing the up to date flag on the buffer even when the buffer properly verified. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 27ffa9b7ddc8..ec1ba8ddb35f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -235,8 +235,8 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, (unsigned long long)parent_transid, (unsigned long long)btrfs_head...
f321e4910398cf7922265d269fb17fd26f312571
Analyze and fix the following issue in the Linux kernel code: Btrfs: Update and fix mount -o nodatacow
Problem Details: To check whether a given file extent is referenced by multiple snapshots, the checker walks down the fs tree through dead root and checks all tree blocks in the path. We can easily detect whether a given tree block is directly referenced by other snapshot. We can also detect any indirect reference fro...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 5517dfc6f71c..83422088c629 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -617,7 +617,7 @@ struct btrfs_leaf_ref_tree { * in ram representation of the tree. extent_root is used for all allocations * and for the extent tree extent_root root. ...
3bf10418675cb424724b5cb9d7725b234defe1fd
Analyze and fix the following issue in the Linux kernel code: Btrfs: async-thread: fix possible memory leak
Problem Details: When kthread_run() returns failure, this worker hasn't been added to the list, so btrfs_stop_workers() won't free it. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index 8d4cc4679d51..5fe6a0d532ed 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c @@ -187,6 +187,7 @@ int btrfs_start_workers(struct btrfs_workers *workers, int num_workers) worker->task = kthread_run(worker_loop, worker, "btrfs...
1a3f5d0400d786aec41ede15fec5710ad1a1d18b
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix version.sh when used outside of an hg repo
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/version.sh b/fs/btrfs/version.sh index fd9b53d39860..4d06497d2ec5 100644 --- a/fs/btrfs/version.sh +++ b/fs/btrfs/version.sh @@ -6,10 +6,10 @@ # Copyright 2008, Oracle # Released under the GNU GPLv2 -v="Btrfs v0.15" +v="v0.15" which hg > /dev/null -if [ $? == 0 ]; then +if [ -d .hg...
9652480bf48500885a30754b4a5c436b5b34456d
Analyze and fix the following issue in the Linux kernel code: Fix path slots selection in btrfs_search_forward
Problem Details: We should decrease the found slot by one as btrfs_search_slot does when bin_search return 1 and node level > 0. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index f2a94999c371..ab4ac0365c7f 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2992,6 +2992,7 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key, struct extent_buffer *cur; struct btrfs_key found_key; int slot; + int s...
445dceb78f3445b9bcade90e93ca35cae6120172
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix .. lookup corner case
Problem Details: Inode ref item can be in the next leaf when we find "path->slots[0] == btrfs_header_nritems(...)". Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8bc981c4f5ef..cf9534b79aba 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1752,21 +1752,18 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, if (namelen == 2 && strcmp(name, "..") == 0) { struct btrfs_key key; str...
8e8a1e31f2780b7865d40a8c5142a04f2bcdcb86
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix a few functions that exit without stopping their transaction
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f92b297e7da5..e6a3ba9dd107 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3275,8 +3275,10 @@ next: ret = btrfs_search_slot(trans, root, &key, path, -1, 1); if (ret > 0) ret = -EIO; - if (ret < 0) + if (ret < 0) { + ...
3eaa2885276fd6dac7b076a793932428b7168e74
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix the defragmention code and the block relocation code for data=ordered
Problem Details: Before setting an extent to delalloc, the code needs to wait for pending ordered extents. Also, the relocation code needs to wait for ordered IO before scanning the block group again. This is because the extents are not removed until the IO for the new extents is finished Signed-off-by: Chris Mason ...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8ecac2e77a43..6675e916ebcd 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -538,6 +538,13 @@ struct btrfs_fs_info { struct list_head dead_roots; atomic_t nr_async_submits; + /* + * this is used by the balancing code to wait for all the pendin...
4881ee5a2e995c6a8999b56de70aa3834369d8ee
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix some build problems on 2.6.18 based enterprise kernels
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 90504ba7f838..8ecac2e77a43 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1595,6 +1595,14 @@ int btrfs_csum_truncate(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, u64 isize); /* inode.c */ + +/* RHEL ...
9ba4611a3a7902c6bad70c5c205de5161fcfc17b
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix 32 bit compiles by using an unsigned long byte count in the ordered extent
Problem Details: The ordered extents have to fit in memory, so an unsigned long is sufficient. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h index 36e63f1f79b3..199cb0b4f1d9 100644 --- a/fs/btrfs/ordered-data.h +++ b/fs/btrfs/ordered-data.h @@ -95,7 +95,8 @@ struct btrfs_ordered_extent { * calculates the total size you need to allocate for an ordered sum * structure spanning 'bytes' ...
f421950f86bf96a11fef932e167ab2e70d4c43a0
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix some data=ordered related data corruptions
Problem Details: Stress testing was showing data checksum errors, most of which were caused by a lookup bug in the extent_map tree. The tree was caching the last pointer returned, and searches would check the last pointer first. But, search callers also expect the search to return the very first matching extent in th...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 96ab2797c09a..f8fccdac3055 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1590,6 +1590,8 @@ int btrfs_csum_truncate(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, u64 isize); /* inode.c */ +int btrfs_w...
a61e6f29dc7c9d56a776a518eed92bbc61848263
Analyze and fix the following issue in the Linux kernel code: Btrfs: Use a mutex in the extent buffer for tree block locking
Problem Details: This replaces the use of the page cache lock bit for locking, which wasn't suitable for block size < page size and couldn't be used recursively. The mutexes alone don't fix either problem, but they are the first step. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index ccd49322f793..c51cd11de206 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1451,7 +1451,7 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, struct extent_buffer *buf; buf = btrfs_find_tre...
4a09675279674041862d2210635b0cc1f60be28e
Analyze and fix the following issue in the Linux kernel code: Btrfs: Data ordered fixes
Problem Details: * In btrfs_delete_inode, wait for ordered extents after calling truncate_inode_pages. This is much faster, and more correct * Properly clear our the PageChecked bit everywhere we redirty the page. * Change the writepage fixup handler to lock the page range and check to see if an ordered extent had b...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index be2aef1cb7ae..ccd49322f793 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -934,7 +934,6 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, if (!root->ref_cows) return 0; - mutex_lock(&root...
e5a2217ef6ff088d08a27208929a6f9c635d672c
Analyze and fix the following issue in the Linux kernel code: Fix btrfs_wait_ordered_extent_range to properly wait
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index d9c69e16d368..45127e4797c8 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -161,7 +161,8 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, while(bio_index < bio->bi_vcnt) { offset = page_offset(bvec->bv_p...
54641bd17db9fbfc13c7b1d4ee0dd2713bf3e076
Analyze and fix the following issue in the Linux kernel code: Btrfs: Force caching of metadata block groups on mount to avoid deadlock
Problem Details: This is a temporary change to avoid deadlocks until the extent tree locking is fixed up. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 4036c62b6671..be2aef1cb7ae 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -3333,6 +3333,11 @@ int btrfs_read_block_groups(struct btrfs_root *root) set_state_private(block_group_cache, found_key.objectid, (unsigned ...
a7a16fd772620605c76e8ac8bdbc8ccc9e3df1a0
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix deadlock while searching for dead roots on mount
Problem Details: btrfs_find_dead_roots called btrfs_read_fs_root_no_radix, which means we end up calling btrfs_search_slot with a path already held. The fix is to remember the key inside btrfs_find_dead_roots and drop the path. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 8bf21ba0a43b..a5c0e98b5aeb 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -154,6 +154,7 @@ int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid, struct btrfs_item *item; struct btrfs_root_item *ri; struct btrfs_key ...
3f157a2fd2ad731e1ed9964fecdc5f459f04a4a4
Analyze and fix the following issue in the Linux kernel code: Btrfs: Online btree defragmentation fixes
Problem Details: The btree defragger wasn't making forward progress because the new key wasn't being saved by the btrfs_search_forward function. This also disables the automatic btree defrag, it wasn't scaling well to huge filesystems. The auto-defrag needs to be done differently. Signed-off-by: Chris Mason <chris.m...
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 7f4cc2b88d09..0cb80f32a9c7 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -63,10 +63,9 @@ void btrfs_free_path(struct btrfs_path *p) void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p) { int i; - int keep = p->keep_locks; - i...
079899c2384023cd8efcd3806680b4f1d2abbd54
Analyze and fix the following issue in the Linux kernel code: Btrfs: Change find_extent_buffer to use TestSetPageLocked
Problem Details: This makes it possible for callers to check for extent_buffers in cache without deadlocking against any btree locks held. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a9b3a25a45b7..dc3c03c6612d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1438,7 +1438,6 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, int err = 0; if (!pending) { -#if 0 struct e...
89ce8a63d0c761fbb02089850605360f389477d8
Analyze and fix the following issue in the Linux kernel code: Add btrfs_end_transaction_throttle to force writers to wait for pending commits
Problem Details: The existing throttle mechanism was often not sufficient to prevent new writers from coming in and making a given transaction run forever. This adds an explicit wait at the end of most operations so they will allow the current transaction to close. There is no wait inside file_write, inode updates, or...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 3cc480b83819..52569b57692d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1672,24 +1672,6 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf) set_extent_buffer_dirty(&BTRFS_I(btree_inode)->io_tree, buf); } -void btrfs_throttle(...
333db94cdde9e6dfdedab9290d04d812f83e0922
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix snapshot deletion to release the alloc_mutex much more often.
Problem Details: This lowers the impact of snapshot deletion on the rest of the FS. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index fd68601b60b1..5edbcc09b3cc 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1255,7 +1255,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root lowest_level = p->lowest_level; WARN_ON(lowest_level && ins_len); WARN_ON(p...
5cd57b2cbbb06a350df2698314e4e6a80805fc2f
Analyze and fix the following issue in the Linux kernel code: Btrfs: Add a skip_locking parameter to struct path, and make various funcs honor it
Problem Details: Allocations may need to read in block groups from the extent allocation tree, which will require a tree search and take locks on the extent allocation tree. But, those locks might already be held in other places, leading to deadlocks. Since the alloc_mutex serializes everything right now, it is safe ...
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index b8f7aecf68d7..fd68601b60b1 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -64,6 +64,7 @@ void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p) { int i; int keep = p->keep_locks; + int skip = p->skip_locking; for (i = 0; i ...
168fd7d271d9d8e81ff0b03eb08c36d82670c8a9
Analyze and fix the following issue in the Linux kernel code: Fix btrfs_next_leaf to check for new items after dropping locks
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 9601241e552b..b8f7aecf68d7 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -2999,7 +2999,14 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) return ret; nritems = btrfs_header_nritems(path->nodes[0]); + /* + * by rele...
594a24eb0e7fa8413f8b443863be4b7c72bfde9f
Analyze and fix the following issue in the Linux kernel code: Fix btrfs_del_ordered_inode to allow forcing the drop during unlinks
Problem Details: This allows us to delete an unlinked inode with dirty pages from the list instead of forcing commit to write these out before deleting the inode. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 1b756fae2799..9601241e552b 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1245,7 +1245,10 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root int level; int should_reada = p->reada; int lowest_unlock = 1; + int block...
1cc127b5d1b71453091859301de4a7dd6ee96fa8
Analyze and fix the following issue in the Linux kernel code: Btrfs: Add a thread pool just for submit_bio
Problem Details: If a bio submission is after a lock holder waiting for the bio on the work queue, it is possible to deadlock. Move the bios into their own pool. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 181c81d29897..dcea9d706d9b 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -529,9 +529,13 @@ struct btrfs_fs_info { * can run with FS locks held, and the writers may be waiting for * those locks. We don't want ordering in the pending list to ...
15ada040d7cd68d7853938a92b116292cc16a2f3
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix mount -o max_inline=0
Problem Details: max_inline=0 used to force the max_inline size to one sector instead. Now it properly disables inline data items, while still being able to read any that happen to exist on disk. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 346932e546ba..f3274befd46a 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -184,8 +184,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) info->max_inline = btrfs_parse_size(num); kfree(num); - info->max_inline = ma...
306929f364b993581c91596230807fa1c022268a
Analyze and fix the following issue in the Linux kernel code: btrfs: fix strange indentation in lookup_extent_mapping
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 268ad8facf6e..ba46f7911d99 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -231,7 +231,13 @@ struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree, { struct extent_map *em; struct rb_node *rb_node; - struct r...
6bf13c0cc833bf5ba013d6aa60379484bf48c4e6
Analyze and fix the following issue in the Linux kernel code: Btrfs: transaction ioctls
Problem Details: These ioctls let a user application hold a transaction open while it performs a series of operations. A final ioctl does a sync on the fs (closing the current transaction). This is the main requirement for Ceph's OSD to be able to keep the data it's storing in a btrfs volume consistent, and AFAICS it...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index ad4eacca7f59..1dcf4fb5b688 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1575,6 +1575,7 @@ struct inode *btrfs_alloc_inode(struct super_block *sb); void btrfs_destroy_inode(struct inode *inode); int btrfs_init_cachep(void); void btrfs_destroy_...
48ec2cf8738b0db53dc8361026cb7a328f7ad386
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix race in running_transaction checks
Problem Details: When a new transaction was started, the code would incorrectly set the pointer in fs_info before all the data structures were setup. fsync heavy workloads hit races on the setup of the ordered inode spinlock Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 57746c11eae3..1cb084efd6ed 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -56,7 +56,6 @@ static noinline int join_transaction(struct btrfs_root *root) total_trans++; BUG_ON(!cur_trans); root->fs_info->generation++; ...
e1b81e6761bd8419146d4bbe0aadd8b2d348a01c
Analyze and fix the following issue in the Linux kernel code: btrfs delete ordered inode handling fix
Problem Details: Use btrfs_release_file instead of a put_inode call Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index d968900c6973..c4fa4664a456 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -978,6 +978,12 @@ out_nolock: return num_written ? num_written : err; } +static int btrfs_release_file (struct inode * inode, struct file * filp) +{ + btrfs_del_ordered_inod...
0ef3e66b6700eb8f052daa8b89443ff872fbbdfc
Analyze and fix the following issue in the Linux kernel code: Btrfs: Allocator fix variety pack
Problem Details: * Force chunk allocation when find_free_extent has to do a full scan * Record the max key at the start of defrag so it doesn't run forever * Block groups might not be contiguous, make a forward search for the next block group in extent-tree.c * Get rid of extra checks for total fs size * Fix relocate...
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 02e571e6ee62..1d404bde3cfa 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -363,7 +363,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, other = btrfs_node_blockptr(parent, i - 1); close = close_blocks(blocknr, other, blocksize);...
211c17f51f46dc6c308c742098273dd46b5ca59c
Analyze and fix the following issue in the Linux kernel code: Fix corners in writepage and btrfs_truncate_page
Problem Details: The extent_io writepage calls needed an extra check for discarding pages that started on th last byte in the file. btrfs_truncate_page needed checks to make sure the page was still part of the file after reading it, and most importantly, needed to wait for all IO to the page to finish before freeing t...
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 2a3624adc0cf..17c508a941eb 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1988,9 +1988,12 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, u64 nr_delalloc; u64 delalloc_end; + WARN_ON(!Page...
a0af469b58944f6e8c5c8ecbebb42997baf0cb9e
Analyze and fix the following issue in the Linux kernel code: Fix btrfs_open_devices to deal with changes since the scan ioctls
Problem Details: Devices can change after the scan ioctls are done, and btrfs_open_devices needs to be able to verify them as they are opened and used by the FS. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 38b0d9ecda6a..264f297260f8 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1266,10 +1266,10 @@ struct btrfs_root *open_ctree(struct super_block *sb, btrfs_parse_options(options, tree_root, NULL); - if (btrfs_super_num_devices(disk_sup...
bbaf549e0c3d28399fc5abd68020d4025ae5c3a7
Analyze and fix the following issue in the Linux kernel code: Btrfs: A number of nodatacow fixes
Problem Details: Once part of a delalloc request fails the cow checks, just cow the entire range It is possible for the back references to all be from the same root, but still have snapshots against an extent. The checks are now more strict, forcing cow any time there are multiple refs against the data extent. Signe...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 30a5094fffa7..db996f0edf0b 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -731,6 +731,7 @@ u32 btrfs_count_snapshots_in_path(struct btrfs_root *root, u64 found_owner; u64 root_objectid = root->root_key.objectid; u32 to...
5d9cd9ecbf40b8bd5045a3c2f1feb35db6a12266
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix clone ioctl to not hold the path over inserts
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5204599e4309..f7beb9b0d37a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3101,7 +3101,7 @@ out: return ret; } -void dup_item_to_inode(struct btrfs_trans_handle *trans, +int dup_item_to_inode(struct btrfs_trans_handle *trans, struct...
bb8885cc0aa6b1606143d92c70762b16026016a5
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix do_sync_file_range ifdefs (2.6.22)
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index a50507f3056d..c89c3ac4b23b 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -961,7 +961,7 @@ out_nolock: if (err < 0) num_written = err; } else if (num_written > 0 && (file->f_flags & O_DIRECT)) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)...
d6bfde8765668c8687de72f7a40f52acdf4f2f19
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fixes for 2.6.18 enterprise kernels
Problem Details: 2.6.18 seems to get caught in an infinite loop when cancel_rearming_delayed_workqueue is called more than once, so this switches to cancel_delayed_work, which is arguably more correct. Also, balance_dirty_pages can run into problems with 2.6.18 based kernels because it doesn't have the per-bdi dirty l...
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e35e70165b53..fabc31b334b6 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1548,6 +1548,7 @@ int close_ctree(struct btrfs_root *root) btrfs_commit_transaction(trans, root); ret = btrfs_write_and_wait_transaction(NULL, root); BUG_ON(re...
bce4eae9864e6b6ebde5d7f05576ff0a6c3724d0
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix balance_level to free the middle block if there is room in the left one
Problem Details: balance level starts by trying to empty the middle block, and then pushes from the right to the middle. This might empty the right block and leave a small number of pointers in the middle. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 319f9f9bf8d4..29e5674b043d 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -789,7 +789,7 @@ static int balance_level(struct btrfs_trans_handle *trans, /* first, try to make some room in the middle buffer */ if (left) { orig_slot += btrfs_head...
c448acf0a057debc34507277add0fc09b1b37312
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix split_node to require more empty slots in the node as well
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 8ad8b5cc295a..ac999f0060b6 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -1485,7 +1485,7 @@ static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root ret = push_nodes_for_insert(trans, root, path, level); c = path->nodes[leve...
bcbfce8abd5f8d3f84eab60a9df1ec147f81c34f
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix the unplug_io_fn to grab a consistent copy of page->mapping
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 19c258d2c7e2..1281c393c7e6 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -936,14 +936,25 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) struct inode *inode; struct extent_map_tree *em_tree; struct extent_...
e1c4b7451e22f5b0a9fbccfa560ee7b80c35b8cd
Analyze and fix the following issue in the Linux kernel code: Fix btrfs_get_extent and get_block corner cases, and disable O_DIRECT reads
Problem Details: The generic O_DIRECT code assumes all the bios have the same bdev, which isn't true for multi-device btrfs. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 81f8b4fd069b..6e4bf029c6d4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1694,6 +1694,7 @@ extent_bio_alloc(struct block_device *bdev, u64 first_sector, int nr_vecs, } if (bio) { + bio->bi_size = 0; bio->bi_bdev = bdev; ...
a40a90a0420abd5ff86a0917facd3293ebb6a9b6
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix chunk allocation when some devices don't have enough room for stripes
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index e3ddd7fb8edd..fe5b00986d22 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -664,7 +664,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans, struct extent_map_tree *em_tree; struct map_lookup *map; struct extent_map *em; - int m...
3b951516ed703af0f6d82053937655ad69b60864
Analyze and fix the following issue in the Linux kernel code: Btrfs: Use the extent map cache to find the logical disk block during data retries
Problem Details: The data read retry code needs to find the logical disk block before it can resubmit new bios. But, finding this block isn't allowed to take the fs_mutex because that will deadlock with a number of different callers. This changes the retry code to use the extent map cache instead, but that requires t...
```diff diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 76fd5d7146e1..593011e5d455 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1747,6 +1747,7 @@ again: search_start, search_end, hint_byte, ins, trans->alloc_exclude_start, trans->alloc_exclude_...
a5eb62e345fc1818d0d8b6181463200a9e8dfe39
Analyze and fix the following issue in the Linux kernel code: Btrfs: Endianess bug fix for v0.13 with kernels
Problem Details: Fix for a endianess BUG when using btrfs v0.13 with kernels older than 2.6.23 Problem: Has of v0.13, btrfs-progs is using crc32c.c equivalent to the one found on linux-2.6.23/lib/libcrc32c.c Since crc32c_le() changed in linux-2.6.23, when running btrfs v0.13 with older kernels we have a missmatch bet...
```diff diff --git a/fs/btrfs/crc32c.h b/fs/btrfs/crc32c.h new file mode 100644 index 000000000000..a93255b4ee27 --- /dev/null +++ b/fs/btrfs/crc32c.h @@ -0,0 +1,17 @@ +#include <asm/byteorder.h> +#include <linux/crc32c.h> +#include <linux/version.h> + +/** + * implementation of crc32c_le() changed in linux-2.6.23, + *...
d18a2c447524751137a12cc8ccaf9d1e0b7fa1b3
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix allocation profile init
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 72deae63ec28..4b3b20459f6e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -506,12 +506,13 @@ struct btrfs_fs_info { u64 delalloc_bytes; u64 last_alloc; u64 last_data_alloc; - int avail_data_alloc_bits; - int avail_metadata_alloc_bits; - int a...
140dfd00ae544cdc0c9951b80ad6df61e62859e2
Analyze and fix the following issue in the Linux kernel code: btrfs-progs: Stop stomping on 'name' input parameter
Problem Details: In btrfs_name_hash, Local variable 'buf' is declared as __u32 buf[2]; but we then try to do this: buf[0] = 0x67452301; buf[1] = 0xefcdab89; buf[2] = 0x98badcfe; buf[3] = 0x10325476; Oops. Fix buf to be the proper size. Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Chris Mason <ch...
```diff diff --git a/fs/btrfs/hash.c b/fs/btrfs/hash.c index d5252f5c9d01..21037cfca9bd 100644 --- a/fs/btrfs/hash.c +++ b/fs/btrfs/hash.c @@ -81,7 +81,7 @@ u64 btrfs_name_hash(const char *name, int len) __u32 hash; __u32 minor_hash = 0; const char *p; - __u32 in[8], buf[2]; + __u32 in[8], buf[4]; u64 hash_r...
e58ca0203d32869a01540a293df40ddc480dc378
Analyze and fix the following issue in the Linux kernel code: Fix btrfs_fill_super to return -EINVAL when no FS found
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 709e33d08bb5..5547607681f4 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -728,9 +728,8 @@ struct btrfs_root *open_ctree(struct super_block *sb, struct btrfs_root *dev_root = kmalloc(sizeof(struct btrfs_root), GFP_NOFS); int...
2d2ae547979854d10b75d557b3abdb3eb7511bbc
Analyze and fix the following issue in the Linux kernel code: Btrfs: Add leak debugging for extent_buffer and extent_state
Problem Details: This also fixes one leak around the super block when failing to mount the FS. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 134b722587ec..1c5e097a4df2 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -915,12 +915,14 @@ fail_tree_root: free_extent_buffer(tree_root->node); fail_sb_buffer: free_extent_buffer(fs_info->sb_buffer); + extent_io_tree_empty_lru(&BTRFS...
e3fe4e7120bc753552b071773022efcff704e34b
Analyze and fix the following issue in the Linux kernel code: btrfs: fixes for kobject changes in mainline
Problem Details: Here's a patch against the unstable tree that gets the code to build against Linus's current tree (2.6.24-git12). This is needed as the kobject/kset api has changed there. I tried to make the smallest changes needed, and it builds and loads successfully, but I don't have a btrfs volume anywhere (yet)...
```diff diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index cd673ca9bb98..973d56e05698 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -184,7 +184,8 @@ static struct kobj_type btrfs_super_ktype = { .release = btrfs_super_release, }; -static struct kset btrfs_kset; +/* /sys/fs/btrfs/ entry */ +static str...
5e591a0703bc03047d37938586f97fd8ca960c08
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix looping on readdir of the subvol roots
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 913ab128eee1..3e79572a5cb1 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1465,7 +1465,10 @@ read_dir_items: di = (struct btrfs_dir_item *)((char *)di + di_len); } } - filp->f_pos = INT_LIMIT(typeof(filp->f_pos)); + if (key_type == BTRFS_...
d7fc640e6fed46932f7c74e14f9b58b8637c66cf
Analyze and fix the following issue in the Linux kernel code: Btrfs: Allocator improvements
Problem Details: Reduce CPU time searching for free blocks by optimizing find_first_extent_bit Fix find_free_extent to make better use of the last_alloc hint. Before it was often finding blocks just before the hint. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 6f0825b617d1..88e21bdbc478 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -951,7 +951,7 @@ void btrfs_throttle(struct btrfs_root *root) void btrfs_btree_balance_dirty(struct btrfs_root *root, unsigned long nr) { balance_dirty_pages_rate...
df68b8a7ad4a18c9e63f1c12015a59c3b7031adb
Analyze and fix the following issue in the Linux kernel code: Btrfs: unaligned access fixes
Problem Details: Btrfs set/get macros lose type information needed to avoid unaligned accesses on sparc64. ere is a patch for the kernel bits which fixes most of the unaligned accesses on sparc64. btrfs_name_hash is modified to return the hash value instead of getting a return location via a (potentially unaligned) po...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 52144b04f1af..086cb0525cd1 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -495,22 +495,17 @@ void btrfs_set_##name(struct extent_buffer *eb, type *s, u##bits val); #define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \ static inline u##bi...
39b5637f6f195852259004bb27b58e2dcf9fb378
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix "no csum found for inode" issue.
Problem Details: A few codes were not properly updated for changes of extent map. This may be the causes of "no csum found for inode" issue. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index fcae999ab712..9262ab37a7cd 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2417,12 +2417,13 @@ int try_release_extent_mapping(struct extent_map_tree *map, u64 end = start + PAGE_CACHE_SIZE - 1; u64 orig_start = start; int ret ...
9069218d448ea547dbad5f1cbd537e88d6519d66
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix i_blocks accounting
Problem Details: Now that delayed allocation accounting works, i_blocks accounting is changed to only modify i_blocks when extents inserted or removed. The fillattr call is changed to include the delayed allocation byte count in the i_blocks result. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 9a0647dc5a0b..9b9db9cbc019 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -36,6 +36,7 @@ struct btrfs_inode { * transid of the trans_handle that last modified this inode */ u64 last_trans; + u64 delalloc_bytes; u32...
dacb473ad81d5c1650cb73d1cb9b866202f6bab0
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix hole creation in file_write
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 7cbf8d8d7e27..184bde1cfc3d 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -265,16 +265,14 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans, set_extent_uptodate(io_tree, start_pos, end_of_last_block, GFP_NOFS); /* FI...
c2e639f02cff721172569add21ba5d058fd1a81c
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix typo in extent_io.c
Problem Details: --- Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 5d2fb527fd96..36a943e51808 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1416,7 +1416,7 @@ static int end_bio_extent_writepage(struct bio *bio, * to the correct offsets in the file */ if (state && (state->end + 1 != sta...
ae9d12853b44f4e0c06732166e8e3399ec01a680
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix delalloc account on state deletion
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 5f2fbf2054f2..5d2fb527fd96 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -396,6 +396,7 @@ static int clear_state_bit(struct extent_io_tree *tree, wake_up(&state->wq); if (delete || state->state == 0) { if (state->tree) { + ...
0181e58f91c1edbf835edb7a87d6dfe81374709d
Analyze and fix the following issue in the Linux kernel code: btrfs_drop_extent fixe for inline items > 8K
Problem Details: When truncating a inline extent, btrfs_drop_extents doesn't properly handle the case "key.offset > inline_limit". This bug can only happen when max line size is larger than 8K. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 7c10a90362ff..7cbf8d8d7e27 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -591,8 +591,7 @@ next_slot: } } bookend = 1; - if (found_inline && start <= key.offset && - inline_limit < extent_end) + if (found_inline && start <= key.o...
1b0f7c29e2f4f41e1367e7581d3a9c8c70f0394a
Analyze and fix the following issue in the Linux kernel code: Fix hole start calculation in btrfs_settar
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 515f8b01ab04..bcf3b35fb65e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1000,20 +1000,14 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; u64 mask = root->s...
5f56406aabdf5444d040c5955effc665b1d0dbaf
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix hole insertion corner cases
Problem Details: There were a few places that could cause duplicate extent insertion, this adjusts the code that creates holes to avoid it. lookup_extent_map is changed to correctly return all of the extents in a range, even when there are none matching at the start of the range. Signed-off-by: Chris Mason <chris.mas...
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 7a588ba2b747..b9f2975b55c9 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1170,6 +1170,7 @@ int btrfs_update_inode(struct btrfs_trans_handle *trans, struct inode *inode); /* file.c */ int btrfs_drop_extent_cache(struct inode *inode, u6...
c1e32da616a17813f11b701a7a87775d35c12e3a
Analyze and fix the following issue in the Linux kernel code: Btrfs: Include sched.h in the acl code for current (fixes compile on 2.6.23)
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 27bb841fafeb..ff0fcc72848a 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -20,6 +20,7 @@ #include <linux/string.h> #include <linux/xattr.h> #include <linux/posix_acl_xattr.h> +#include <linux/sched.h> #include "ctree.h" #include "xattr.h" #ifndef is_...
f0c5da1446cc500856a5e31c9a0e2a7bdd30e663
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix for test_range_bit
Problem Details: test_range_bit doesn't properly handle the case: there's a hole at the end of the range and there's no other extent_state after the range. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index d71aed341abd..485cf0719b3c 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -1336,6 +1336,11 @@ int test_range_bit(struct extent_map_tree *tree, u64 start, u64 end, if (start > end) break; node = rb_next(node); + if (!n...
b17854275cd297d40c6c5562fa44a472314c6c7f
Analyze and fix the following issue in the Linux kernel code: Fix for btrfs_find_free_objectid
Problem Details: btrfs_find_free_objectid may return a used objectid due to arithmetic underflow. This bug may happen when parameter 'root' is tree root, so it may cause serious problems when creating snapshot or sub-volume. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index ab74977adf5c..a0925eabdaa2 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c @@ -62,7 +62,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans, struct btrfs_path *path; struct btrfs_key key; int ret; - u64 hole_size = ...
fb4bc1e0565a842d704846005ac0ec739e608ede
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix compile on 2.6.22 kernel
Problem Details: This patch fixes compile error on kernel-2.6.22 Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index b4f85ebe1bd6..27bb841fafeb 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -22,6 +22,11 @@ #include <linux/posix_acl_xattr.h> #include "ctree.h" #include "xattr.h" +#ifndef is_owner_or_cap +#define is_owner_or_cap(inode) \ + ((current->fsuid == (inode)->...
caaca38b8fdcf63a17647fddae2195b189e19e37
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix compile on kernel without ACLs enabled
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile index ab9a9f8edbf8..72cc3e16741f 100644 --- a/fs/btrfs/Makefile +++ b/fs/btrfs/Makefile @@ -5,8 +5,11 @@ obj-m := btrfs.o btrfs-y := super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \ hash.o file-item.o inode-item.o inode-map.o disk-io.o...
4d5e74bc0aec3f54b7e429d77b7c35de042c507d
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix data=ordered vs wait_on_inode deadlock on older kernels
Problem Details: Using ilookup5 during data=ordered writeback could deadlock on I_LOCK. This saves a pointer to the inode instead. Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index cba2b623d02e..3ee51e10c187 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c @@ -25,6 +25,7 @@ struct tree_entry { u64 root_objectid; u64 objectid; + struct inode *inode; struct rb_node rb_node; }; @@ -144,6 +145,7 @...
2da98f003f4788b0a72c5f87bc55b061f65f30fa
Analyze and fix the following issue in the Linux kernel code: Btrfs: Run igrab on data=ordered inodes to prevent deadlocks during writeout
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 1e19f2d86334..fa65fe027e45 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1145,7 +1145,7 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required, int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); int btrfs_re...
61295eb8665e723e77af91d0a1e655a4bd28344f
Analyze and fix the following issue in the Linux kernel code: Btrfs: Add drop inode func to avoid data=ordered deadlock
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index f65b258344d4..a2c2d6d82c5e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1144,6 +1144,7 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required, int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); int btrfs_re...
55c69072d6bd5be170a85467f64a20963cddf490
Analyze and fix the following issue in the Linux kernel code: Btrfs: Fix extent_buffer usage when nodesize != leafsize
Problem Details: Signed-off-by: Chris Mason <chris.mason@oracle.com>
```diff diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a481b970608c..0338f8fd382d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -197,9 +197,23 @@ int csum_dirty_buffer(struct btrfs_root *root, struct page *page) if (found_start != start) { printk("warning: eb start incorrect %Lu buffer %L...