linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
@ 2012-12-14 20:30 Joseph Salisbury
  2012-12-14 21:11 ` Mike Snitzer
  2012-12-14 22:35 ` Martin K. Petersen
  0 siblings, 2 replies; 22+ messages in thread
From: Joseph Salisbury @ 2012-12-14 20:30 UTC (permalink / raw)
  To: martin.petersen; +Cc: Kernel Team, linux-kernel, snitzer, jgarzik, JBottomley

Hi Martin,

A bug was opened against the Ubuntu kernel[0].  After a kernel bisect, 
it was found that reverting the following commit resolved this bug:

commit 5db44863b6ebbb400c5e61d56ebe8f21ef48b1bd
Author: Martin K. Petersen <martin.petersen@oracle.com>
Date:   Tue Sep 18 12:19:32 2012 -0400
[SCSI] sd: Implement support for WRITE SAME

The regression was introduced as of v3.7-rc7.

The bug can be reproduced with the following commands, which will 
operate on a virtual scsi_debug device, so they won't change any data on 
the test system. However, this will completely crash the system:

sudo modprobe scsi_debug
sudo luksformat -t ext4 /dev/sdb <- Or whatever device gets assigned 
after inserting scsi_debug.
sudo cryptsetup luksOpen /dev/sdb treasure

Everything works fine up to here, but the following will cause the crash:

sudo mount /dev/mapper/treasure /mnt

The bug can be reproduced on bare metal, in a VM and on i386 or amd64.

I see that you are the author of this patch, so I wanted to run this by 
you.  I was thinking of requesting a revert for v3.7, but I wanted to 
get your feedback first.


Thanks,

Joe


