Commit 7a13c14e authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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()
parents 39295279 e08e49d9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
		}

+8 −5
Original line number Diff line number Diff line
@@ -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;
		}

		/*
@@ -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);