[GIT PULL] Btrfs fixes for 4.17-rc6

2018-05-20 Thread David Sterba
Hi, we've accumulated some fixes during the last week, some of them were in the works for a longer time but there are some newer ones too. Most of the fixes have a reproducer and fix user visible problems, also candidates for stable kernels. They IMHO qualify for a late rc, though I did not

Re: [GIT PULL] Btrfs fixes for 4.17-rc6

2018-05-20 Thread Linus Torvalds
On Sun, May 20, 2018 at 8:21 AM David Sterba wrote: > They IMHO qualify for a late rc, though I did not expect that many. Especially with the tree-log.c changes being fairly big, I took a look, and I have to say that I appreciate (a) the warning in the pull request and (b) the

Re: off-by-one uncompressed invalid ram_bytes corruptions

2018-05-20 Thread Steve Leung
On 05/19/2018 07:02 PM, Qu Wenruo wrote: On 2018年05月20日 07:40, Steve Leung wrote: On 05/17/2018 11:49 PM, Qu Wenruo wrote: On 2018年05月18日 13:23, Steve Leung wrote: Hi list, I've got 3-device raid1 btrfs filesystem that's throwing up some "corrupt leaf" errors in dmesg.  This is a

[PATCH 06/12] md: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- Resend, including Shaohua Li: drivers/md/md-faulty.c| 2 +- drivers/md/md-linear.c| 2 +- drivers/md/md-multipath.c | 17 - drivers/md/md-multipath.h | 2 +- drivers/md/md.c | 61

Re: [PATCH 00/13] convert block layer to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Thanks - sending it to him On Sun, May 20, 2018 at 7:08 PM, NeilBrown wrote: > On Sun, May 20 2018, Kent Overstreet wrote: > >> Jens - this series does the rest of the conversions that Christoph wanted, >> and >> drops bioset_create(). >> >> Only lightly tested, but the changes

Re: [PATCH 01/10] mm: pagecache add lock

2018-05-20 Thread Kent Overstreet
On Fri, May 18, 2018 at 08:53:30AM -0700, Christoph Hellwig wrote: > On Fri, May 18, 2018 at 06:13:06AM -0700, Matthew Wilcox wrote: > > > Historically, the only problematic case has been direct IO, and people > > > have been willing to say "well, if you mix buffered and direct IO you > > > get

Re: [PATCH 00/13] convert block layer to bioset_init()/mempool_init()

2018-05-20 Thread NeilBrown
On Sun, May 20 2018, Kent Overstreet wrote: > Jens - this series does the rest of the conversions that Christoph wanted, and > drops bioset_create(). > > Only lightly tested, but the changes are pretty mechanical. Based on your > for-next tree. > > It's also in the for-jens branch at

[PATCH 00/13] convert block layer to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Jens - this series does the rest of the conversions that Christoph wanted, and drops bioset_create(). Only lightly tested, but the changes are pretty mechanical. Based on your for-next tree. It's also in the for-jens branch at https://evilpiepirate.org/git/bcachefs.git Kent Overstreet (12):

[PATCH 08/12] target: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/target/target_core_iblock.c | 14 ++ drivers/target/target_core_iblock.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/target/target_core_iblock.c

[PATCH 09/12] fs: convert block_dev.c to bioset_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- fs/block_dev.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 7ec920e270..b550ae280f 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -272,7 +272,7 @@ struct

[PATCH 12/12] block: Drop bioset_create()

2018-05-20 Thread Kent Overstreet
All users have been converted to bioset_init() Signed-off-by: Kent Overstreet --- block/bio.c | 61 ++--- include/linux/bio.h | 6 ++--- 2 files changed, 15 insertions(+), 52 deletions(-) diff --git a/block/bio.c

[PATCH 10/12] btrfs: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- fs/btrfs/extent_io.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index e99b329002..56d32bb462 100644 --- a/fs/btrfs/extent_io.c +++