[0] https://bugs.launchpad.net/bugs/1089818

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-14 20:30 [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME Joseph Salisbury
@ 2012-12-14 21:11 ` Mike Snitzer
  2012-12-15  2:38   ` Joseph Salisbury
  2012-12-14 22:35 ` Martin K. Petersen
  1 sibling, 1 reply; 22+ messages in thread
From: Mike Snitzer @ 2012-12-14 21:11 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: martin.petersen, Kernel Team, linux-kernel, jgarzik, JBottomley,
	Milan Broz

On Fri, Dec 14 2012 at  3:30pm -0500,
Joseph Salisbury <joseph.salisbury@canonical.com> wrote:

> Hi Martin,
> 
> A bug was opened against the Ubuntu kernel[0].  After a kernel
> bisect, it was found that reverting the following commit resolved
> this bug:
> 
> commit 5db44863b6ebbb400c5e61d56ebe8f21ef48b1bd
> Author: Martin K. Petersen <martin.petersen@oracle.com>
> Date:   Tue Sep 18 12:19:32 2012 -0400
> [SCSI] sd: Implement support for WRITE SAME
> 
> The regression was introduced as of v3.7-rc7.
> 
> The bug can be reproduced with the following commands, which will
> operate on a virtual scsi_debug device, so they won't change any
> data on the test system. However, this will completely crash the
> system:
> 
> sudo modprobe scsi_debug
> sudo luksformat -t ext4 /dev/sdb <- Or whatever device gets assigned
> after inserting scsi_debug.
> sudo cryptsetup luksOpen /dev/sdb treasure
> 
> Everything works fine up to here, but the following will cause the crash:
> 
> sudo mount /dev/mapper/treasure /mnt
> 
> The bug can be reproduced on bare metal, in a VM and on i386 or amd64.
> 
> I see that you are the author of this patch, so I wanted to run this
> by you.  I was thinking of requesting a revert for v3.7, but I
> wanted to get your feedback first.
> 
> 
> Thanks,
> 
> Joe
> 
> 
> [0] https://bugs.launchpad.net/bugs/1089818

The WRITE SAME change was introduced long before v3.7-rc7.  I think your
bisect is somehow wrong.

Milan Broz recently pointed out issues he found with luks when using a
late 3.7-rc (rc7 afaik).  Linus fixed that issue with this commit (which
landed in the final v3.7):
http://git.kernel.org/linus/684c9aaebbb0ea3a9954

That may not be _the_ problem though.  But have you tried the final
v3.7?

Mike

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-14 20:30 [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME Joseph Salisbury
  2012-12-14 21:11 ` Mike Snitzer
@ 2012-12-14 22:35 ` Martin K. Petersen
  2012-12-15  2:40   ` Joseph Salisbury
  2012-12-18 19:52   ` Joseph Salisbury
  1 sibling, 2 replies; 22+ messages in thread
From: Martin K. Petersen @ 2012-12-14 22:35 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: martin.petersen, Kernel Team, linux-kernel, snitzer, jgarzik, JBottomley

>>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:

Joseph> I see that you are the author of this patch, so I wanted to run
Joseph> this by you.  I was thinking of requesting a revert for v3.7,
Joseph> but I wanted to get your feedback first.

I copied luksformat from a Debian box so I could try to reproduce on
OL6. Everything works fine for me here. I set up a encrypted ext4
device, unpacked a kernel tarball, and did a build.

The oops screenshot in the launchpad bug report is pretty useless.
Please provide a full backtrace so we can get a better idea what's going
on.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-14 21:11 ` Mike Snitzer
@ 2012-12-15  2:38   ` Joseph Salisbury
  0 siblings, 0 replies; 22+ messages in thread
From: Joseph Salisbury @ 2012-12-15  2:38 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: martin.petersen, Kernel Team, linux-kernel, jgarzik, JBottomley,
	Milan Broz

On 12/14/2012 04:11 PM, Mike Snitzer wrote:
> On Fri, Dec 14 2012 at  3:30pm -0500,
> Joseph Salisbury <joseph.salisbury@canonical.com> wrote:
>
>> Hi Martin,
>>
>> A bug was opened against the Ubuntu kernel[0].  After a kernel
>> bisect, it was found that reverting the following commit resolved
>> this bug:
>>
>> commit 5db44863b6ebbb400c5e61d56ebe8f21ef48b1bd
>> Author: Martin K. Petersen <martin.petersen@oracle.com>
>> Date:   Tue Sep 18 12:19:32 2012 -0400
>> [SCSI] sd: Implement support for WRITE SAME
>>
>> The regression was introduced as of v3.7-rc7.
>>
>> The bug can be reproduced with the following commands, which will
>> operate on a virtual scsi_debug device, so they won't change any
>> data on the test system. However, this will completely crash the
>> system:
>>
>> sudo modprobe scsi_debug
>> sudo luksformat -t ext4 /dev/sdb <- Or whatever device gets assigned
>> after inserting scsi_debug.
>> sudo cryptsetup luksOpen /dev/sdb treasure
>>
>> Everything works fine up to here, but the following will cause the crash:
>>
>> sudo mount /dev/mapper/treasure /mnt
>>
>> The bug can be reproduced on bare metal, in a VM and on i386 or amd64.
>>
>> I see that you are the author of this patch, so I wanted to run this
>> by you.  I was thinking of requesting a revert for v3.7, but I
>> wanted to get your feedback first.
>>
>>
>> Thanks,
>>
>> Joe
>>
>>
>> [0] https://bugs.launchpad.net/bugs/1089818
> The WRITE SAME change was introduced long before v3.7-rc7.  I think your
> bisect is somehow wrong.
 From Linus' tree:
git describe --contains 5db4486
v3.7-rc7~19^2

Reverting commit 5db4486 solves the bug previously mentioned.

>
> Milan Broz recently pointed out issues he found with luks when using a
> late 3.7-rc (rc7 afaik).  Linus fixed that issue with this commit (which
> landed in the final v3.7):
> http://git.kernel.org/linus/684c9aaebbb0ea3a9954
>
> That may not be _the_ problem though.  But have you tried the final
> v3.7?

Yes, v3.7 without reverting 5db4486 exhibits the bug.

>
> Mike
I'll research further and provide additional data.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-14 22:35 ` Martin K. Petersen
@ 2012-12-15  2:40   ` Joseph Salisbury
  2012-12-18 19:52   ` Joseph Salisbury
  1 sibling, 0 replies; 22+ messages in thread
From: Joseph Salisbury @ 2012-12-15  2:40 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Kernel Team, linux-kernel, snitzer, jgarzik, JBottomley

On 12/14/2012 05:35 PM, Martin K. Petersen wrote:
>>>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:
> Joseph> I see that you are the author of this patch, so I wanted to run
> Joseph> this by you.  I was thinking of requesting a revert for v3.7,
> Joseph> but I wanted to get your feedback first.
>
> I copied luksformat from a Debian box so I could try to reproduce on
> OL6. Everything works fine for me here. I set up a encrypted ext4
> device, unpacked a kernel tarball, and did a build.
>
> The oops screenshot in the launchpad bug report is pretty useless.
> Please provide a full backtrace so we can get a better idea what's going
> on.
>

Thanks for the feedback, Martin.

I will do some additional research and testing.  I'll be sure to capture 
a full backtrace for analysis.

Thanks again,

Joe

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-14 22:35 ` Martin K. Petersen
  2012-12-15  2:40   ` Joseph Salisbury
@ 2012-12-18 19:52   ` Joseph Salisbury
  2012-12-19 16:58     ` Martin K. Petersen
  1 sibling, 1 reply; 22+ messages in thread
From: Joseph Salisbury @ 2012-12-18 19:52 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Kernel Team, linux-kernel, snitzer, jgarzik, JBottomley

On 12/14/2012 05:35 PM, Martin K. Petersen wrote:
>>>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:
> Joseph> I see that you are the author of this patch, so I wanted to run
> Joseph> this by you.  I was thinking of requesting a revert for v3.7,
> Joseph> but I wanted to get your feedback first.
>
> I copied luksformat from a Debian box so I could try to reproduce on
> OL6. Everything works fine for me here. I set up a encrypted ext4
> device, unpacked a kernel tarball, and did a build.
>
> The oops screenshot in the launchpad bug report is pretty useless.
> Please provide a full backtrace so we can get a better idea what's going
> on.
>
Hi Martin,

I captured the netconsole output from boot until I reproduced the bug. 
The RIP points to kcryptd_crypt_write_io_submit() in 
~/drivers/md/dm-crypt.c.  The output can be seen at:

https://launchpadlibrarian.net/126102023/netconsole-lp1089818.log

Thanks again,

Joe


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-18 19:52   ` Joseph Salisbury
@ 2012-12-19 16:58     ` Martin K. Petersen
  2012-12-19 19:58       ` Mike Snitzer
  0 siblings, 1 reply; 22+ messages in thread
From: Martin K. Petersen @ 2012-12-19 16:58 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Martin K. Petersen, Kernel Team, linux-kernel, snitzer, jgarzik,
	JBottomley

>>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:

Joseph> I captured the netconsole output from boot until I reproduced
Joseph> the bug. The RIP points to kcryptd_crypt_write_io_submit() in
Joseph> ~/drivers/md/dm-crypt.c.  The output can be seen at:

I'm thinking that dm-crypt should probably set max_write_same_sectors to
0. It doesn't really make much sense for a crypto driver to pass that
command through.

Mike, do you want to look into this?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-19 16:58     ` Martin K. Petersen
@ 2012-12-19 19:58       ` Mike Snitzer
  2012-12-19 19:59         ` Joseph Salisbury
                           ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Mike Snitzer @ 2012-12-19 19:58 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Joseph Salisbury, Kernel Team, linux-kernel, jgarzik, JBottomley,
	Milan Broz

On Wed, Dec 19 2012 at 11:58am -0500,
Martin K. Petersen <martin.petersen@oracle.com> wrote:

> >>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:
> 
> Joseph> I captured the netconsole output from boot until I reproduced
> Joseph> the bug. The RIP points to kcryptd_crypt_write_io_submit() in
> Joseph> ~/drivers/md/dm-crypt.c.  The output can be seen at:
> 
> I'm thinking that dm-crypt should probably set max_write_same_sectors to
> 0. It doesn't really make much sense for a crypto driver to pass that
> command through.
> 
> Mike, do you want to look into this?

Milan (cc'd) is more well-versed with dm-crypt.  Though we likely need
to audit DM relative to WRITE SAME too (will do once I understand what
added safety/constraints are needed).

But do we know mount to somwhow be issuing WRITE SAME requests?  Martin,
why is it you weren't able to reproduce (I haven't attempted yet)?

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-19 19:58       ` Mike Snitzer
@ 2012-12-19 19:59         ` Joseph Salisbury
  2012-12-19 20:45           ` Martin K. Petersen
  2012-12-19 20:45         ` Martin K. Petersen
  2012-12-19 20:45         ` Milan Broz
  2 siblings, 1 reply; 22+ messages in thread
From: Joseph Salisbury @ 2012-12-19 19:59 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Martin K. Petersen, Kernel Team, linux-kernel, jgarzik,
	JBottomley, Milan Broz

On 12/19/2012 02:58 PM, Mike Snitzer wrote:
> On Wed, Dec 19 2012 at 11:58am -0500,
> Martin K. Petersen <martin.petersen@oracle.com> wrote:
>
>>>>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:
>> Joseph> I captured the netconsole output from boot until I reproduced
>> Joseph> the bug. The RIP points to kcryptd_crypt_write_io_submit() in
>> Joseph> ~/drivers/md/dm-crypt.c.  The output can be seen at:
>>
>> I'm thinking that dm-crypt should probably set max_write_same_sectors to
>> 0. It doesn't really make much sense for a crypto driver to pass that
>> command through.
>>
>> Mike, do you want to look into this?
> Milan (cc'd) is more well-versed with dm-crypt.  Though we likely need
> to audit DM relative to WRITE SAME too (will do once I understand what
> added safety/constraints are needed).
>
> But do we know mount to somwhow be issuing WRITE SAME requests?  Martin,
> why is it you weren't able to reproduce (I haven't attempted yet)?
Martin, were you using the scsi_debug module, or a real scsi device(s)?

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-19 19:58       ` Mike Snitzer
  2012-12-19 19:59         ` Joseph Salisbury
@ 2012-12-19 20:45         ` Martin K. Petersen
  2012-12-19 20:45         ` Milan Broz
  2 siblings, 0 replies; 22+ messages in thread
From: Martin K. Petersen @ 2012-12-19 20:45 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Martin K. Petersen, Joseph Salisbury, Kernel Team, linux-kernel,
	jgarzik, JBottomley, Milan Broz

>>>>> "Mike" == Mike Snitzer <snitzer@redhat.com> writes:

Mike> But do we know mount to somwhow be issuing WRITE SAME requests?

I'm assuming that ext4 is somehow calling sb_issue_zeroout().


Mike> Martin, why is it you weren't able to reproduce (I haven't
Mike> attempted yet)?

Dunno.

But regardless of any bugs, WRITE SAME will still need some special
attention in the context of dm-crypt.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-19 19:58       ` Mike Snitzer
  2012-12-19 19:59         ` Joseph Salisbury
  2012-12-19 20:45         ` Martin K. Petersen
@ 2012-12-19 20:45         ` Milan Broz
  2012-12-19 21:07           ` [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME) Milan Broz
  2 siblings, 1 reply; 22+ messages in thread
From: Milan Broz @ 2012-12-19 20:45 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Martin K. Petersen, Joseph Salisbury, Kernel Team, linux-kernel,
	jgarzik, JBottomley

On 12/19/2012 08:58 PM, Mike Snitzer wrote:
> On Wed, Dec 19 2012 at 11:58am -0500,
> Martin K. Petersen <martin.petersen@oracle.com> wrote:
> 
>>>>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:
>>
>> Joseph> I captured the netconsole output from boot until I reproduced
>> Joseph> the bug. The RIP points to kcryptd_crypt_write_io_submit() in
>> Joseph> ~/drivers/md/dm-crypt.c.  The output can be seen at:
>>
>> I'm thinking that dm-crypt should probably set max_write_same_sectors to
>> 0. It doesn't really make much sense for a crypto driver to pass that
>> command through.

IMHO WRITE_SAME doesn't not make sense in encrypted storage. The same sectors
in plaintext are _not_ the same in ciphertext. NEVER.
(If so, you have a security problem.)

It must be disabled in dmcrypt explicitly then (max_write_same_sectors?).

Is it only dmcrypt, or encrypted fs are affected too?

Milan


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [v3.7 Regression]  [SCSI] sd: Implement support for WRITE SAME
  2012-12-19 19:59         ` Joseph Salisbury
@ 2012-12-19 20:45           ` Martin K. Petersen
  0 siblings, 0 replies; 22+ messages in thread
From: Martin K. Petersen @ 2012-12-19 20:45 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Mike Snitzer, Martin K. Petersen, Kernel Team, linux-kernel,
	jgarzik, JBottomley, Milan Broz

>>>>> "Joseph" == Joseph Salisbury <joseph.salisbury@canonical.com> writes:

Joseph> Martin, were you using the scsi_debug module, or a real scsi
Joseph> device(s)?

I used scsi_debug for the test.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2012-12-19 20:45         ` Milan Broz
@ 2012-12-19 21:07           ` Milan Broz
  2012-12-19 21:07             ` Joseph Salisbury
                               ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Milan Broz @ 2012-12-19 21:07 UTC (permalink / raw)
  To: Mike Snitzer
  Cc: Martin K. Petersen, Joseph Salisbury, Kernel Team, linux-kernel,
	jgarzik, JBottomley

Does this help?

dm-crypt: never use write same

Ciphertext device is not compatible with WRITE SAME,
disable it for all dmcrypt devices.

Signed-off-by: Milan Broz <mbroz@redhat.com>

--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1844,6 +1844,12 @@ static int crypt_iterate_devices(struct dm_target *ti,
 	return fn(ti, cc->dev, cc->start, ti->len, data);
 }
 
+static void crypt_io_hints(struct dm_target *ti,
+			    struct queue_limits *limits)
+{
+	limits->max_write_same_sectors = 0;
+}
+
 static struct target_type crypt_target = {
 	.name   = "crypt",
 	.version = {1, 11, 0},
@@ -1858,6 +1864,7 @@ static struct target_type crypt_target = {
 	.message = crypt_message,
 	.merge  = crypt_merge,
 	.iterate_devices = crypt_iterate_devices,
+	.io_hints = crypt_io_hints,
 };
 
 static int __init dm_crypt_init(void)


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2012-12-19 21:07           ` [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME) Milan Broz
@ 2012-12-19 21:07             ` Joseph Salisbury
  2012-12-19 22:20             ` Joseph Salisbury
  2012-12-20  0:11             ` [PATCH] " Martin K. Petersen
  2 siblings, 0 replies; 22+ messages in thread
From: Joseph Salisbury @ 2012-12-19 21:07 UTC (permalink / raw)
  To: Milan Broz
  Cc: Mike Snitzer, Martin K. Petersen, Kernel Team, linux-kernel,
	jgarzik, JBottomley

On 12/19/2012 04:07 PM, Milan Broz wrote:
> Does this help?
>
> dm-crypt: never use write same
>
> Ciphertext device is not compatible with WRITE SAME,
> disable it for all dmcrypt devices.
>
> Signed-off-by: Milan Broz <mbroz@redhat.com>
>
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1844,6 +1844,12 @@ static int crypt_iterate_devices(struct dm_target *ti,
>   	return fn(ti, cc->dev, cc->start, ti->len, data);
>   }
>   
> +static void crypt_io_hints(struct dm_target *ti,
> +			    struct queue_limits *limits)
> +{
> +	limits->max_write_same_sectors = 0;
> +}
> +
>   static struct target_type crypt_target = {
>   	.name   = "crypt",
>   	.version = {1, 11, 0},
> @@ -1858,6 +1864,7 @@ static struct target_type crypt_target = {
>   	.message = crypt_message,
>   	.merge  = crypt_merge,
>   	.iterate_devices = crypt_iterate_devices,
> +	.io_hints = crypt_io_hints,
>   };
>   
>   static int __init dm_crypt_init(void)
>
I'll give it a spin right now.  Thanks for the quick work!

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2012-12-19 21:07           ` [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME) Milan Broz
  2012-12-19 21:07             ` Joseph Salisbury
@ 2012-12-19 22:20             ` Joseph Salisbury
  2012-12-19 22:23               ` Milan Broz
  2015-07-13 16:33               ` Joseph Salisbury
  2012-12-20  0:11             ` [PATCH] " Martin K. Petersen
  2 siblings, 2 replies; 22+ messages in thread
From: Joseph Salisbury @ 2012-12-19 22:20 UTC (permalink / raw)
  To: Milan Broz
  Cc: Mike Snitzer, Martin K. Petersen, Kernel Team, linux-kernel,
	jgarzik, JBottomley

On 12/19/2012 04:07 PM, Milan Broz wrote:
> Does this help?
>
> dm-crypt: never use write same
>
> Ciphertext device is not compatible with WRITE SAME,
> disable it for all dmcrypt devices.
>
> Signed-off-by: Milan Broz <mbroz@redhat.com>
>
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1844,6 +1844,12 @@ static int crypt_iterate_devices(struct dm_target *ti,
>   	return fn(ti, cc->dev, cc->start, ti->len, data);
>   }
>   
> +static void crypt_io_hints(struct dm_target *ti,
> +			    struct queue_limits *limits)
> +{
> +	limits->max_write_same_sectors = 0;
> +}
> +
>   static struct target_type crypt_target = {
>   	.name   = "crypt",
>   	.version = {1, 11, 0},
> @@ -1858,6 +1864,7 @@ static struct target_type crypt_target = {
>   	.message = crypt_message,
>   	.merge  = crypt_merge,
>   	.iterate_devices = crypt_iterate_devices,
> +	.io_hints = crypt_io_hints,
>   };
>   
>   static int __init dm_crypt_init(void)
>
Great work, Milan.  Your patch fixes the bug, stops the panic and allows 
dm-crypt to function properly.

Will you be requesting this in v3.8 ?

Thanks again,

Joe

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2012-12-19 22:20             ` Joseph Salisbury
@ 2012-12-19 22:23               ` Milan Broz
  2015-07-13 16:33               ` Joseph Salisbury
  1 sibling, 0 replies; 22+ messages in thread
From: Milan Broz @ 2012-12-19 22:23 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Mike Snitzer, Martin K. Petersen, Kernel Team, linux-kernel,
	jgarzik, JBottomley

On 12/19/2012 11:20 PM, Joseph Salisbury wrote:
> Great work, Milan.  Your patch fixes the bug, stops the panic and allows 
> dm-crypt to function properly.

Thanks.

> 
> Will you be requesting this in v3.8 ?

This should go into 3.7 stable as well, I am talking with Alasdair already
how to handle it.

Milan


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2012-12-19 21:07           ` [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME) Milan Broz
  2012-12-19 21:07             ` Joseph Salisbury
  2012-12-19 22:20             ` Joseph Salisbury
@ 2012-12-20  0:11             ` Martin K. Petersen
  2012-12-20  5:47               ` Mike Snitzer
  2 siblings, 1 reply; 22+ messages in thread
From: Martin K. Petersen @ 2012-12-20  0:11 UTC (permalink / raw)
  To: Milan Broz
  Cc: Mike Snitzer, Martin K. Petersen, Joseph Salisbury, Kernel Team,
	linux-kernel, jgarzik, JBottomley

>>>>> "Milan" == Milan Broz <mbroz@redhat.com> writes:

Milan> dm-crypt: never use write same

Milan> Ciphertext device is not compatible with WRITE SAME, disable it
Milan> for all dmcrypt devices.

Milan> Signed-off-by: Milan Broz <mbroz@redhat.com>

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2012-12-20  0:11             ` [PATCH] " Martin K. Petersen
@ 2012-12-20  5:47               ` Mike Snitzer
  0 siblings, 0 replies; 22+ messages in thread
From: Mike Snitzer @ 2012-12-20  5:47 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Milan Broz, Joseph Salisbury, Kernel Team, linux-kernel, jgarzik,
	JBottomley, dm-devel

On Wed, Dec 19 2012 at  7:11pm -0500,
Martin K. Petersen <martin.petersen@oracle.com> wrote:

> >>>>> "Milan" == Milan Broz <mbroz@redhat.com> writes:
> 
> Milan> dm-crypt: never use write same
> 
> Milan> Ciphertext device is not compatible with WRITE SAME, disable it
> Milan> for all dmcrypt devices.
> 
> Milan> Signed-off-by: Milan Broz <mbroz@redhat.com>
> 
> Acked-by: Martin K. Petersen <martin.petersen@oracle.com>

I've developed more comprehensive WRITE SAME support for DM.  It can be
used in conjunction with Milan's patch (which enables Milan's patch to
go in too and be more easily tagged for v3.7 stable).

Anyway, my changes are available in the 'dm-write-same' branch of my
github tree: git://github.com/snitm/linux.git

See the top 5 commits: https://github.com/snitm/linux/commits/dm-write-same
(topmost needs to be folded, I'll do that when posting to dm-devel in
reply to this mail)

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2012-12-19 22:20             ` Joseph Salisbury
  2012-12-19 22:23               ` Milan Broz
@ 2015-07-13 16:33               ` Joseph Salisbury
  2015-07-13 16:59                 ` Milan Broz
  2015-07-13 17:01                 ` Milan Broz
  1 sibling, 2 replies; 22+ messages in thread
From: Joseph Salisbury @ 2015-07-13 16:33 UTC (permalink / raw)
  To: Milan Broz
  Cc: Mike Snitzer, Martin K. Petersen, linux-kernel, JBottomley,
	Kernel Team, jgarzik

On 12/19/2012 05:20 PM, Joseph Salisbury wrote:
> On 12/19/2012 04:07 PM, Milan Broz wrote:
>> Does this help?
>>
>> dm-crypt: never use write same
>>
>> Ciphertext device is not compatible with WRITE SAME,
>> disable it for all dmcrypt devices.
>>
>> Signed-off-by: Milan Broz <mbroz@redhat.com>
>>
>> --- a/drivers/md/dm-crypt.c
>> +++ b/drivers/md/dm-crypt.c
>> @@ -1844,6 +1844,12 @@ static int crypt_iterate_devices(struct
>> dm_target *ti,
>>       return fn(ti, cc->dev, cc->start, ti->len, data);
>>   }
>>   +static void crypt_io_hints(struct dm_target *ti,
>> +                struct queue_limits *limits)
>> +{
>> +    limits->max_write_same_sectors = 0;
>> +}
>> +
>>   static struct target_type crypt_target = {
>>       .name   = "crypt",
>>       .version = {1, 11, 0},
>> @@ -1858,6 +1864,7 @@ static struct target_type crypt_target = {
>>       .message = crypt_message,
>>       .merge  = crypt_merge,
>>       .iterate_devices = crypt_iterate_devices,
>> +    .io_hints = crypt_io_hints,
>>   };
>>     static int __init dm_crypt_init(void)
>>
> Great work, Milan.  Your patch fixes the bug, stops the panic and
> allows dm-crypt to function properly.
>
> Will you be requesting this in v3.8 ?
>
> Thanks again,
>
> Joe
>
Hi Milan,

The Ubuntu kernel has been carrying this patch since the discussion[0]
we were having about the bug.  I don't see that patch was ever included
in mainline.  Do you happen to know if this patch is still needed or was
the bug we were seeing fixed in some other way?

Thanks,

Joe 


[0] https://lists.ubuntu.com/archives/kernel-team/2012-December/023524.html

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2015-07-13 16:33               ` Joseph Salisbury
@ 2015-07-13 16:59                 ` Milan Broz
  2015-07-13 17:01                 ` Milan Broz
  1 sibling, 0 replies; 22+ messages in thread
From: Milan Broz @ 2015-07-13 16:59 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Mike Snitzer, Martin K. Petersen, linux-kernel, JBottomley,
	Kernel Team, jgarzik

On 07/13/2015 06:33 PM, Joseph Salisbury wrote:
> Hi Milan,
> 
> The Ubuntu kernel has been carrying this patch since the discussion[0]
> we were having about the bug.  I don't see that patch was ever included
> in mainline.  Do you happen to know if this patch is still needed or was
> the bug we were seeing fixed in some other way?

I think it was superseded by later Mike's approach to reverse the logic
- disable write same for all targets and require to explicitly allow it.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/md/dm-table.c?id=c1a94672a830e01d58c7c7e8de530c3f136d6ff2
(+later patches)

So I think we do no need this patch upstream anymore.

Mike, am I right here?

Milan


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2015-07-13 16:33               ` Joseph Salisbury
  2015-07-13 16:59                 ` Milan Broz
@ 2015-07-13 17:01                 ` Milan Broz
  2015-07-13 18:01                   ` Mike Snitzer
  1 sibling, 1 reply; 22+ messages in thread
From: Milan Broz @ 2015-07-13 17:01 UTC (permalink / raw)
  To: Joseph Salisbury
  Cc: Mike Snitzer, Martin K. Petersen, linux-kernel, JBottomley,
	Kernel Team, jgarzik

(sorry, resending again, not sure if it was sent correctly)

On 07/13/2015 06:33 PM, Joseph Salisbury wrote:
> Hi Milan,
> 
> The Ubuntu kernel has been carrying this patch since the discussion[0]
> we were having about the bug.  I don't see that patch was ever included
> in mainline.  Do you happen to know if this patch is still needed or was
> the bug we were seeing fixed in some other way?

I think it was superseded by later Mike's approach to reverse the logic
- disable write same for all targets and require to explicitly allow it.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/md/dm-table.c?id=c1a94672a830e01d58c7c7e8de530c3f136d6ff2
(+later patches)

So I think we do no need this patch upstream anymore.

Mike, am I right here?

Milan


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME)
  2015-07-13 17:01                 ` Milan Broz
@ 2015-07-13 18:01                   ` Mike Snitzer
  0 siblings, 0 replies; 22+ messages in thread
From: Mike Snitzer @ 2015-07-13 18:01 UTC (permalink / raw)
  To: Milan Broz
  Cc: Joseph Salisbury, Martin K. Petersen, linux-kernel, JBottomley,
	Kernel Team, jgarzik

On Mon, Jul 13 2015 at  1:01pm -0400,
Milan Broz <mbroz@redhat.com> wrote:

> (sorry, resending again, not sure if it was sent correctly)
> 
> On 07/13/2015 06:33 PM, Joseph Salisbury wrote:
> > Hi Milan,
> > 
> > The Ubuntu kernel has been carrying this patch since the discussion[0]
> > we were having about the bug.  I don't see that patch was ever included
> > in mainline.  Do you happen to know if this patch is still needed or was
> > the bug we were seeing fixed in some other way?
> 
> I think it was superseded by later Mike's approach to reverse the logic
> - disable write same for all targets and require to explicitly allow it.
> 
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/md/dm-table.c?id=c1a94672a830e01d58c7c7e8de530c3f136d6ff2
> (+later patches)
> 
> So I think we do no need this patch upstream anymore.
> 
> Mike, am I right here?

Yeah, a DM target needs to opt-in by setting ti->num_write_same_bios
(only linear, stripe and mpath do at this time).

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-07-13 18:01 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14 20:30 [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME Joseph Salisbury
2012-12-14 21:11 ` Mike Snitzer
2012-12-15  2:38   ` Joseph Salisbury
2012-12-14 22:35 ` Martin K. Petersen
2012-12-15  2:40   ` Joseph Salisbury
2012-12-18 19:52   ` Joseph Salisbury
2012-12-19 16:58     ` Martin K. Petersen
2012-12-19 19:58       ` Mike Snitzer
2012-12-19 19:59         ` Joseph Salisbury
2012-12-19 20:45           ` Martin K. Petersen
2012-12-19 20:45         ` Martin K. Petersen
2012-12-19 20:45         ` Milan Broz
2012-12-19 21:07           ` [PATCH] dm-crypt: never use write same (was Re: [v3.7 Regression] [SCSI] sd: Implement support for WRITE SAME) Milan Broz
2012-12-19 21:07             ` Joseph Salisbury
2012-12-19 22:20             ` Joseph Salisbury
2012-12-19 22:23               ` Milan Broz
2015-07-13 16:33               ` Joseph Salisbury
2015-07-13 16:59                 ` Milan Broz
2015-07-13 17:01                 ` Milan Broz
2015-07-13 18:01                   ` Mike Snitzer
2012-12-20  0:11             ` [PATCH] " Martin K. Petersen
2012-12-20  5:47               ` Mike Snitzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).