Merge branch 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "Zygo tracked down a very old bug with inline compressed extents.

  I didn't tag this one for stable because I want to do individual
  tested backports. It's a little tricky and I'd rather do some extra
  testing on it along the way"

* 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: add missing memset while reading compressed inline extents
  Btrfs: fix regression in lock_delalloc_pages
  btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h
This commit is contained in:
Linus Torvalds 2017-03-23 11:39:33 -07:00
commit 131fbf4f9c
3 changed files with 16 additions and 28 deletions

View File

@ -1714,7 +1714,8 @@ static int __process_pages_contig(struct address_space *mapping,
* can we find nothing at @index.
*/
ASSERT(page_ops & PAGE_LOCK);
return ret;
err = -EAGAIN;
goto out;
}
for (i = 0; i < ret; i++) {

View File

@ -6709,6 +6709,20 @@ static noinline int uncompress_inline(struct btrfs_path *path,
max_size = min_t(unsigned long, PAGE_SIZE, max_size);
ret = btrfs_decompress(compress_type, tmp, page,
extent_offset, inline_size, max_size);
/*
* decompression code contains a memset to fill in any space between the end
* of the uncompressed data and the end of max_size in case the decompressed
* data ends up shorter than ram_bytes. That doesn't cover the hole between
* the end of an inline extent and the beginning of the next block, so we
* cover that region here.
*/
if (max_size + pg_offset < PAGE_SIZE) {
char *map = kmap(page);
memset(map + pg_offset + max_size, 0, PAGE_SIZE - max_size - pg_offset);
kunmap(page);
}
kfree(tmp);
return ret;
}

View File

@ -713,33 +713,6 @@ enum btrfs_err_code {
BTRFS_ERROR_DEV_ONLY_WRITABLE,
BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
};
/* An error code to error string mapping for the kernel
* error codes
*/
static inline char *btrfs_err_str(enum btrfs_err_code err_code)
{
switch (err_code) {
case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
return "unable to go below two devices on raid1";
case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
return "unable to go below four devices on raid10";
case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
return "unable to go below two devices on raid5";
case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
return "unable to go below three devices on raid6";
case BTRFS_ERROR_DEV_TGT_REPLACE:
return "unable to remove the dev_replace target dev";
case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
return "no missing devices found to remove";
case BTRFS_ERROR_DEV_ONLY_WRITABLE:
return "unable to remove the only writeable device";
case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
return "add/delete/balance/replace/resize operation "\
"in progress";
default:
return NULL;
}
}
#define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
struct btrfs_ioctl_vol_args)