Skip to content

Commit

Permalink
Merge tag 'for-6.15-rc4-tag' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/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()
  • Loading branch information
Linus Torvalds committed Apr 30, 2025
2 parents 3929527 + e08e49d commit 7a13c14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ static int submit_eb_subpage(struct folio *folio, struct writeback_control *wbc)
subpage->bitmaps)) {
spin_unlock_irqrestore(&subpage->lock, flags);
spin_unlock(&folio->mapping->i_private_lock);
bit_start++;
bit_start += sectors_per_node;
continue;
}

Expand Down
13 changes: 8 additions & 5 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2129,12 +2129,13 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,

/*
* If the found extent starts after requested offset, then
* adjust extent_end to be right before this extent begins
* adjust cur_offset to be right before this extent begins.
*/
if (found_key.offset > cur_offset) {
extent_end = found_key.offset;
extent_type = 0;
goto must_cow;
if (cow_start == (u64)-1)
cow_start = cur_offset;
cur_offset = found_key.offset;
goto next_slot;
}

/*
Expand Down Expand Up @@ -5681,8 +5682,10 @@ struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root)
return inode;

path = btrfs_alloc_path();
if (!path)
if (!path) {
iget_failed(&inode->vfs_inode);
return ERR_PTR(-ENOMEM);
}

ret = btrfs_read_locked_inode(inode, path);
btrfs_free_path(path);
Expand Down

0 comments on commit 7a13c14

Please sign in to comment.