Skip to contentSkip to conversation

loop: Fix missing max_active argument in alloc_workqueue call

PATCH In review Colin King 8 participants 17 messages Mar 18, 2021 – Mar 19, 2021

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 loop: Fix missing max_active argument in alloc_workqueue call

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Addresses-Coverity: ("Missing argument to printf")

Fixes 08ad7f822739 ("loop: Use worker per cgroup instead of kworker")
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/loop.c +1 -1
index f2f9e4127847..ee2a6c1bc093 100644
@@ -1192,7 +1192,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
 	lo->workqueue = alloc_workqueue("loop%d",
 					WQ_UNBOUND | WQ_FREEZABLE |
 					WQ_MEM_RECLAIM,
-					lo->lo_number);
+					1, lo->lo_number);
 	if (!lo->workqueue) {
 		error = -ENOMEM;
 		goto out_unlock;
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Addresses-Coverity: ("Missing argument to printf")

Fixes 08ad7f822739 ("loop: Use worker per cgroup instead of kworker")
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/loop.c +0 -0
index f2f9e4127847..ee2a6c1bc093 100644

drivers/block/loop.c static int loop_configure(struct loop_device *lo, fmode_t mode, · line 1198

Quoted 8 lines
drivers/block/loop.c +1 -1
@@ -1192,7 +1192,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
 	lo->workqueue = alloc_workqueue("loop%d",
 					WQ_UNBOUND | WQ_FREEZABLE |
 					WQ_MEM_RECLAIM,
-					lo->lo_number);
+					1, lo->lo_number);
 	if (!lo->workqueue) {
 		error = -ENOMEM;
 		goto out_unlock;

Nice catch.

maintainer
#2 lore raw
In reply to Colin King
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Dan, please fold this (or something similar) in when you're redoing the series.

Signature · 1 line
Jens Axboe
#3 lore raw
Quoted 10 lines · Jens Axboe
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Dan, please fold this (or something similar) in when you're redoing the series.

Appreciate this fix being picked up. Are we going to lose the SoB?

Colin

maintainer
#4 lore raw
Quoted 4 lines · Colin Ian King
Quoted 3 lines · Jens Axboe
Quoted 2 lines · Colin King

From: Colin Ian King <[email protected]>

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Dan, please fold this (or something similar) in when you're redoing the series.

Appreciate this fix being picked up. Are we going to lose the SoB?

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

Signature · 1 line
Jens Axboe
#5 lore raw
Quoted 6 lines · Jens Axboe

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

Don't want to disturb the conversation that is going on there so I am only sending this question to janitors. What is the meaning of "folding" in this context?

Quoted 3 lines

--
Jens Axboe

#6 lore raw
Quoted 11 lines · Edmundo Carmona Antoranz
Quoted 6 lines · Jens Axboe

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

Don't want to disturb the conversation that is going on there so I am only sending this question to janitors. What is the meaning of "folding" in this context?

I think it means that someone other than the main author of the patch provided an improvement.

julia

#7 lore raw
Quoted 3 lines · Julia Lawall

I think it means that someone other than the main author of the patch provided an improvement.

Oh, Ok! Thanks!

Quoted 2 lines

julia

#8 lore raw
In reply to Edmundo Carmona Antoranz
Quoted 11 lines · Edmundo Carmona Antoranz
Quoted 6 lines · Jens Axboe

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

Don't want to disturb the conversation that is going on there so I am only sending this question to janitors. What is the meaning of "folding" in this context?

Folding means you squash two patches together. The patch Colin was fixing wasn't going to be merged for other reasons so we may as well fix this as well when Dan resends.

regards,
dan carpenter

#9 lore raw
In reply to Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 8 lines · Colin Ian King
Quoted 7 lines · Jens Axboe
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Dan, please fold this (or something similar) in when you're redoing the series.

Appreciate this fix being picked up. Are we going to lose the SoB?

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

I've always lobied for a Fixes-from: tag, but the kbuild-bot tells everyone to add a Reported-by: tag. But then a lot of people are like Reported-by doesn't make sense. And other people are like Reported-by is fine, what's wrong with it?

regards,
dan carpenter

#10 lore raw
Quoted 15 lines · Dan Carpenter
Quoted 14 lines · Jens Axboe
Quoted 12 lines · Colin Ian King
Quoted 10 lines · Jens Axboe
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Dan, please fold this (or something similar) in when you're redoing the series.

Appreciate this fix being picked up. Are we going to lose the SoB?

Quoted 8 lines
Quoted 3 lines

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

I've always lobied for a Fixes-from: tag, but the kbuild-bot tells everyone to add a Reported-by: tag. But then a lot of people are like Reported-by doesn't make sense. And other people are like Reported-by is fine, what's wrong with it?

If the original commit is a fix and the fix for it is being squashed, then Reported-by might mislead.

kbuild-bot tests also patches from list directly, so in such case the patch can be re-done with a risk of loosing kbuild's credits. But when the patch is already in the maintainer tree - just create a fixup. You preserve the development history and the kbuild's credits.

Best regards,
Krzysztof

maintainer
#11 lore raw
In reply to Dan Carpenter
Quoted 15 lines · Dan Carpenter
Quoted 14 lines · Jens Axboe
Quoted 12 lines · Colin Ian King
Quoted 10 lines · Jens Axboe
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Dan, please fold this (or something similar) in when you're redoing the series.

Appreciate this fix being picked up. Are we going to lose the SoB?

Quoted 8 lines
Quoted 3 lines

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

I've always lobied for a Fixes-from: tag, but the kbuild-bot tells everyone to add a Reported-by: tag. But then a lot of people are like Reported-by doesn't make sense. And other people are like Reported-by is fine, what's wrong with it?

I don't reported-by for this use either, as that is a lot more appropriate for a single fix that fixes an issue that was reported by (duh) that specific person.

Fixes-from seems a lot better.

Signature · 1 line
Jens Axboe
#12 lore raw
In reply to Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 8 lines · Colin Ian King
Quoted 7 lines · Jens Axboe
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Dan, please fold this (or something similar) in when you're redoing the series.

Appreciate this fix being picked up. Are we going to lose the SoB?

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

Why it is being redone if it was put into next? And even then, several other maintainers just apply a fix on top (I think Andrew Morton, Greg KH, Mark Brown) to avoid rebasing, preserve the history and also give credits to the fixer.

Anyway, if it is going to be squashed at least SoB would be nice (as Dan will take Colin's code).

Best regards,
Krzysztof

maintainer
#13 lore raw
Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Jens Axboe
Quoted 12 lines · Colin Ian King
Quoted 10 lines · Jens Axboe
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Dan, please fold this (or something similar) in when you're redoing the series.

Appreciate this fix being picked up. Are we going to lose the SoB?

Quoted 8 lines
Quoted 3 lines

If it's being redone, would be silly to have that error in there. Do we have a tag that's appropriate for this? I often wonder when I'm folding in a fix. Ala Fixes-by: or something like that.

Why it is being redone if it was put into next? And even then, several other maintainers just apply a fix on top (I think Andrew Morton, Greg KH, Mark Brown) to avoid rebasing, preserve the history and also give credits to the fixer.

linux-next doesn't have continual history, and I rebase my for-next all the time. Since the series was going to be re-done and applied to a different tree even, it would be silly to retain a bug _just_ so that we can have credits to the fixer separately. For this case, it's rebased anyway, and there's honestly not any history to preserve here. The only downside is losing the fixer attribution, which I do agree is annoying and hence why I asked/lobbied in a fixes-by kind of tag.

Signature · 1 line
Jens Axboe
#14 lore raw
In reply to Jens Axboe
Quoted 13 lines · Jens Axboe
Quoted 5 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Dan, please fold this (or something similar) in when you're redoing the series.

Signature · 1 line
Jens Axboe

Will do.

#15 lore raw
In reply to Colin King
Quoted 6 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Thanks for catching this Colin. I'm fairly new to kernel development. Is there some tool I could have run locally to catch this?

#16 lore raw
Quoted 11 lines · Dan Schatzberg
Quoted 6 lines · Colin King

From: Colin Ian King <[email protected]>

The 3rd argument to alloc_workqueue should be the max_active count, however currently it is the lo->lo_number that is intended for the loop%d number. Fix this by adding in the missing max_active count.

Thanks for catching this Colin. I'm fairly new to kernel development. Is there some tool I could have run locally to catch this?

I'm using Coverity to find these issues. There is a free version [1], but the one I use is licensed and has the scan level turned up quite high to catch more issues than the free service.

Refs: [1] https://scan.coverity.com/projects/linux-next-weekly-scan

Colin