Skip to content

Commit 7a13c14

Browse files
committed
Merge tag 'for-6.15-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba: - fix potential inode leak in iget() after memory allocation failure - in subpage mode, fix extent buffer bitmap iteration when writing out dirty sectors - fix range calculation when falling back to COW for a NOCOW file * tag 'for-6.15-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: adjust subpage bit start based on sectorsize btrfs: fix the inode leak in btrfs_iget() btrfs: fix COW handling in run_delalloc_nocow()
2 parents 3929527 + e08e49d commit 7a13c14

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

fs/btrfs/extent_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ static int submit_eb_subpage(struct folio *folio, struct writeback_control *wbc)
20472047
subpage->bitmaps)) {
20482048
spin_unlock_irqrestore(&subpage->lock, flags);
20492049
spin_unlock(&folio->mapping->i_private_lock);
2050-
bit_start++;
2050+
bit_start += sectors_per_node;
20512051
continue;
20522052
}
20532053

fs/btrfs/inode.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,12 +2129,13 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
21292129

21302130
/*
21312131
* If the found extent starts after requested offset, then
2132-
* adjust extent_end to be right before this extent begins
2132+
* adjust cur_offset to be right before this extent begins.
21332133
*/
21342134
if (found_key.offset > cur_offset) {
2135-
extent_end = found_key.offset;
2136-
extent_type = 0;
2137-
goto must_cow;
2135+
if (cow_start == (u64)-1)
2136+
cow_start = cur_offset;
2137+
cur_offset = found_key.offset;
2138+
goto next_slot;
21382139
}
21392140

21402141
/*
@@ -5681,8 +5682,10 @@ struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root)
56815682
return inode;
56825683

56835684
path = btrfs_alloc_path();
5684-
if (!path)
5685+
if (!path) {
5686+
iget_failed(&inode->vfs_inode);
56855687
return ERR_PTR(-ENOMEM);
5688+
}
56865689

56875690
ret = btrfs_read_locked_inode(inode, path);
56885691
btrfs_free_path(path);

0 commit comments

Comments
 (0)