diff mbox series

null_blk: Fix zone reset all tracing

Message ID 20201104052914.156163-1-damien.lemoal@wdc.com
State New
Headers show
Series null_blk: Fix zone reset all tracing | expand

Commit Message

Damien Le Moal Nov. 4, 2020, 5:29 a.m. UTC
commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.

In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is
ignored and the operation is applied to all sequential zones. For these
commands, tracing the effect of the command using the command sector to
determine the target zone is thus incorrect.

Fix null_zone_mgmt() zone condition tracing in the case of
REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are
not already empty.

Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 drivers/block/null_blk_zoned.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Greg Kroah-Hartman Nov. 4, 2020, 9:10 a.m. UTC | #1
On Wed, Nov 04, 2020 at 02:29:14PM +0900, Damien Le Moal wrote:
> commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.
> 
> In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is
> ignored and the operation is applied to all sequential zones. For these
> commands, tracing the effect of the command using the command sector to
> determine the target zone is thus incorrect.
> 
> Fix null_zone_mgmt() zone condition tracing in the case of
> REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are
> not already empty.
> 
> Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")
> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
>  drivers/block/null_blk_zoned.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)

Now queued up, thanks.

greg k-h
Greg Kroah-Hartman Nov. 4, 2020, 9:15 a.m. UTC | #2
On Wed, Nov 04, 2020 at 10:10:15AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Nov 04, 2020 at 02:29:14PM +0900, Damien Le Moal wrote:

> > commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.

> > 

> > In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is

> > ignored and the operation is applied to all sequential zones. For these

> > commands, tracing the effect of the command using the command sector to

> > determine the target zone is thus incorrect.

> > 

> > Fix null_zone_mgmt() zone condition tracing in the case of

> > REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are

> > not already empty.

> > 

> > Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")

> > Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>

> > Cc: stable@vger.kernel.org

> > Signed-off-by: Jens Axboe <axboe@kernel.dk>

> > ---

> >  drivers/block/null_blk_zoned.c | 14 ++++++++------

> >  1 file changed, 8 insertions(+), 6 deletions(-)

> 

> Now queued up, thanks.


Wait, no, I'll delay this one until the next round as it's not fixing
something introduced in this -rc series.

thanks,

greg k-h
Damien Le Moal Nov. 4, 2020, 9:21 a.m. UTC | #3
On 2020/11/04 18:14, Greg Kroah-Hartman wrote:
> On Wed, Nov 04, 2020 at 10:10:15AM +0100, Greg Kroah-Hartman wrote:
>> On Wed, Nov 04, 2020 at 02:29:14PM +0900, Damien Le Moal wrote:
>>> commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.
>>>
>>> In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is
>>> ignored and the operation is applied to all sequential zones. For these
>>> commands, tracing the effect of the command using the command sector to
>>> determine the target zone is thus incorrect.
>>>
>>> Fix null_zone_mgmt() zone condition tracing in the case of
>>> REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are
>>> not already empty.
>>>
>>> Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")
>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>> ---
>>>  drivers/block/null_blk_zoned.c | 14 ++++++++------
>>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> Now queued up, thanks.
> 
> Wait, no, I'll delay this one until the next round as it's not fixing
> something introduced in this -rc series.

Yes, that problem is older.
The lock fix I sent goes on top of this one though. I can send the backport for
the lock fix without this patch applied. Is that OK ?

> 
> thanks,
> 
> greg k-h
>
Greg Kroah-Hartman Nov. 4, 2020, 9:27 a.m. UTC | #4
On Wed, Nov 04, 2020 at 09:21:27AM +0000, Damien Le Moal wrote:
> On 2020/11/04 18:14, Greg Kroah-Hartman wrote:

> > On Wed, Nov 04, 2020 at 10:10:15AM +0100, Greg Kroah-Hartman wrote:

> >> On Wed, Nov 04, 2020 at 02:29:14PM +0900, Damien Le Moal wrote:

> >>> commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.

> >>>

> >>> In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is

> >>> ignored and the operation is applied to all sequential zones. For these

> >>> commands, tracing the effect of the command using the command sector to

> >>> determine the target zone is thus incorrect.

> >>>

> >>> Fix null_zone_mgmt() zone condition tracing in the case of

> >>> REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are

> >>> not already empty.

> >>>

> >>> Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")

> >>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>

> >>> Cc: stable@vger.kernel.org

> >>> Signed-off-by: Jens Axboe <axboe@kernel.dk>

> >>> ---

