Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] block: allow zone_mgmt_ops to bail out on SIGKILL
@ 2019-11-08 23:38 Chaitanya Kulkarni
  2019-11-09  1:39 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Chaitanya Kulkarni @ 2019-11-08 23:38 UTC (permalink / raw)
  To: linux-block; +Cc: damien.lemoal, Chaitanya Kulkarni

This patch is on the similar concept which is posted earlier:-
https://marc.info/?l=linux-block&m=157321402002207&w=2.

This allows zone-mgmt ops to handle SIGKILL.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---

In case someone is interested here is the test on null blk with
added prints for zoneid.

Without this patch :-

# blkzone reset -o 0 -c 1000 /dev/nullb0 
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

[  174.115065] null_blk: null_zone_mgmt 163 zoneid 993
[  174.125071] null_blk: null_zone_mgmt 163 zoneid 994
[  174.135076] null_blk: null_zone_mgmt 163 zoneid 995
[  174.145082] null_blk: null_zone_mgmt 163 zoneid 996
[  174.155087] null_blk: null_zone_mgmt 163 zoneid 997
[  174.165091] null_blk: null_zone_mgmt 163 zoneid 998
[  174.175096] null_blk: null_zone_mgmt 163 zoneid 999

With this patch :-
 # blkzone reset -o 0 -c 1000 /dev/nullb0
^C

[  211.889379] null_blk: null_zone_mgmt 163 zoneid 191
[  211.899420] null_blk: null_zone_mgmt 163 zoneid 192
[  211.909424] null_blk: null_zone_mgmt 163 zoneid 193

---
 block/blk-zoned.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 481eaf7d04d4..07ff2b75e6d7 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/sched/mm.h>
+#include <linux/sched/signal.h>
 
 #include "blk.h"
 
@@ -287,6 +288,8 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,
 
 		/* This may take a while, so be nice to others */
 		cond_resched();
+		if (fatal_signal_pending(current))
+			break;
 	}
 
 	ret = submit_bio_wait(bio);
-- 
2.22.1


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

* Re: [PATCH] block: allow zone_mgmt_ops to bail out on SIGKILL
  2019-11-08 23:38 [PATCH] block: allow zone_mgmt_ops to bail out on SIGKILL Chaitanya Kulkarni
@ 2019-11-09  1:39 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2019-11-09  1:39 UTC (permalink / raw)
  To: Chaitanya Kulkarni, linux-block

On 2019/11/09 8:38, Chaitanya Kulkarni wrote:
> This patch is on the similar concept which is posted earlier:-
> https://marc.info/?l=linux-block&m=157321402002207&w=2.
> 
> This allows zone-mgmt ops to handle SIGKILL.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
> 
> In case someone is interested here is the test on null blk with
> added prints for zoneid.
> 
> Without this patch :-
> 
> # blkzone reset -o 0 -c 1000 /dev/nullb0 
> ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
> 
> [  174.115065] null_blk: null_zone_mgmt 163 zoneid 993
> [  174.125071] null_blk: null_zone_mgmt 163 zoneid 994
> [  174.135076] null_blk: null_zone_mgmt 163 zoneid 995
> [  174.145082] null_blk: null_zone_mgmt 163 zoneid 996
> [  174.155087] null_blk: null_zone_mgmt 163 zoneid 997
> [  174.165091] null_blk: null_zone_mgmt 163 zoneid 998
> [  174.175096] null_blk: null_zone_mgmt 163 zoneid 999
> 
> With this patch :-
>  # blkzone reset -o 0 -c 1000 /dev/nullb0
> ^C
> 
> [  211.889379] null_blk: null_zone_mgmt 163 zoneid 191
> [  211.899420] null_blk: null_zone_mgmt 163 zoneid 192
> [  211.909424] null_blk: null_zone_mgmt 163 zoneid 193
> 
> ---
>  block/blk-zoned.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/block/blk-zoned.c b/block/blk-zoned.c
> index 481eaf7d04d4..07ff2b75e6d7 100644
> --- a/block/blk-zoned.c
> +++ b/block/blk-zoned.c
> @@ -17,6 +17,7 @@
>  #include <linux/mm.h>
>  #include <linux/vmalloc.h>
>  #include <linux/sched/mm.h>
> +#include <linux/sched/signal.h>
>  
>  #include "blk.h"
>  
> @@ -287,6 +288,8 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,
>  
>  		/* This may take a while, so be nice to others */
>  		cond_resched();
> +		if (fatal_signal_pending(current))
> +			break;

I think that if the loop over the zone range is interrupted short,
-EINTR should be returned even if the following submit_bio_wait() call
succeeds. So may be an additional check is needed at the end of the
function.

>  	}
>  
>  	ret = submit_bio_wait(bio);
> 


-- 
Damien Le Moal
Western Digital Research

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 23:38 [PATCH] block: allow zone_mgmt_ops to bail out on SIGKILL Chaitanya Kulkarni
2019-11-09  1:39 ` Damien Le Moal

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git