[PATCH 11/12] xfs: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_aops.h | 2 +- fs/xfs/xfs_super.c | 11 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 0ab824f574..102463543d 100644 ---

[PATCH v7 1/3] btrfs: Add unprivileged ioctl which returns subvolume information

2018-05-20 Thread Tomohiro Misono
Add new unprivileged ioctl BTRFS_IOC_GET_SUBVOL_INFO which returns the information of subvolume containing this inode. (i.e. returns the information in ROOT_ITEM and ROOT_BACKREF.) Reviewed-by: Gu Jinxiang Tested-by: Gu Jinxiang Signed-off-by: Tomohiro

[PATCH v7 0/3] btrfs: Add three new unprivileged ioctls to allow normal users to call "sub list/show" etc.

2018-05-20 Thread Tomohiro Misono
changelog: v6 -> v7 - Rebase to current misc-next again - Fix 1st patch where otime is wrongly set instead of ctime - Add reviewed-by/tested-by tag v5 -> v6 - Update 1st patch by using btrfs_fs_root_no_name() - Return -EUCLEAN when btrfs_next_leaf/next_item() should not fail - Add

Re: off-by-one uncompressed invalid ram_bytes corruptions

2018-05-20 Thread Qu Wenruo
On 2018年05月21日 04:43, Steve Leung wrote: > On 05/19/2018 07:02 PM, Qu Wenruo wrote: >> >> >> On 2018年05月20日 07:40, Steve Leung wrote: >>> On 05/17/2018 11:49 PM, Qu Wenruo wrote: On 2018年05月18日 13:23, Steve Leung wrote: > Hi list, > > I've got 3-device raid1 btrfs filesystem

[PATCH v7 2/3] btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF

2018-05-20 Thread Tomohiro Misono
Add unprivileged ioctl BTRFS_IOC_GET_SUBVOL_ROOTREF which returns ROOT_REF information of the subvolume containing this inode except the subvolume name (this is because to prevent potential name leak). The subvolume name will be gained by user version of ino_lookup ioctl

[PATCH v7 3/3] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-20 Thread Tomohiro Misono
Add unprivileged version of ino_lookup ioctl BTRFS_IOC_INO_LOOKUP_USER to allow normal users to call "btrfs subvolume list/show" etc. in combination with BTRFS_IOC_GET_SUBVOL_INFO/BTRFS_IOC_GET_SUBVOL_ROOTREF. This can be used like BTRFS_IOC_INO_LOOKUP but the argument is different. This is

[PATCH 06/12] md: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/md/md-faulty.c| 2 +- drivers/md/md-linear.c| 2 +- drivers/md/md-multipath.c | 17 - drivers/md/md-multipath.h | 2 +- drivers/md/md.c | 61 +-- drivers/md/md.h

[PATCH 07/12] dm: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/md/dm-bio-prison-v1.c | 13 --- drivers/md/dm-bio-prison-v2.c | 13 --- drivers/md/dm-cache-target.c | 25 ++--- drivers/md/dm-core.h | 4 +- drivers/md/dm-crypt.c |

[PATCH 02/12] drbd: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/block/drbd/drbd_bitmap.c | 4 +- drivers/block/drbd/drbd_int.h | 10 ++--- drivers/block/drbd/drbd_main.c | 71 +++--- drivers/block/drbd/drbd_receiver.c | 6 +--

[PATCH 03/12] pktcdvd: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/block/pktcdvd.c | 50 - include/linux/pktcdvd.h | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index

[PATCH 01/12] block: convert bounce, q->bio_split to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- block/blk-core.c | 7 --- block/blk-merge.c | 8 +++ block/blk-sysfs.c | 3 +-- block/bounce.c | 47 ++ drivers/md/dm.c| 2 +- include/linux/bio.h