> >>>  drivers/block/null_blk_zoned.c | 14 ++++++++------

> >>>  1 file changed, 8 insertions(+), 6 deletions(-)

> >>

> >> Now queued up, thanks.

> > 

> > Wait, no, I'll delay this one until the next round as it's not fixing

> > something introduced in this -rc series.

> 

> Yes, that problem is older.

> The lock fix I sent goes on top of this one though. I can send the backport for

> the lock fix without this patch applied. Is that OK ?


If the order of the patches is needed, then yes, I can take both, please
submit them as a patch series so that I know this is needed.

thanks,

greg k-h
Damien Le Moal Nov. 4, 2020, 9:31 a.m. UTC | #5
On 2020/11/04 18:26, Greg Kroah-Hartman wrote:
> On Wed, Nov 04, 2020 at 09:21:27AM +0000, Damien Le Moal wrote:
>> On 2020/11/04 18:14, Greg Kroah-Hartman wrote:
>>> On Wed, Nov 04, 2020 at 10:10:15AM +0100, Greg Kroah-Hartman wrote:
>>>> On Wed, Nov 04, 2020 at 02:29:14PM +0900, Damien Le Moal wrote:
>>>>> commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.
>>>>>
>>>>> In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is
>>>>> ignored and the operation is applied to all sequential zones. For these
>>>>> commands, tracing the effect of the command using the command sector to
>>>>> determine the target zone is thus incorrect.
>>>>>
>>>>> Fix null_zone_mgmt() zone condition tracing in the case of
>>>>> REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are
>>>>> not already empty.
>>>>>
>>>>> Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")
>>>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
>>>>> Cc: stable@vger.kernel.org
>>>>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>>>> ---
>>>>>  drivers/block/null_blk_zoned.c | 14 ++++++++------
>>>>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>>>
>>>> Now queued up, thanks.
>>>
>>> Wait, no, I'll delay this one until the next round as it's not fixing
>>> something introduced in this -rc series.
>>
>> Yes, that problem is older.
>> The lock fix I sent goes on top of this one though. I can send the backport for
>> the lock fix without this patch applied. Is that OK ?
> 
> If the order of the patches is needed, then yes, I can take both, please
> submit them as a patch series so that I know this is needed.

OK. Sending that. Note that I still do not see Kanchan patch applied in stable
5.9.y branch, so I will do the backport assuming it is applied. Or I can send
all 3 patches as the series. Which do you prefer ?

> 
> thanks,
> 
> greg k-h
>
Greg Kroah-Hartman Nov. 4, 2020, 9:51 a.m. UTC | #6
On Wed, Nov 04, 2020 at 09:31:40AM +0000, Damien Le Moal wrote:
> On 2020/11/04 18:26, Greg Kroah-Hartman wrote:
> > On Wed, Nov 04, 2020 at 09:21:27AM +0000, Damien Le Moal wrote:
> >> On 2020/11/04 18:14, Greg Kroah-Hartman wrote:
> >>> On Wed, Nov 04, 2020 at 10:10:15AM +0100, Greg Kroah-Hartman wrote:
> >>>> On Wed, Nov 04, 2020 at 02:29:14PM +0900, Damien Le Moal wrote:
> >>>>> commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.
> >>>>>
> >>>>> In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is
> >>>>> ignored and the operation is applied to all sequential zones. For these
> >>>>> commands, tracing the effect of the command using the command sector to
> >>>>> determine the target zone is thus incorrect.
> >>>>>
> >>>>> Fix null_zone_mgmt() zone condition tracing in the case of
> >>>>> REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are
> >>>>> not already empty.
> >>>>>
> >>>>> Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")
> >>>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
> >>>>> Cc: stable@vger.kernel.org
> >>>>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> >>>>> ---
> >>>>>  drivers/block/null_blk_zoned.c | 14 ++++++++------
> >>>>>  1 file changed, 8 insertions(+), 6 deletions(-)
> >>>>
> >>>> Now queued up, thanks.
> >>>
> >>> Wait, no, I'll delay this one until the next round as it's not fixing
> >>> something introduced in this -rc series.
> >>
> >> Yes, that problem is older.
> >> The lock fix I sent goes on top of this one though. I can send the backport for
> >> the lock fix without this patch applied. Is that OK ?
> > 
> > If the order of the patches is needed, then yes, I can take both, please
> > submit them as a patch series so that I know this is needed.
> 
> OK. Sending that. Note that I still do not see Kanchan patch applied in stable
> 5.9.y branch, so I will do the backport assuming it is applied. Or I can send
> all 3 patches as the series. Which do you prefer ?

