Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Ming Lei
On Thu, Apr 13, 2017 at 10:35:17PM +0200, Andreas Mohr wrote: > On Thu, Apr 13, 2017 at 10:45:10PM +0800, Ming Lei wrote: > > + /* > > +* don't merge if the 1st bio starts with non-zero > > +* offset, otherwise it is quite difficult to respect > > +* sg

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Andreas Mohr
On Thu, Apr 13, 2017 at 10:45:10PM +0800, Ming Lei wrote: > + /* > + * don't merge if the 1st bio starts with non-zero > + * offset, otherwise it is quite difficult to respect > + * sg gap limit. We work hard to merge huge of small > +

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Johannes Thumshirn
On Thu, Apr 13, 2017 at 10:45:10PM +0800, Ming Lei wrote: > On Thu, Apr 13, 2017 at 01:53:28PM +0200, Johannes Thumshirn wrote: > > On Thu, Apr 13, 2017 at 06:02:21PM +0800, Ming Lei wrote: > > > On Thu, Apr 13, 2017 at 10:06:29AM +0200, Johannes Thumshirn wrote: > > > > Doing a mkfs.btrfs on a (qe

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Ming Lei
On Thu, Apr 13, 2017 at 01:53:28PM +0200, Johannes Thumshirn wrote: > On Thu, Apr 13, 2017 at 06:02:21PM +0800, Ming Lei wrote: > > On Thu, Apr 13, 2017 at 10:06:29AM +0200, Johannes Thumshirn wrote: > > > Doing a mkfs.btrfs on a (qemu emulated) PCIe NVMe causes a kernel panic > > > in nvme_setup_p

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Ming Lei
On Thu, Apr 13, 2017 at 02:20:10PM +0200, Johannes Thumshirn wrote: > On Thu, Apr 13, 2017 at 08:11:40PM +0800, Ming Lei wrote: > > Ok, could you apply the attached debug patch and collect the > > ftrace log? (ftrace_dump_on_oops need to be passed to kernel cmd line). > Thanks Johannes very much f

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Ming Lei
On Thu, Apr 13, 2017 at 01:53:28PM +0200, Johannes Thumshirn wrote: > On Thu, Apr 13, 2017 at 06:02:21PM +0800, Ming Lei wrote: > > On Thu, Apr 13, 2017 at 10:06:29AM +0200, Johannes Thumshirn wrote: > > > Doing a mkfs.btrfs on a (qemu emulated) PCIe NVMe causes a kernel panic > > > in nvme_setup_p

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Johannes Thumshirn
On Thu, Apr 13, 2017 at 06:02:21PM +0800, Ming Lei wrote: > On Thu, Apr 13, 2017 at 10:06:29AM +0200, Johannes Thumshirn wrote: > > Doing a mkfs.btrfs on a (qemu emulated) PCIe NVMe causes a kernel panic > > in nvme_setup_prps() because the dma_len will drop below zero but the > > length not. > >

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Johannes Thumshirn
On Thu, Apr 13, 2017 at 06:02:21PM +0800, Ming Lei wrote: > Could you try the following patch to see if it fixes your issue? Sure, jsut have a short lunch break and then I'll report back. -- Johannes Thumshirn Storage jthumsh...@suse.de

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Ming Lei
On Thu, Apr 13, 2017 at 10:06:29AM +0200, Johannes Thumshirn wrote: > Doing a mkfs.btrfs on a (qemu emulated) PCIe NVMe causes a kernel panic > in nvme_setup_prps() because the dma_len will drop below zero but the > length not. Looks I can't reproduce the issue in QEMU(32G nvme, either partitioned

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Johannes Thumshirn
On Thu, Apr 13, 2017 at 11:48:35AM +0200, Christoph Hellwig wrote: > On Thu, Apr 13, 2017 at 10:06:29AM +0200, Johannes Thumshirn wrote: > > Doing a mkfs.btrfs on a (qemu emulated) PCIe NVMe causes a kernel panic > > in nvme_setup_prps() because the dma_len will drop below zero but the > > length n

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Johannes Thumshirn
On Thu, Apr 13, 2017 at 11:48:35AM +0200, Christoph Hellwig wrote: > I think we should also turns this into a WARN_ON_ONCE + error return.. > > But do you have an exact btrfsprogs version and command line? I do a lot > of testing that involves mkfs.btrfs on nvme and haven't seen it.. Sure, it's:

Re: [PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Christoph Hellwig
On Thu, Apr 13, 2017 at 10:06:29AM +0200, Johannes Thumshirn wrote: > Doing a mkfs.btrfs on a (qemu emulated) PCIe NVMe causes a kernel panic > in nvme_setup_prps() because the dma_len will drop below zero but the > length not. I think we should also turns this into a WARN_ON_ONCE + error return..

[PATCH] block: bios with an offset are always gappy

2017-04-13 Thread Johannes Thumshirn
Doing a mkfs.btrfs on a (qemu emulated) PCIe NVMe causes a kernel panic in nvme_setup_prps() because the dma_len will drop below zero but the length not. A git bisect tracked the behaviour down to commit 729204ef49ec ("block: relax check on sg gap"). Since commit 729204ef49ec a bio's offsets are n