[PATCH 05/12] bcache: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/md/bcache/bcache.h | 10 +- drivers/md/bcache/bset.c| 13 - drivers/md/bcache/bset.h| 2 +- drivers/md/bcache/btree.c | 4 ++-- drivers/md/bcache/io.c | 4 ++--

[PATCH 04/12] lightnvm: convert to bioset_init()/mempool_init()

2018-05-20 Thread Kent Overstreet
Signed-off-by: Kent Overstreet --- drivers/lightnvm/pblk-core.c | 30 ++--- drivers/lightnvm/pblk-init.c | 72 drivers/lightnvm/pblk-read.c | 4 +- drivers/lightnvm/pblk-recovery.c | 2 +-

Re: [PATCH 05/12] bcache: convert to bioset_init()/mempool_init()

2018-05-20 Thread Coly Li
On 2018/5/21 6:25 AM, Kent Overstreet wrote: > Signed-off-by: Kent Overstreet Hi Kent, This change looks good to me, Reviewed-by: Coly Li Thanks. Coly Li > --- > drivers/md/bcache/bcache.h | 10 +- > drivers/md/bcache/bset.c| 13

Re: [PATCH] btrfs: Fix to use original error code of btrfs_read_fs_root_no_name()

2018-05-20 Thread Qu Wenruo
On 2018年05月21日 12:57, Misono Tomohiro wrote: > btrfs_read_fs_root_no_name() may return ERR_PTR(-ENOENT) or > ERR_PTR(-ENOMEM) and therefore search_ioctl() and > btrfs_search_path_in_tree() should use PTR_ERR() instead of -ENOENT, > which all other callers of btrfs_read_fs_root_no_name() does. >

[PATCH] btrfs: Fix to use original error code of btrfs_read_fs_root_no_name()

2018-05-20 Thread Misono Tomohiro
btrfs_read_fs_root_no_name() may return ERR_PTR(-ENOENT) or ERR_PTR(-ENOMEM) and therefore search_ioctl() and btrfs_search_path_in_tree() should use PTR_ERR() instead of -ENOENT, which all other callers of btrfs_read_fs_root_no_name() does. Signed-off-by: Tomohiro Misono

[PATCH v2 2/4] btrfs: lzo: Add comment about the how btrfs records its lzo compressed data

2018-05-20 Thread Qu Wenruo
Although it's not that complex, but such comment could still save several minutes for newer reader/reviewer. Signed-off-by: Qu Wenruo --- fs/btrfs/lzo.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index

[PATCH v2 0/4] btrfs: lzo: Harden decompression callers to avoid kernel memory corruption.

2018-05-20 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/linux/tree/lzo_corruption Which is based on v4.17-rc5. James Harvey reported pretty strange kernel misbehavior where after reading certain btrfs compressed data, kernel crash with unrelated calltrace.

[PATCH v2 1/4] btrfs: compression: Add linux/sizes.h for compression.h

2018-05-20 Thread Qu Wenruo
Since compression.h is using SZ_* macros, and if some user only includes compression.h without linux/sizes.h, it will cause compile error. One example is lzo.c, if it uses BTRFS_MAX_COMPRESSED, it would cause compile error. Fix it by adding linux/sizes.h in compression.h Signed-off-by: Qu

[PATCH v2 3/4] btrfs: lzo: Add header length check to avoid slab out of bounds access

2018-05-20 Thread Qu Wenruo
James Harvey reported that some corrupted compressed extent data can lead to various kernel memory corruption. Such corrupted extent data belongs to inode with NODATASUM flags, thus data csum won't help us detecting such bug. If lucky enough, kasan could catch it like:

[PATCH v2 4/4] btrfs: lzo: Harden inline lzo compressed extent decompression

2018-05-20 Thread Qu Wenruo
Unlike regular lzo compressed extent, inline extent doesn't have Header and only has one Segment. And further more, inlined extent always has csum in its leaf header, it's less possible to have corrupted data. Anyway, still add extra segment header length check. Signed-off-by: Qu Wenruo