All 3 is great, to ensure I have them all as I don't know what you mean
by "Kanchan patch".

thanks,

greg k-h
Damien Le Moal Nov. 4, 2020, 9:54 a.m. UTC | #7
On 2020/11/04 18:50, Greg Kroah-Hartman wrote:
> On Wed, Nov 04, 2020 at 09:31:40AM +0000, Damien Le Moal wrote:
>> On 2020/11/04 18:26, Greg Kroah-Hartman wrote:
>>> On Wed, Nov 04, 2020 at 09:21:27AM +0000, Damien Le Moal wrote:
>>>> On 2020/11/04 18:14, Greg Kroah-Hartman wrote:
>>>>> On Wed, Nov 04, 2020 at 10:10:15AM +0100, Greg Kroah-Hartman wrote:
>>>>>> On Wed, Nov 04, 2020 at 02:29:14PM +0900, Damien Le Moal wrote:
>>>>>>> commit f9c9104288da543cd64f186f9e2fba389f415630 upstream.
>>>>>>>
>>>>>>> In the cae of the REQ_OP_ZONE_RESET_ALL operation, the command sector is
>>>>>>> ignored and the operation is applied to all sequential zones. For these
>>>>>>> commands, tracing the effect of the command using the command sector to
>>>>>>> determine the target zone is thus incorrect.
>>>>>>>
>>>>>>> Fix null_zone_mgmt() zone condition tracing in the case of
>>>>>>> REQ_OP_ZONE_RESET_ALL to apply tracing to all sequential zones that are
>>>>>>> not already empty.
>>>>>>>
>>>>>>> Fixes: 766c3297d7e1 ("null_blk: add trace in null_blk_zoned.c")
>>>>>>> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
>>>>>>> Cc: stable@vger.kernel.org
>>>>>>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>>>>>> ---
>>>>>>>  drivers/block/null_blk_zoned.c | 14 ++++++++------
>>>>>>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>>>>>
>>>>>> Now queued up, thanks.
>>>>>
>>>>> Wait, no, I'll delay this one until the next round as it's not fixing
>>>>> something introduced in this -rc series.
>>>>
>>>> Yes, that problem is older.
>>>> The lock fix I sent goes on top of this one though. I can send the backport for
>>>> the lock fix without this patch applied. Is that OK ?
>>>
>>> If the order of the patches is needed, then yes, I can take both, please
>>> submit them as a patch series so that I know this is needed.
>>
>> OK. Sending that. Note that I still do not see Kanchan patch applied in stable
>> 5.9.y branch, so I will do the backport assuming it is applied. Or I can send
>> all 3 patches as the series. Which do you prefer ?
> 
> All 3 is great, to ensure I have them all as I don't know what you mean
> by "Kanchan patch".

I was talking about "
commit 35bc10b2eafbb701064b94f283b77c54d3304842 upstream." that you already
applied to 5.9.y.

Sending all 3 patches backported in a series to be sure. SInce the first patchin
the series will be the above mentioned patch, everything should still apply
cleanly on your side. Thanks!

> 
> thanks,
> 
> greg k-h
>
diff mbox series

Patch

diff --git a/drivers/block/null_blk_zoned.c b/drivers/block/null_blk_zoned.c
index 3d25c9ad2383..fcbbe2e4ef2d 100644
--- a/drivers/block/null_blk_zoned.c
+++ b/drivers/block/null_blk_zoned.c
@@ -226,13 +226,15 @@  static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
 
 	switch (op) {
 	case REQ_OP_ZONE_RESET_ALL:
-		for (i = 0; i < dev->nr_zones; i++) {
-			if (zone[i].type == BLK_ZONE_TYPE_CONVENTIONAL)
-				continue;
-			zone[i].cond = BLK_ZONE_COND_EMPTY;
-			zone[i].wp = zone[i].start;
+		for (i = dev->zone_nr_conv; i < dev->nr_zones; i++) {
+			zone = &dev->zones[i];
+			if (zone->cond != BLK_ZONE_COND_EMPTY) {
+				zone->cond = BLK_ZONE_COND_EMPTY;
+				zone->wp = zone->start;
+				trace_nullb_zone_op(cmd, i, zone->cond);
+			}
 		}
-		break;
+		return BLK_STS_OK;
 	case REQ_OP_ZONE_RESET:
 		if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
 			return BLK_STS_IOERR;