Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ba88cd6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull btrfs fixes from David Sterba:
 "We've collected a bunch of isolated fixes, for crashes, user-visible
  behaviour or missing bits from other subsystem cleanups from the past.

  The overall number is not small but I was not able to make it
  significantly smaller. Most of the patches are supposed to go to
  stable"

* 'for-4.14-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: log csums for all modified extents
  Btrfs: fix unexpected result when dio reading corrupted blocks
  btrfs: Report error on removing qgroup if del_qgroup_item fails
  Btrfs: skip checksum when reading compressed data if some IO have failed
  Btrfs: fix kernel oops while reading compressed data
  Btrfs: use btrfs_op instead of bio_op in __btrfs_map_block
  Btrfs: do not backup tree roots when fsync
  btrfs: remove BTRFS_FS_QUOTA_DISABLING flag
  btrfs: propagate error to btrfs_cmp_data_prepare caller
  btrfs: prevent to set invalid default subvolid
  Btrfs: send: fix error number for unknown inode types
  btrfs: fix NULL pointer dereference from free_reloc_roots()
  btrfs: finish ordered extent cleaning if no progress is found
  btrfs: clear ordered flag on cleaning up ordered extents
  Btrfs: fix incorrect {node,sector}size endianness from BTRFS_IOC_FS_INFO
  Btrfs: do not reset bio->bi_ops while writing bio
  Btrfs: use the new helper wbc_to_write_flags
parents 7b5ef823 8c6c5928
Loading
Loading
Loading
Loading
+17 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,8 @@ static void end_compressed_bio_read(struct bio *bio)
	struct inode *inode;
	struct inode *inode;
	struct page *page;
	struct page *page;
	unsigned long index;
	unsigned long index;
	int ret;
	unsigned int mirror = btrfs_io_bio(bio)->mirror_num;
	int ret = 0;


	if (bio->bi_status)
	if (bio->bi_status)
		cb->errors = 1;
		cb->errors = 1;
@@ -118,6 +119,21 @@ static void end_compressed_bio_read(struct bio *bio)
	if (!refcount_dec_and_test(&cb->pending_bios))
	if (!refcount_dec_and_test(&cb->pending_bios))
		goto out;
		goto out;


	/*
	 * Record the correct mirror_num in cb->orig_bio so that
	 * read-repair can work properly.
	 */
	ASSERT(btrfs_io_bio(cb->orig_bio));
	btrfs_io_bio(cb->orig_bio)->mirror_num = mirror;
	cb->mirror_num = mirror;

	/*
	 * Some IO in this cb have failed, just skip checksum as there
	 * is no way it could be correct.
	 */
	if (cb->errors == 1)
		goto csum_failed;

	inode = cb->inode;
	inode = cb->inode;
	ret = check_compressed_csum(BTRFS_I(inode), cb,
	ret = check_compressed_csum(BTRFS_I(inode), cb,
				    (u64)bio->bi_iter.bi_sector << 9);
				    (u64)bio->bi_iter.bi_sector << 9);
+0 −1
Original line number Original line Diff line number Diff line
@@ -709,7 +709,6 @@ struct btrfs_delayed_root;
#define BTRFS_FS_OPEN				5
#define BTRFS_FS_OPEN				5
#define BTRFS_FS_QUOTA_ENABLED			6
#define BTRFS_FS_QUOTA_ENABLED			6
#define BTRFS_FS_QUOTA_ENABLING			7
#define BTRFS_FS_QUOTA_ENABLING			7
#define BTRFS_FS_QUOTA_DISABLING		8
#define BTRFS_FS_UPDATE_UUID_TREE_GEN		9
#define BTRFS_FS_UPDATE_UUID_TREE_GEN		9
#define BTRFS_FS_CREATING_FREE_SPACE_TREE	10
#define BTRFS_FS_CREATING_FREE_SPACE_TREE	10
#define BTRFS_FS_BTREE_ERR			11
#define BTRFS_FS_BTREE_ERR			11
+8 −1
Original line number Original line Diff line number Diff line
@@ -3643,6 +3643,13 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
	u64 flags;
	u64 flags;


	do_barriers = !btrfs_test_opt(fs_info, NOBARRIER);
	do_barriers = !btrfs_test_opt(fs_info, NOBARRIER);

	/*
	 * max_mirrors == 0 indicates we're from commit_transaction,
	 * not from fsync where the tree roots in fs_info have not
	 * been consistent on disk.
	 */
	if (max_mirrors == 0)
		backup_super_roots(fs_info);
		backup_super_roots(fs_info);


	sb = fs_info->super_for_commit;
	sb = fs_info->super_for_commit;
+2 −6
Original line number Original line Diff line number Diff line
@@ -3471,8 +3471,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
	unsigned int write_flags = 0;
	unsigned int write_flags = 0;
	unsigned long nr_written = 0;
	unsigned long nr_written = 0;


	if (wbc->sync_mode == WB_SYNC_ALL)
	write_flags = wbc_to_write_flags(wbc);
		write_flags = REQ_SYNC;


	trace___extent_writepage(page, inode, wbc);
	trace___extent_writepage(page, inode, wbc);


