* [PATCH] block: Add secure discard check in blk_ioctl_discard
@ 2018-12-25 5:44 zhengbin
2018-12-28 1:05 ` zhengbin (A)
2019-01-23 14:27 ` zhengbin (A)
0 siblings, 2 replies; 3+ messages in thread
From: zhengbin @ 2018-12-25 5:44 UTC (permalink / raw)
To: axboe, linux-block; +Cc: houtao1, zhaohongjiang, zhengbin13, yangerkun
blkdev_ioctl--->blk_ioctl_discard(BLKDISCARD or BLKSECDISCARD).
If cmd is BLKSECDISCARD and device does not support this cmd,
we will drop page cache(should not be dropped) and return
EOPNOTSUPP to caller. This patch fixes that.
Fixes: 351499a172c0 ("block: Invalidate cache on discard v2")
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
block/ioctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block/ioctl.c b/block/ioctl.c
index 4825c78..ee3a6af 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -212,6 +212,11 @@ static int blk_ioctl_discard(struct block_device *bdev, fmode_t mode,
if (!blk_queue_discard(q))
return -EOPNOTSUPP;
+ if (flags & BLKDEV_DISCARD_SECURE) {
+ if (!blk_queue_secure_erase(q))
+ return -EOPNOTSUPP;
+ }
+
if (copy_from_user(range, (void __user *)arg, sizeof(range)))
return -EFAULT;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: Add secure discard check in blk_ioctl_discard
2018-12-25 5:44 [PATCH] block: Add secure discard check in blk_ioctl_discard zhengbin
@ 2018-12-28 1:05 ` zhengbin (A)
2019-01-23 14:27 ` zhengbin (A)
1 sibling, 0 replies; 3+ messages in thread
From: zhengbin (A) @ 2018-12-28 1:05 UTC (permalink / raw)
To: axboe, linux-block; +Cc: houtao1, zhaohongjiang
hi, Jens Axboe
When you have time, confirm it? thanks
On 2018/12/25 13:44, zhengbin wrote:
> blkdev_ioctl--->blk_ioctl_discard(BLKDISCARD or BLKSECDISCARD).
> If cmd is BLKSECDISCARD and device does not support this cmd,
> we will drop page cache(should not be dropped) and return
> EOPNOTSUPP to caller. This patch fixes that.
>
> Fixes: 351499a172c0 ("block: Invalidate cache on discard v2")
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
> block/ioctl.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 4825c78..ee3a6af 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -212,6 +212,11 @@ static int blk_ioctl_discard(struct block_device *bdev, fmode_t mode,
> if (!blk_queue_discard(q))
> return -EOPNOTSUPP;
>
> + if (flags & BLKDEV_DISCARD_SECURE) {
> + if (!blk_queue_secure_erase(q))
> + return -EOPNOTSUPP;
> + }
> +
> if (copy_from_user(range, (void __user *)arg, sizeof(range)))
> return -EFAULT;
>
> --
> 2.7.4
>
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: Add secure discard check in blk_ioctl_discard
2018-12-25 5:44 [PATCH] block: Add secure discard check in blk_ioctl_discard zhengbin
2018-12-28 1:05 ` zhengbin (A)
@ 2019-01-23 14:27 ` zhengbin (A)
1 sibling, 0 replies; 3+ messages in thread
From: zhengbin (A) @ 2019-01-23 14:27 UTC (permalink / raw)
To: axboe, linux-block; +Cc: houtao1, zhaohongjiang, yangerkun
Ping?
On 2018/12/25 13:44, zhengbin wrote:
> blkdev_ioctl--->blk_ioctl_discard(BLKDISCARD or BLKSECDISCARD).
> If cmd is BLKSECDISCARD and device does not support this cmd,
> we will drop page cache(should not be dropped) and return
> EOPNOTSUPP to caller. This patch fixes that.
>
> Fixes: 351499a172c0 ("block: Invalidate cache on discard v2")
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> ---
> block/ioctl.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 4825c78..ee3a6af 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -212,6 +212,11 @@ static int blk_ioctl_discard(struct block_device *bdev, fmode_t mode,
> if (!blk_queue_discard(q))
> return -EOPNOTSUPP;
>
> + if (flags & BLKDEV_DISCARD_SECURE) {
> + if (!blk_queue_secure_erase(q))
> + return -EOPNOTSUPP;
> + }
> +
> if (copy_from_user(range, (void __user *)arg, sizeof(range)))
> return -EFAULT;
>
> --
> 2.7.4
>
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-23 14:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-25 5:44 [PATCH] block: Add secure discard check in blk_ioctl_discard zhengbin
2018-12-28 1:05 ` zhengbin (A)
2019-01-23 14:27 ` zhengbin (A)
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).