diff mbox series

[4.19.y,3/5] dm table: fix partial completion iterate_devices based device capability checks

Message ID 20210305065526.72663-4-jefflexu@linux.alibaba.com
State Superseded
Headers show
Series dm: device capability check fixes | expand

Commit Message

Jingbo Xu March 5, 2021, 6:55 a.m. UTC
Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based
device capability checks"), fix partial completion capability check and
invert logic of the corresponding iterate_devices_callout_fn so that all
devices' partial completion capabilities are properly checked.

Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Fixes: 22c11858e800 ("dm: introduce DM_TYPE_NVME_BIO_BASED")
---
 drivers/md/dm-table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jingbo Xu March 5, 2021, 7:04 a.m. UTC | #1
On 3/5/21 2:55 PM, Jeffle Xu wrote:
> Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based
> device capability checks"), fix partial completion capability check and
> invert logic of the corresponding iterate_devices_callout_fn so that all
> devices' partial completion capabilities are properly checked.
> 
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
> Fixes: 22c11858e800 ("dm: introduce DM_TYPE_NVME_BIO_BASED")



Similarly, the code this patch fixes, i.e., commit 22c11858e800 ("dm:
introduce DM_TYPE_NVME_BIO_BASED"), was removed since commit
9c37de297f65 ("dm: remove special-casing of bio-based immutable
singleton target on NVMe") in v5.10. Thus the code base doesn't exist in
the latest master branch.

It needs Mike's review.
Jingbo Xu March 8, 2021, 3:25 a.m. UTC | #2
Hi, Mike,

Would you please spare some time to review the following patches for
stable tree?

- [1] for 4.19.y
- [2] for 5.4.y

While backporting [3] for stable tree, there's some extra code specific
to stable tree needs to be fixed, see [4] for the background info.

[1] https://www.spinics.net/lists/stable/msg448749.html
[2] https://www.spinics.net/lists/stable/msg448754.html
[3]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.12-rc2&id=a4c8dd9c2d0987cf542a2a0c42684c9c6d78a04e
[4] https://www.spinics.net/lists/stable/msg448760.html


Thanks,
Jeffle


On 3/5/21 2:55 PM, Jeffle Xu wrote:
> Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based

> device capability checks"), fix partial completion capability check and

> invert logic of the corresponding iterate_devices_callout_fn so that all

> devices' partial completion capabilities are properly checked.

> 

> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>

> Fixes: 22c11858e800 ("dm: introduce DM_TYPE_NVME_BIO_BASED")

> ---

>  drivers/md/dm-table.c | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

> 

> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c

> index 5a94e6dc0b70..1f745d371957 100644

> --- a/drivers/md/dm-table.c

> +++ b/drivers/md/dm-table.c

> @@ -1772,18 +1772,18 @@ static int queue_no_sg_merge(struct dm_target *ti, struct dm_dev *dev,

>  	return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);

>  }

>  

> -static int device_no_partial_completion(struct dm_target *ti, struct dm_dev *dev,

> +static int device_is_partial_completion(struct dm_target *ti, struct dm_dev *dev,

>  					sector_t start, sector_t len, void *data)

>  {

>  	char b[BDEVNAME_SIZE];

>  

>  	/* For now, NVMe devices are the only devices of this class */

> -	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) == 0);

> +	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) != 0);

>  }

>  

>  static bool dm_table_does_not_support_partial_completion(struct dm_table *t)

>  {

> -	return dm_table_all_devices_attribute(t, device_no_partial_completion);

> +	return !dm_table_any_dev_attr(t, device_is_partial_completion);

>  }

>  

>  static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,

> 


-- 
Thanks,
Jeffle
Jingbo Xu March 8, 2021, 2:52 p.m. UTC | #3
On 3/8/21 11:25 AM, JeffleXu wrote:
> Hi, Mike,

> 

> Would you please spare some time to review the following patches for

> stable tree?

> 

> - [1] for 4.19.y

> - [2] for 5.4.y

> 

> While backporting [3] for stable tree, there's some extra code specific

> to stable tree needs to be fixed, see [4] for the background info.

> 

> [1] https://www.spinics.net/lists/stable/msg448749.html

> [2] https://www.spinics.net/lists/stable/msg448754.html

> [3]

> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v5.12-rc2&id=a4c8dd9c2d0987cf542a2a0c42684c9c6d78a04e

> [4] https://www.spinics.net/lists/stable/msg448760.html

> 

> 


Also hold on until I send a new version. Sorry for the noise.

Thanks,
Jeffle


> 

> 

> On 3/5/21 2:55 PM, Jeffle Xu wrote:

>> Similar to commit a4c8dd9c2d09 ("dm table: fix iterate_devices based

>> device capability checks"), fix partial completion capability check and

>> invert logic of the corresponding iterate_devices_callout_fn so that all

>> devices' partial completion capabilities are properly checked.

>>

>> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>

>> Fixes: 22c11858e800 ("dm: introduce DM_TYPE_NVME_BIO_BASED")

>> ---

>>  drivers/md/dm-table.c | 6 +++---

>>  1 file changed, 3 insertions(+), 3 deletions(-)

>>

>> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c

>> index 5a94e6dc0b70..1f745d371957 100644

>> --- a/drivers/md/dm-table.c

>> +++ b/drivers/md/dm-table.c

>> @@ -1772,18 +1772,18 @@ static int queue_no_sg_merge(struct dm_target *ti, struct dm_dev *dev,

>>  	return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);

>>  }

>>  

>> -static int device_no_partial_completion(struct dm_target *ti, struct dm_dev *dev,

>> +static int device_is_partial_completion(struct dm_target *ti, struct dm_dev *dev,

>>  					sector_t start, sector_t len, void *data)

>>  {

>>  	char b[BDEVNAME_SIZE];

>>  

>>  	/* For now, NVMe devices are the only devices of this class */

>> -	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) == 0);

>> +	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) != 0);

>>  }

>>  

>>  static bool dm_table_does_not_support_partial_completion(struct dm_table *t)

>>  {

>> -	return dm_table_all_devices_attribute(t, device_no_partial_completion);

>> +	return !dm_table_any_dev_attr(t, device_is_partial_completion);

>>  }

>>  

>>  static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,

>>

> 


-- 
Thanks,
Jeffle
diff mbox series

Patch

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 5a94e6dc0b70..1f745d371957 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1772,18 +1772,18 @@  static int queue_no_sg_merge(struct dm_target *ti, struct dm_dev *dev,
 	return q && test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags);
 }
 
-static int device_no_partial_completion(struct dm_target *ti, struct dm_dev *dev,
+static int device_is_partial_completion(struct dm_target *ti, struct dm_dev *dev,
 					sector_t start, sector_t len, void *data)
 {
 	char b[BDEVNAME_SIZE];
 
 	/* For now, NVMe devices are the only devices of this class */
-	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) == 0);
+	return (strncmp(bdevname(dev->bdev, b), "nvme", 4) != 0);
 }
 
 static bool dm_table_does_not_support_partial_completion(struct dm_table *t)
 {
-	return dm_table_all_devices_attribute(t, device_no_partial_completion);
+	return !dm_table_any_dev_attr(t, device_is_partial_completion);
 }
 
 static int device_not_write_same_capable(struct dm_target *ti, struct dm_dev *dev,