@@ -3718,7 +3717,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
	unsigned long i, num_pages;
	unsigned long i, num_pages;
	unsigned long bio_flags = 0;
	unsigned long bio_flags = 0;
	unsigned long start, end;
	unsigned long start, end;
	unsigned int write_flags = (epd->sync_io ? REQ_SYNC : 0) | REQ_META;
	unsigned int write_flags = wbc_to_write_flags(wbc) | REQ_META;
	int ret = 0;
	int ret = 0;


	clear_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags);
	clear_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags);
@@ -4063,9 +4062,6 @@ static void flush_epd_write_bio(struct extent_page_data *epd)
	if (epd->bio) {
	if (epd->bio) {
		int ret;
		int ret;


		bio_set_op_attrs(epd->bio, REQ_OP_WRITE,
				 epd->sync_io ? REQ_SYNC : 0);

		ret = submit_one_bio(epd->bio, 0, epd->bio_flags);
		ret = submit_one_bio(epd->bio, 0, epd->bio_flags);
		BUG_ON(ret < 0); /* -ENOMEM */
		BUG_ON(ret < 0); /* -ENOMEM */
		epd->bio = NULL;
		epd->bio = NULL;
+22 −5
Original line number Original line Diff line number Diff line
@@ -135,6 +135,18 @@ static inline void btrfs_cleanup_ordered_extents(struct inode *inode,
						 const u64 offset,
						 const u64 offset,
						 const u64 bytes)
						 const u64 bytes)
{
{
	unsigned long index = offset >> PAGE_SHIFT;
	unsigned long end_index = (offset + bytes - 1) >> PAGE_SHIFT;
	struct page *page;

	while (index <= end_index) {
		page = find_get_page(inode->i_mapping, index);
		index++;
		if (!page)
			continue;
		ClearPagePrivate2(page);
		put_page(page);
	}
	return __endio_write_update_ordered(inode, offset + PAGE_SIZE,
	return __endio_write_update_ordered(inode, offset + PAGE_SIZE,
					    bytes - PAGE_SIZE, false);
					    bytes - PAGE_SIZE, false);
}
}
@@ -8357,11 +8369,8 @@ static void btrfs_endio_direct_read(struct bio *bio)
	struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
	struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
	blk_status_t err = bio->bi_status;
	blk_status_t err = bio->bi_status;


	if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) {
	if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED)
		err = btrfs_subio_endio_read(inode, io_bio, err);
		err = btrfs_subio_endio_read(inode, io_bio, err);
		if (!err)
			bio->bi_status = 0;
	}


	unlock_extent(&BTRFS_I(inode)->io_tree, dip->logical_offset,
	unlock_extent(&BTRFS_I(inode)->io_tree, dip->logical_offset,
		      dip->logical_offset + dip->bytes - 1);
		      dip->logical_offset + dip->bytes - 1);
@@ -8369,7 +8378,7 @@ static void btrfs_endio_direct_read(struct bio *bio)


	kfree(dip);
	kfree(dip);


	dio_bio->bi_status = bio->bi_status;
	dio_bio->bi_status = err;
	dio_end_io(dio_bio);
	dio_end_io(dio_bio);


	if (io_bio->end_io)
	if (io_bio->end_io)
@@ -8387,6 +8396,7 @@ static void __endio_write_update_ordered(struct inode *inode,
	btrfs_work_func_t func;
	btrfs_work_func_t func;
	u64 ordered_offset = offset;
	u64 ordered_offset = offset;
	u64 ordered_bytes = bytes;
	u64 ordered_bytes = bytes;
	u64 last_offset;
	int ret;
	int ret;


	if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
	if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
@@ -8398,6 +8408,7 @@ static void __endio_write_update_ordered(struct inode *inode,
	}
	}


again:
again:
	last_offset = ordered_offset;
	ret = btrfs_dec_test_first_ordered_pending(inode, &ordered,
	ret = btrfs_dec_test_first_ordered_pending(inode, &ordered,
						   &ordered_offset,
						   &ordered_offset,
						   ordered_bytes,
						   ordered_bytes,
@@ -8408,6 +8419,12 @@ static void __endio_write_update_ordered(struct inode *inode,
	btrfs_init_work(&ordered->work, func, finish_ordered_fn, NULL, NULL);
	btrfs_init_work(&ordered->work, func, finish_ordered_fn, NULL, NULL);
	btrfs_queue_work(wq, &ordered->work);
	btrfs_queue_work(wq, &ordered->work);
out_test:
out_test:
	/*
	 * If btrfs_dec_test_ordered_pending does not find any ordered extent
	 * in the range, we can exit.
	 */
	if (ordered_offset == last_offset)
		return;
	/*
	/*
	 * our bio might span multiple ordered extents.  If we haven't
	 * our bio might span multiple ordered extents.  If we haven't
	 * completed the accounting for the whole dio, go back and try again
	 * completed the accounting for the whole dio, go back and try again
Loading