* Re: raid0 vs. mkfs
From: Avi Kivity @ 2017-06-29 15:36 UTC (permalink / raw)
To: Coly Li, Shaohua Li; +Cc: NeilBrown, linux-raid, linux-block
In-Reply-To: <9a46c760-904a-8318-b06c-0cf19e0651dc@suse.de>
On 06/29/2017 06:31 PM, Coly Li wrote:
> On 2017/6/29 下午11:15, Avi Kivity wrote:
>>
>> On 12/08/2016 06:44 PM, Coly Li wrote:
>>> On 2016/12/8 上午12:59, Shaohua Li wrote:
>>>> On Wed, Dec 07, 2016 at 07:50:33PM +0800, Coly Li wrote:
>>> [snip]
>>>> Thanks for doing this, Coly! For raid0, this totally makes sense. The
>>>> raid0
>>>> zones make things a little complicated though. I just had a brief
>>>> look of your
>>>> proposed patch, which looks really complicated. I'd suggest something
>>>> like
>>>> this:
>>>> 1. split the bio according to zone boundary.
>>>> 2. handle the splitted bio. since the bio is within zone range,
>>>> calculating
>>>> the start and end sector for each rdev should be easy.
>>>>
>>> Hi Shaohua,
>>>
>>> Thanks for your suggestion! I try to modify the code by your suggestion,
>>> it is even more hard to make the code that way ...
>>>
>>> Because even split bios for each zone, all the corner cases still exist
>>> and should be taken care in every zoon. The code will be more
>>> complicated.
>>>
>> Hi Coly,
>>
>> Did you manage to complete this patch? We are seeing its effect, not
>> only with mkfs, but also with fstrim(8).
> Hi Avi,
>
> Shaohua makes another much better patch, which is merged into mainline
> kernel in v4.12-rc2.
>
> The commit is '29efc390b946 ("md/md0: optimize raid0 discard handling")'.
>
> Hope this is informative.
>
Thanks a lot, that's great news.
^ permalink raw reply
* Re: [PATCH v2 11/51] md: raid1: initialize bvec table via bio_add_page()
From: Shaohua Li @ 2017-06-29 19:00 UTC (permalink / raw)
To: Ming Lei
Cc: Guoqing Jiang, Jens Axboe, Christoph Hellwig, linux-kernel,
linux-block, linux-raid
In-Reply-To: <20170627162242.GA19610@ming.t460p>
On Wed, Jun 28, 2017 at 12:22:51AM +0800, Ming Lei wrote:
> On Tue, Jun 27, 2017 at 05:36:39PM +0800, Guoqing Jiang wrote:
> >
> >
> > On 06/26/2017 08:09 PM, Ming Lei wrote:
> > > We will support multipage bvec soon, so initialize bvec
> > > table using the standardy way instead of writing the
> > > talbe directly. Otherwise it won't work any more once
> > > multipage bvec is enabled.
> > >
> > > Cc: Shaohua Li <shli@kernel.org>
> > > Cc: linux-raid@vger.kernel.org
> > > Signed-off-by: Ming Lei <ming.lei@redhat.com>
> > > ---
> > > drivers/md/raid1.c | 27 ++++++++++++++-------------
> > > 1 file changed, 14 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> > > index 3febfc8391fb..835c42396861 100644
> > > --- a/drivers/md/raid1.c
> > > +++ b/drivers/md/raid1.c
> > > @@ -2086,10 +2086,8 @@ static void process_checks(struct r1bio *r1_bio)
> > > /* Fix variable parts of all bios */
> > > vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
> > > for (i = 0; i < conf->raid_disks * 2; i++) {
> > > - int j;
> > > int size;
> > > blk_status_t status;
> > > - struct bio_vec *bi;
> > > struct bio *b = r1_bio->bios[i];
> > > struct resync_pages *rp = get_resync_pages(b);
> > > if (b->bi_end_io != end_sync_read)
> > > @@ -2098,8 +2096,6 @@ static void process_checks(struct r1bio *r1_bio)
> > > status = b->bi_status;
> > > bio_reset(b);
> > > b->bi_status = status;
> > > - b->bi_vcnt = vcnt;
> > > - b->bi_iter.bi_size = r1_bio->sectors << 9;
> > > b->bi_iter.bi_sector = r1_bio->sector +
> > > conf->mirrors[i].rdev->data_offset;
> > > b->bi_bdev = conf->mirrors[i].rdev->bdev;
> > > @@ -2107,15 +2103,20 @@ static void process_checks(struct r1bio *r1_bio)
> > > rp->raid_bio = r1_bio;
> > > b->bi_private = rp;
> > > - size = b->bi_iter.bi_size;
> > > - bio_for_each_segment_all(bi, b, j) {
> > > - bi->bv_offset = 0;
> > > - if (size > PAGE_SIZE)
> > > - bi->bv_len = PAGE_SIZE;
> > > - else
> > > - bi->bv_len = size;
> > > - size -= PAGE_SIZE;
> > > - }
> > > + /* initialize bvec table again */
> > > + rp->idx = 0;
> > > + size = r1_bio->sectors << 9;
> > > + do {
> > > + struct page *page = resync_fetch_page(rp, rp->idx++);
> > > + int len = min_t(int, size, PAGE_SIZE);
> > > +
> > > + /*
> > > + * won't fail because the vec table is big
> > > + * enough to hold all these pages
> > > + */
> > > + bio_add_page(b, page, len, 0);
> > > + size -= len;
> > > + } while (rp->idx < RESYNC_PAGES && size > 0);
> > > }
> >
> > Seems above section is similar as reset_bvec_table introduced in next patch,
> > why there is difference between raid1 and raid10? Maybe add reset_bvec_table
> > into md.c, then call it in raid1 or raid10 is better, just my 2 cents.
>
> Hi Guoqing,
>
> I think it is a good idea, and even the two patches can be put into
> one, so how about the following patch?
>
> Shaohua, what do you think of this one?
generally looks good.
> ---
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 3d957ac1e109..7ffc622dd7fa 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -9126,6 +9126,24 @@ void md_reload_sb(struct mddev *mddev, int nr)
> }
> EXPORT_SYMBOL(md_reload_sb);
>
> +/* generally called after bio_reset() for reseting bvec */
> +void reset_bvec_table(struct bio *bio, struct resync_pages *rp, int size)
> +{
> + /* initialize bvec table again */
> + rp->idx = 0;
> + do {
> + struct page *page = resync_fetch_page(rp, rp->idx++);
> + int len = min_t(int, size, PAGE_SIZE);
> +
> + /*
> + * won't fail because the vec table is big
> + * enough to hold all these pages
> + */
> + bio_add_page(bio, page, len, 0);
> + size -= len;
> + } while (rp->idx < RESYNC_PAGES && size > 0);
> +}
> +
used in raid1/10, so must export the symbol. Then please not pollute global
names, maybe call it md_bio_reset_resync_pages?
> #ifndef MODULE
>
> /*
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 991f0fe2dcc6..f569831b1de9 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -783,4 +783,6 @@ static inline struct page *resync_fetch_page(struct resync_pages *rp,
> return NULL;
> return rp->pages[idx];
> }
> +
> +void reset_bvec_table(struct bio *bio, struct resync_pages *rp, int size);
> #endif /* _MD_MD_H */
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 3febfc8391fb..6ae2665ecd58 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -2086,10 +2086,7 @@ static void process_checks(struct r1bio *r1_bio)
> /* Fix variable parts of all bios */
> vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
> for (i = 0; i < conf->raid_disks * 2; i++) {
> - int j;
> - int size;
> blk_status_t status;
> - struct bio_vec *bi;
> struct bio *b = r1_bio->bios[i];
> struct resync_pages *rp = get_resync_pages(b);
> if (b->bi_end_io != end_sync_read)
> @@ -2098,8 +2095,6 @@ static void process_checks(struct r1bio *r1_bio)
> status = b->bi_status;
> bio_reset(b);
> b->bi_status = status;
> - b->bi_vcnt = vcnt;
> - b->bi_iter.bi_size = r1_bio->sectors << 9;
> b->bi_iter.bi_sector = r1_bio->sector +
> conf->mirrors[i].rdev->data_offset;
> b->bi_bdev = conf->mirrors[i].rdev->bdev;
> @@ -2107,15 +2102,8 @@ static void process_checks(struct r1bio *r1_bio)
> rp->raid_bio = r1_bio;
> b->bi_private = rp;
>
> - size = b->bi_iter.bi_size;
> - bio_for_each_segment_all(bi, b, j) {
> - bi->bv_offset = 0;
> - if (size > PAGE_SIZE)
> - bi->bv_len = PAGE_SIZE;
> - else
> - bi->bv_len = size;
> - size -= PAGE_SIZE;
> - }
> + /* initialize bvec table again */
> + reset_bvec_table(b, rp, r1_bio->sectors << 9);
> }
> for (primary = 0; primary < conf->raid_disks * 2; primary++)
> if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 5026e7ad51d3..72f4fa07449b 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2087,8 +2087,8 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
> rp = get_resync_pages(tbio);
> bio_reset(tbio);
>
> - tbio->bi_vcnt = vcnt;
> - tbio->bi_iter.bi_size = fbio->bi_iter.bi_size;
> + reset_bvec_table(tbio, rp, fbio->bi_iter.bi_size);
> +
> rp->raid_bio = r10_bio;
> tbio->bi_private = rp;
> tbio->bi_iter.bi_sector = r10_bio->devs[i].addr;
>
> Thanks,
> Ming
^ permalink raw reply
* Re: Big Endian RAID discovery problem (metadata 1!)
From: Shaohua Li @ 2017-06-29 21:54 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: Adam Thompson, linux-raid
In-Reply-To: <10863311.m9o1njCPed@daneel.sf-tec.de>
On Wed, Jun 28, 2017 at 10:14:21PM +0200, Rolf Eike Beer wrote:
> Am Mittwoch, 28. Juni 2017, 13:55:09 schrieb Adam Thompson:
> > If you search the archives, I had a very similar problem a few months ago.
> > There is already an option to mdadm to update a v1 superblock in the wrong
> > byte order. It just wasn't obvious when looking at the mdadm man page.
> > Going from memory, search for "byte order" instead of "endian" to find the
> > option. -Adam
>
> If you refer to --update=byteorder, the documentation says it is only for
> v0.90 metadata. Also it's only the super_offset field so far, other fields like
> magic are correct.
There are patches in this side to correctly handle endian:
1345921393ba md: fix incorrect use of lexx_to_cpu in does_sb_need_changing
3fb632e40d76 md: fix super_offset endianness in super_1_rdev_size_change
probably we should make these into -stable tree, but I never got reports on
this side. can you try?
Thanks,
Shaohua
^ permalink raw reply
* [PATCH] md: add a 'md_numa_node' module parameter
From: Zhengyuan Liu @ 2017-06-30 8:57 UTC (permalink / raw)
To: linux-raid; +Cc: shli, neilb, liuyun01
This module parameter allows user to control which numa node
the memory for mainly structures (e.g. mddev, md_rdev,
request_queue, gendisk) is allocated from. The idea came from
commit 115485e83f49 ("dm: add 'dm_numa_node' module parameter").
If we don't set this parameter while loading module, it won't
affect the md default behavior.
numa_node_id field is added so personality such as raid0 could
inherit the node from mddev, for other personality which has its
own handling thread we could add such a module parameter too.I
would send those patches soon.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
drivers/md/md.c | 13 +++++++++----
drivers/md/md.h | 2 ++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 092b48f..aa44e92 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -184,6 +184,8 @@ static int start_readonly;
*/
static bool create_on_open = true;
+static int md_numa_node = NUMA_NO_NODE;
+
/* bio_clone_mddev
* like bio_clone, but with a local bio set
*/
@@ -588,7 +590,7 @@ static struct mddev *mddev_find(dev_t unit)
}
spin_unlock(&all_mddevs_lock);
- new = kzalloc(sizeof(*new), GFP_KERNEL);
+ new = kzalloc_node(sizeof(*new), GFP_KERNEL, md_numa_node);
if (!new)
return NULL;
@@ -598,6 +600,7 @@ static struct mddev *mddev_find(dev_t unit)
else
new->md_minor = MINOR(unit) >> MdpMinorShift;
+ new->numa_node_id = md_numa_node;
mddev_init(new);
goto retry;
@@ -3387,7 +3390,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
struct md_rdev *rdev;
sector_t size;
- rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
+ rdev = kzalloc_node(sizeof(*rdev), GFP_KERNEL, md_numa_node);
if (!rdev)
return ERR_PTR(-ENOMEM);
@@ -5256,7 +5259,7 @@ static int md_alloc(dev_t dev, char *name)
mddev->hold_active = UNTIL_STOP;
error = -ENOMEM;
- mddev->queue = blk_alloc_queue(GFP_KERNEL);
+ mddev->queue = blk_alloc_queue_node(GFP_KERNEL, md_numa_node);
if (!mddev->queue)
goto abort;
mddev->queue->queuedata = mddev;
@@ -5264,7 +5267,7 @@ static int md_alloc(dev_t dev, char *name)
blk_queue_make_request(mddev->queue, md_make_request);
blk_set_stacking_limits(&mddev->queue->limits);
- disk = alloc_disk(1 << shift);
+ disk = alloc_disk_node(1 << shift, md_numa_node);
if (!disk) {
blk_cleanup_queue(mddev->queue);
mddev->queue = NULL;
@@ -9252,6 +9255,8 @@ module_param_call(start_ro, set_ro, get_ro, NULL, S_IRUSR|S_IWUSR);
module_param(start_dirty_degraded, int, S_IRUGO|S_IWUSR);
module_param_call(new_array, add_named_array, NULL, NULL, S_IWUSR);
module_param(create_on_open, bool, S_IRUSR|S_IWUSR);
+module_param(md_numa_node, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(md_numa_node, "NUMA node for md device memory allocations");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MD RAID framework");
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 991f0fe..5c91033 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -459,6 +459,8 @@ struct mddev {
void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev);
struct md_cluster_info *cluster_info;
unsigned int good_device_nr; /* good device num within cluster raid */
+
+ int numa_node_id;
};
enum recovery_flags {
--
2.7.4
^ permalink raw reply related
* Re: Big Endian RAID discovery problem (metadata 1!)
From: Rolf Eike Beer @ 2017-06-30 10:23 UTC (permalink / raw)
To: Shaohua Li; +Cc: Adam Thompson, linux-raid
In-Reply-To: <20170629215453.oswihni5xwcsbihq@kernel.org>
Am 2017-06-29 23:54, schrieb Shaohua Li:
> On Wed, Jun 28, 2017 at 10:14:21PM +0200, Rolf Eike Beer wrote:
>> Am Mittwoch, 28. Juni 2017, 13:55:09 schrieb Adam Thompson:
>> > If you search the archives, I had a very similar problem a few months ago.
>> > There is already an option to mdadm to update a v1 superblock in the wrong
>> > byte order. It just wasn't obvious when looking at the mdadm man page.
>> > Going from memory, search for "byte order" instead of "endian" to find the
>> > option. -Adam
>>
>> If you refer to --update=byteorder, the documentation says it is only
>> for
>> v0.90 metadata. Also it's only the super_offset field so far, other
>> fields like
>> magic are correct.
>
> There are patches in this side to correctly handle endian:
>
> 1345921393ba md: fix incorrect use of lexx_to_cpu in
> does_sb_need_changing
> 3fb632e40d76 md: fix super_offset endianness in
> super_1_rdev_size_change
>
> probably we should make these into -stable tree, but I never got
> reports on
> this side. can you try?
That likely is the problem, it was kernel 4.10.2 that was used when the
array was expanded. Yes, this should really get backported. And
something like "byteorder2" for mdadm to make it easier for people with
such arrays to fix that would be awesome.
After changing the sb_offset and csum fields (and UUID, to avoid bad
resync from the old member on sda2) and writing the sectors back my
array now works again.
Eike
^ permalink raw reply
* Re: [PATCH] md: add a 'md_numa_node' module parameter
From: Coly Li @ 2017-06-30 11:13 UTC (permalink / raw)
To: Zhengyuan Liu, linux-raid; +Cc: shli, neilb, liuyun01
In-Reply-To: <1498813021-2538-1-git-send-email-liuzhengyuan@kylinos.cn>
On 2017/6/30 下午4:57, Zhengyuan Liu wrote:
> This module parameter allows user to control which numa node
> the memory for mainly structures (e.g. mddev, md_rdev,
> request_queue, gendisk) is allocated from. The idea came from
> commit 115485e83f49 ("dm: add 'dm_numa_node' module parameter").
> If we don't set this parameter while loading module, it won't
> affect the md default behavior.
>
> numa_node_id field is added so personality such as raid0 could
> inherit the node from mddev, for other personality which has its
> own handling thread we could add such a module parameter too.I
> would send those patches soon.
>
> Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
NACK.
md_numa_node can be any minus value other then -1. kzalloc_node() only
accepts minus node id as -1 (NUMA_NO_NODE), for other minus value sent
into kzalloc() may trigger a VM_BUG_ON(), see
include/linux/gfp.h:__alloc_pages_node(),
449 static inline struct page *
450 __alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order)
451 {
452 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
453 VM_WARN_ON(!node_online(nid));
454
455 return __alloc_pages(gfp_mask, order, node_zonelist(nid,
gfp_mask));
456 }
That means you introduce a method to panic kernel by loading md kenrel
module.
So if you want to make it work correctly, you should formulate
md_numa_node in range of [-1, MAX_NUMNODES).
Coly
> ---
> drivers/md/md.c | 13 +++++++++----
> drivers/md/md.h | 2 ++
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 092b48f..aa44e92 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -184,6 +184,8 @@ static int start_readonly;
> */
> static bool create_on_open = true;
>
> +static int md_numa_node = NUMA_NO_NODE;
> +
> /* bio_clone_mddev
> * like bio_clone, but with a local bio set
> */
> @@ -588,7 +590,7 @@ static struct mddev *mddev_find(dev_t unit)
> }
> spin_unlock(&all_mddevs_lock);
>
> - new = kzalloc(sizeof(*new), GFP_KERNEL);
> + new = kzalloc_node(sizeof(*new), GFP_KERNEL, md_numa_node);
> if (!new)
> return NULL;
>
> @@ -598,6 +600,7 @@ static struct mddev *mddev_find(dev_t unit)
> else
> new->md_minor = MINOR(unit) >> MdpMinorShift;
>
> + new->numa_node_id = md_numa_node;
> mddev_init(new);
>
> goto retry;
> @@ -3387,7 +3390,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
> struct md_rdev *rdev;
> sector_t size;
>
> - rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
> + rdev = kzalloc_node(sizeof(*rdev), GFP_KERNEL, md_numa_node);
> if (!rdev)
> return ERR_PTR(-ENOMEM);
>
> @@ -5256,7 +5259,7 @@ static int md_alloc(dev_t dev, char *name)
> mddev->hold_active = UNTIL_STOP;
>
> error = -ENOMEM;
> - mddev->queue = blk_alloc_queue(GFP_KERNEL);
> + mddev->queue = blk_alloc_queue_node(GFP_KERNEL, md_numa_node);
> if (!mddev->queue)
> goto abort;
> mddev->queue->queuedata = mddev;
> @@ -5264,7 +5267,7 @@ static int md_alloc(dev_t dev, char *name)
> blk_queue_make_request(mddev->queue, md_make_request);
> blk_set_stacking_limits(&mddev->queue->limits);
>
> - disk = alloc_disk(1 << shift);
> + disk = alloc_disk_node(1 << shift, md_numa_node);
> if (!disk) {
> blk_cleanup_queue(mddev->queue);
> mddev->queue = NULL;
> @@ -9252,6 +9255,8 @@ module_param_call(start_ro, set_ro, get_ro, NULL, S_IRUSR|S_IWUSR);
> module_param(start_dirty_degraded, int, S_IRUGO|S_IWUSR);
> module_param_call(new_array, add_named_array, NULL, NULL, S_IWUSR);
> module_param(create_on_open, bool, S_IRUSR|S_IWUSR);
> +module_param(md_numa_node, int, S_IRUGO | S_IWUSR);
> +MODULE_PARM_DESC(md_numa_node, "NUMA node for md device memory allocations");
>
> MODULE_LICENSE("GPL");
> MODULE_DESCRIPTION("MD RAID framework");
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 991f0fe..5c91033 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -459,6 +459,8 @@ struct mddev {
> void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev);
> struct md_cluster_info *cluster_info;
> unsigned int good_device_nr; /* good device num within cluster raid */
> +
> + int numa_node_id;
> };
>
> enum recovery_flags {
>
^ permalink raw reply
* Re: Disk Monitoring
From: Gandalf Corvotempesta @ 2017-06-30 12:35 UTC (permalink / raw)
To: Wols Lists; +Cc: linux-raid
In-Reply-To: <59550FCB.4090508@youngman.org.uk>
2017-06-29 16:33 GMT+02:00 Wols Lists <antlists@youngman.org.uk>:
> In other words, a patrol check looks for a failing disk. A consistency
> check looks for corrupt data. (A consistency check does a patrol check
> as a side effect, but you might not want to do just that, as it is
> computationally much more expensive. You might want to do a patrol check
> every day, and a consistency check of a weekend.)
Ok, so, if resources are not a problem, someone could only run a
consistency check and totally skip the patrol check. Right ?
What about md reliability? There are many detractors out there.
https://bugzilla.kernel.org/show_bug.cgi?id=99171
One of the most common complaint is the absence of write-back cache,
and if you force a "writeback" you'll risk data loss in case of
unclean shutdown (power failure and so on)
^ permalink raw reply
* Re: Disk Monitoring
From: Phil Turmel @ 2017-06-30 14:35 UTC (permalink / raw)
To: Gandalf Corvotempesta, Wols Lists; +Cc: linux-raid
In-Reply-To: <CAJH6TXg+xf0giY5bC_ug4jm+t88LzHkTVJq_BYeYzxEKedF2OA@mail.gmail.com>
On 06/30/2017 08:35 AM, Gandalf Corvotempesta wrote:
> 2017-06-29 16:33 GMT+02:00 Wols Lists <antlists@youngman.org.uk>:
>> In other words, a patrol check looks for a failing disk. A consistency
>> check looks for corrupt data. (A consistency check does a patrol check
>> as a side effect, but you might not want to do just that, as it is
>> computationally much more expensive. You might want to do a patrol check
>> every day, and a consistency check of a weekend.)
>
> Ok, so, if resources are not a problem, someone could only run a
> consistency check and totally skip the patrol check. Right ?
Hardware raid and MD raid are not directly comparable. Based on your
description, patrol read and consistency check are separate functions in
your hardware raid. (I don't do hardware raid, myself.)
In MD raid, you have a "check" scrub which reads all member devices to
find and rewrite any UREs (patrol read), while comparing mirrors/parity
for mismatches. You end up with a "mismatch count" in sysfs when done.
You also have a "repair" scrub which also reads all data blocks in
parity arrays and first mirrors and write all parity and other mirrors.
This is only recommended when a "check" scrub finds mismatches, as this
type of scrub can miss developing bad sectors on parity blocks and other
mirrors. (Drives can only *detect* failing sectors on *read*, and can
only relocate them on *write* *after* detection.)
> What about md reliability? There are many detractors out there.
>
> https://bugzilla.kernel.org/show_bug.cgi?id=99171
That's hardly a great case. Changing data in a chunk of memory in one
thread while another thread is writing it out is undefined behavior and
MD will give you back something that was there at the time of actual
write. Do that with hardware raid and you will gain consistency, but
you'll still have jumbled data. Real applications don't do this or they
have much bigger problems than raid mirror mismatches.
> One of the most common complaint is the absence of write-back cache,
> and if you force a "writeback" you'll risk data loss in case of
> unclean shutdown (power failure and so on)
The only good reason for hardware raid, in my opinion. Balanced against
vendor lock-in, limited layout options, and a plethora of management
interfaces.
Phil
^ permalink raw reply
* Re: Disk Monitoring
From: Anthony Youngman @ 2017-06-30 19:56 UTC (permalink / raw)
To: Gandalf Corvotempesta; +Cc: linux-raid
In-Reply-To: <94fcf340-4924-2f01-e616-a9b6ba172459@turmel.org>
On 30/06/17 15:35, Phil Turmel wrote:
> The only good reason for hardware raid, in my opinion. Balanced against
> vendor lock-in, limited layout options, and a plethora of management
> interfaces.
And lost data when your controller quits, and you can't find another one
that implements the same sort of raid ...
Cheers,
Wol
^ permalink raw reply
* [PATCH 1/5] md: add a 'md_numa_node' module parameter
From: Zhengyuan Liu @ 2017-07-01 7:20 UTC (permalink / raw)
To: linux-raid; +Cc: shli, neilb, colyli, liuyun01
This module parameter allows user to control which numa node
the memory for mainly structures (e.g. mddev, md_rdev,
request_queue, gendisk) is allocated from. The idea came from
commit 115485e83f49 ("dm: add 'dm_numa_node' module parameter").
If we don't set this parameter while loading module, it won't
affect the md default behavior.
numa_node_id field is added so personality such as raid0 could
inherit the node from mddev, for other personality which has its
own handling thread we could add such a module parameter too.
This patch includes a bug fix about parameter range check suggested
by Coly Li <colyli@suse.de>.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
drivers/md/md.c | 18 ++++++++++++++----
drivers/md/md.h | 2 ++
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 092b48f..fae93db 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -184,6 +184,8 @@ static int start_readonly;
*/
static bool create_on_open = true;
+static int md_numa_node = NUMA_NO_NODE;
+
/* bio_clone_mddev
* like bio_clone, but with a local bio set
*/
@@ -588,7 +590,7 @@ static struct mddev *mddev_find(dev_t unit)
}
spin_unlock(&all_mddevs_lock);
- new = kzalloc(sizeof(*new), GFP_KERNEL);
+ new = kzalloc_node(sizeof(*new), GFP_KERNEL, md_numa_node);
if (!new)
return NULL;
@@ -598,6 +600,7 @@ static struct mddev *mddev_find(dev_t unit)
else
new->md_minor = MINOR(unit) >> MdpMinorShift;
+ new->numa_node_id = md_numa_node;
mddev_init(new);
goto retry;
@@ -3387,7 +3390,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
struct md_rdev *rdev;
sector_t size;
- rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
+ rdev = kzalloc_node(sizeof(*rdev), GFP_KERNEL, md_numa_node);
if (!rdev)
return ERR_PTR(-ENOMEM);
@@ -5256,7 +5259,7 @@ static int md_alloc(dev_t dev, char *name)
mddev->hold_active = UNTIL_STOP;
error = -ENOMEM;
- mddev->queue = blk_alloc_queue(GFP_KERNEL);
+ mddev->queue = blk_alloc_queue_node(GFP_KERNEL, md_numa_node);
if (!mddev->queue)
goto abort;
mddev->queue->queuedata = mddev;
@@ -5264,7 +5267,7 @@ static int md_alloc(dev_t dev, char *name)
blk_queue_make_request(mddev->queue, md_make_request);
blk_set_stacking_limits(&mddev->queue->limits);
- disk = alloc_disk(1 << shift);
+ disk = alloc_disk_node(1 << shift, md_numa_node);
if (!disk) {
blk_cleanup_queue(mddev->queue);
mddev->queue = NULL;
@@ -8969,6 +8972,11 @@ static int __init md_init(void)
register_reboot_notifier(&md_notifier);
raid_table_header = register_sysctl_table(raid_root_table);
+ if (md_numa_node < NUMA_NO_NODE)
+ md_numa_node = NUMA_NO_NODE;
+ else if (md_numa_node > (num_online_nodes() - 1))
+ md_numa_node = num_online_nodes() - 1;
+
md_geninit();
return 0;
@@ -9252,6 +9260,8 @@ module_param_call(start_ro, set_ro, get_ro, NULL, S_IRUSR|S_IWUSR);
module_param(start_dirty_degraded, int, S_IRUGO|S_IWUSR);
module_param_call(new_array, add_named_array, NULL, NULL, S_IWUSR);
module_param(create_on_open, bool, S_IRUSR|S_IWUSR);
+module_param(md_numa_node, int, S_IRUGO);
+MODULE_PARM_DESC(md_numa_node, "NUMA node for md device memory allocations");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MD RAID framework");
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 991f0fe..5c91033 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -459,6 +459,8 @@ struct mddev {
void (*sync_super)(struct mddev *mddev, struct md_rdev *rdev);
struct md_cluster_info *cluster_info;
unsigned int good_device_nr; /* good device num within cluster raid */
+
+ int numa_node_id;
};
enum recovery_flags {
--
2.7.4
^ permalink raw reply related
* [PATCH 2/5] raid0: make memory allocation from md's numa node
From: Zhengyuan Liu @ 2017-07-01 7:20 UTC (permalink / raw)
To: linux-raid; +Cc: shli, neilb, colyli, liuyun01
In-Reply-To: <1498893658-18409-1-git-send-email-liuzhengyuan@kylinos.cn>
raid0 has the same context as md does, so there is no need
to add a module parameter. Just inherit it from md.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
drivers/md/raid0.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 94d9ae9..7a301b3 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -89,7 +89,8 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
int cnt;
char b[BDEVNAME_SIZE];
char b2[BDEVNAME_SIZE];
- struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
+ struct r0conf *conf = kzalloc_node(sizeof(*conf), GFP_KERNEL,
+ mddev->numa_node_id);
unsigned short blksize = 512;
*private_conf = ERR_PTR(-ENOMEM);
@@ -158,13 +159,14 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
}
err = -ENOMEM;
- conf->strip_zone = kzalloc(sizeof(struct strip_zone)*
- conf->nr_strip_zones, GFP_KERNEL);
+ conf->strip_zone = kzalloc_node(sizeof(struct strip_zone)*
+ conf->nr_strip_zones, GFP_KERNEL,
+ mddev->numa_node_id);
if (!conf->strip_zone)
goto abort;
- conf->devlist = kzalloc(sizeof(struct md_rdev*)*
+ conf->devlist = kzalloc_node(sizeof(struct md_rdev *)*
conf->nr_strip_zones*mddev->raid_disks,
- GFP_KERNEL);
+ GFP_KERNEL, mddev->numa_node_id);
if (!conf->devlist)
goto abort;
--
2.7.4
^ permalink raw reply related
* [PATCH 3/5] md/linear: make memory allocation from md's numa node
From: Zhengyuan Liu @ 2017-07-01 7:20 UTC (permalink / raw)
To: linux-raid; +Cc: shli, neilb, colyli, liuyun01
In-Reply-To: <1498893658-18409-1-git-send-email-liuzhengyuan@kylinos.cn>
linear has the same context as md does, so there is no need
to add a module parameter. Just inherit it from md.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
drivers/md/linear.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 5f1eb91..43ea6eb 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -96,8 +96,8 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks)
int i, cnt;
bool discard_supported = false;
- conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(struct dev_info),
- GFP_KERNEL);
+ conf = kzalloc_node(sizeof (*conf) + raid_disks*sizeof(struct dev_info),
+ GFP_KERNEL, mddev->numa_node_id);
if (!conf)
return NULL;
--
2.7.4
^ permalink raw reply related
* [PATCH 4/5] raid10: add a 'r10_numa_node' module parameter
From: Zhengyuan Liu @ 2017-07-01 7:20 UTC (permalink / raw)
To: linux-raid; +Cc: shli, neilb, colyli, liuyun01
In-Reply-To: <1498893658-18409-1-git-send-email-liuzhengyuan@kylinos.cn>
This module parameter allows user to control which numa node
the memory for mainly structures is allocated from.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
drivers/md/raid10.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 305b0db..f49ab2a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -97,6 +97,8 @@
*/
static int max_queued_requests = 1024;
+static int r10_numa_node = NUMA_NO_NODE;
+
static void allow_barrier(struct r10conf *conf);
static void lower_barrier(struct r10conf *conf);
static int _enough(struct r10conf *conf, int previous, int ignore);
@@ -135,7 +137,7 @@ static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
/* allocate a r10bio with room for raid_disks entries in the
* bios array */
- return kzalloc(size, gfp_flags);
+ return kzalloc_node(size, gfp_flags, r10_numa_node);
}
static void r10bio_pool_free(void *r10_bio, void *data)
@@ -179,7 +181,8 @@ static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data)
nalloc_rp = nalloc;
else
nalloc_rp = nalloc * 2;
- rps = kmalloc(sizeof(struct resync_pages) * nalloc_rp, gfp_flags);
+ rps = kmalloc_node(sizeof(struct resync_pages) * nalloc_rp, gfp_flags,
+ r10_numa_node);
if (!rps)
goto out_free_r10bio;
@@ -2801,7 +2804,8 @@ static int init_resync(struct r10conf *conf)
for (i = 0; i < conf->geo.raid_disks; i++)
if (conf->mirrors[i].replacement)
conf->have_replacement = 1;
- conf->r10buf_pool = mempool_create(buffs, r10buf_pool_alloc, r10buf_pool_free, conf);
+ conf->r10buf_pool = mempool_create_node(buffs, r10buf_pool_alloc, r10buf_pool_free,
+ conf, GFP_KERNEL, r10_numa_node);
if (!conf->r10buf_pool)
return -ENOMEM;
conf->next_resync = 0;
@@ -3532,14 +3536,14 @@ static struct r10conf *setup_conf(struct mddev *mddev)
}
err = -ENOMEM;
- conf = kzalloc(sizeof(struct r10conf), GFP_KERNEL);
+ conf = kzalloc_node(sizeof(struct r10conf), GFP_KERNEL, r10_numa_node);
if (!conf)
goto out;
/* FIXME calc properly */
- conf->mirrors = kzalloc(sizeof(struct raid10_info)*(mddev->raid_disks +
+ conf->mirrors = kzalloc_node(sizeof(struct raid10_info)*(mddev->raid_disks +
max(0,-mddev->delta_disks)),
- GFP_KERNEL);
+ GFP_KERNEL, r10_numa_node);
if (!conf->mirrors)
goto out;
@@ -3549,8 +3553,9 @@ static struct r10conf *setup_conf(struct mddev *mddev)
conf->geo = geo;
conf->copies = copies;
- conf->r10bio_pool = mempool_create(NR_RAID10_BIOS, r10bio_pool_alloc,
- r10bio_pool_free, conf);
+ conf->r10bio_pool = mempool_create_node(NR_RAID10_BIOS, r10bio_pool_alloc,
+ r10bio_pool_free, conf,
+ GFP_KERNEL, r10_numa_node);
if (!conf->r10bio_pool)
goto out;
@@ -3971,11 +3976,11 @@ static int raid10_check_reshape(struct mddev *mddev)
conf->mirrors_new = NULL;
if (mddev->delta_disks > 0) {
/* allocate new 'mirrors' list */
- conf->mirrors_new = kzalloc(
+ conf->mirrors_new = kzalloc_node(
sizeof(struct raid10_info)
*(mddev->raid_disks +
mddev->delta_disks),
- GFP_KERNEL);
+ GFP_KERNEL, r10_numa_node);
if (!conf->mirrors_new)
return -ENOMEM;
}
@@ -4728,6 +4733,11 @@ static struct md_personality raid10_personality =
static int __init raid_init(void)
{
+ if (r10_numa_node < NUMA_NO_NODE)
+ r10_numa_node = NUMA_NO_NODE;
+ else if (r10_numa_node > (num_online_nodes() - 1))
+ r10_numa_node = num_online_nodes() - 1;
+
return register_md_personality(&raid10_personality);
}
@@ -4745,3 +4755,5 @@ MODULE_ALIAS("md-raid10");
MODULE_ALIAS("md-level-10");
module_param(max_queued_requests, int, S_IRUGO|S_IWUSR);
+module_param(r10_numa_node, int, S_IRUGO);
+MODULE_PARM_DESC(r10_numa_node, "NUMA node for raid10 memory allocations");
--
2.7.4
^ permalink raw reply related
* [PATCH 5/5] raid5: add a 'r5_numa_node' module parameter
From: Zhengyuan Liu @ 2017-07-01 7:20 UTC (permalink / raw)
To: linux-raid; +Cc: shli, neilb, colyli, liuyun01
In-Reply-To: <1498893658-18409-1-git-send-email-liuzhengyuan@kylinos.cn>
This module parameter allows user to control which numa node
the memory for mainly structures is allocated from.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
---
drivers/md/raid5.c | 54 ++++++++++++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 18 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 547d5fa..b61417f 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -75,6 +75,11 @@ static bool devices_handle_discard_safely = false;
module_param(devices_handle_discard_safely, bool, 0644);
MODULE_PARM_DESC(devices_handle_discard_safely,
"Set to Y if all devices in each array reliably return zeroes on reads from discarded regions");
+
+static int r5_numa_node = NUMA_NO_NODE;
+module_param(r5_numa_node, int, S_IRUGO);
+MODULE_PARM_DESC(r5_numa_node, "NUMA node for raid5 memory allocations");
+
static struct workqueue_struct *raid5_wq;
static inline struct hlist_head *stripe_hash(struct r5conf *conf, sector_t sect)
@@ -484,7 +489,7 @@ static int grow_buffers(struct stripe_head *sh, gfp_t gfp)
for (i = 0; i < num; i++) {
struct page *page;
- if (!(page = alloc_page(gfp))) {
+ if (!(page = alloc_pages_node(r5_numa_node, gfp, 0))) {
return 1;
}
sh->dev[i].page = page;
@@ -2135,7 +2140,7 @@ static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp,
struct stripe_head *sh;
int i;
- sh = kmem_cache_zalloc(sc, gfp);
+ sh = kmem_cache_alloc_node(sc, gfp | __GFP_ZERO, r5_numa_node);
if (sh) {
spin_lock_init(&sh->stripe_lock);
spin_lock_init(&sh->batch_lock);
@@ -2154,7 +2159,7 @@ static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp,
}
if (raid5_has_ppl(conf)) {
- sh->ppl_page = alloc_page(gfp);
+ sh->ppl_page = alloc_pages_node(r5_numa_node, gfp, 0);
if (!sh->ppl_page) {
free_stripe(sc, sh);
sh = NULL;
@@ -2383,13 +2388,15 @@ static int resize_stripes(struct r5conf *conf, int newsize)
* is completely stalled, so now is a good time to resize
* conf->disks and the scribble region
*/
- ndisks = kzalloc(newsize * sizeof(struct disk_info), GFP_NOIO);
+ ndisks = kzalloc_node(newsize * sizeof(struct disk_info), GFP_NOIO,
+ r5_numa_node);
if (ndisks) {
for (i = 0; i < conf->pool_size; i++)
ndisks[i] = conf->disks[i];
for (i = conf->pool_size; i < newsize; i++) {
- ndisks[i].extra_page = alloc_page(GFP_NOIO);
+ ndisks[i].extra_page = alloc_pages_node(r5_numa_node,
+ GFP_NOIO, 0);
if (!ndisks[i].extra_page)
err = -ENOMEM;
}
@@ -2418,7 +2425,8 @@ static int resize_stripes(struct r5conf *conf, int newsize)
for (i=conf->raid_disks; i < newsize; i++)
if (nsh->dev[i].page == NULL) {
- struct page *p = alloc_page(GFP_NOIO);
+ struct page *p = alloc_pages_node(r5_numa_node,
+ GFP_NOIO, 0);
nsh->dev[i].page = p;
nsh->dev[i].orig_page = p;
if (!p)
@@ -3921,7 +3929,8 @@ static int handle_stripe_dirtying(struct r5conf *conf,
dev->page == dev->orig_page &&
!test_bit(R5_LOCKED, &sh->dev[sh->pd_idx].flags)) {
/* alloc page for prexor */
- struct page *p = alloc_page(GFP_NOIO);
+ struct page *p = alloc_pages_node(r5_numa_node,
+ GFP_NOIO, 0);
if (p) {
dev->orig_page = p;
@@ -6653,9 +6662,9 @@ static int alloc_thread_groups(struct r5conf *conf, int cnt,
}
*group_cnt = num_possible_nodes();
size = sizeof(struct r5worker) * cnt;
- workers = kzalloc(size * *group_cnt, GFP_NOIO);
- *worker_groups = kzalloc(sizeof(struct r5worker_group) *
- *group_cnt, GFP_NOIO);
+ workers = kzalloc_node(size * *group_cnt, GFP_NOIO, r5_numa_node);
+ *worker_groups = kzalloc_node(sizeof(struct r5worker_group) *
+ *group_cnt, GFP_NOIO, r5_numa_node);
if (!*worker_groups || !workers) {
kfree(workers);
kfree(*worker_groups);
@@ -6720,7 +6729,8 @@ static void free_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu
static int alloc_scratch_buffer(struct r5conf *conf, struct raid5_percpu *percpu)
{
if (conf->level == 6 && !percpu->spare_page)
- percpu->spare_page = alloc_page(GFP_KERNEL);
+ percpu->spare_page = alloc_pages_node(r5_numa_node,
+ GFP_KERNEL, 0);
if (!percpu->scribble)
percpu->scribble = scribble_alloc(max(conf->raid_disks,
conf->previous_raid_disks),
@@ -6880,13 +6890,13 @@ static struct r5conf *setup_conf(struct mddev *mddev)
return ERR_PTR(-EINVAL);
}
- conf = kzalloc(sizeof(struct r5conf), GFP_KERNEL);
+ conf = kzalloc_node(sizeof(struct r5conf), GFP_KERNEL, r5_numa_node);
if (conf == NULL)
goto abort;
INIT_LIST_HEAD(&conf->free_list);
INIT_LIST_HEAD(&conf->pending_list);
- conf->pending_data = kzalloc(sizeof(struct r5pending_data) *
- PENDING_IO_MAX, GFP_KERNEL);
+ conf->pending_data = kzalloc_node(sizeof(struct r5pending_data) *
+ PENDING_IO_MAX, GFP_KERNEL, r5_numa_node);
if (!conf->pending_data)
goto abort;
for (i = 0; i < PENDING_IO_MAX; i++)
@@ -6935,14 +6945,15 @@ static struct r5conf *setup_conf(struct mddev *mddev)
conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks;
max_disks = max(conf->raid_disks, conf->previous_raid_disks);
- conf->disks = kzalloc(max_disks * sizeof(struct disk_info),
- GFP_KERNEL);
+ conf->disks = kzalloc_node(max_disks * sizeof(struct disk_info),
+ GFP_KERNEL, r5_numa_node);
if (!conf->disks)
goto abort;
for (i = 0; i < max_disks; i++) {
- conf->disks[i].extra_page = alloc_page(GFP_KERNEL);
+ conf->disks[i].extra_page = alloc_pages_node(r5_numa_node,
+ GFP_KERNEL, 0);
if (!conf->disks[i].extra_page)
goto abort;
}
@@ -6952,7 +6963,8 @@ static struct r5conf *setup_conf(struct mddev *mddev)
goto abort;
conf->mddev = mddev;
- if ((conf->stripe_hashtbl = kzalloc(PAGE_SIZE, GFP_KERNEL)) == NULL)
+ if ((conf->stripe_hashtbl = kzalloc_node(PAGE_SIZE, GFP_KERNEL, r5_numa_node))
+ == NULL)
goto abort;
/* We init hash_locks[0] separately to that it can be used
@@ -8445,6 +8457,12 @@ static int __init raid5_init(void)
destroy_workqueue(raid5_wq);
return ret;
}
+
+ if (r5_numa_node < NUMA_NO_NODE)
+ r5_numa_node = NUMA_NO_NODE;
+ else if (r5_numa_node > (num_online_nodes() - 1))
+ r5_numa_node = num_online_nodes() - 1;
+
register_md_personality(&raid6_personality);
register_md_personality(&raid5_personality);
register_md_personality(&raid4_personality);
--
2.7.4
^ permalink raw reply related
* Re: Disk Monitoring
From: Drew @ 2017-07-01 13:42 UTC (permalink / raw)
To: Linux RAID Mailing List
In-Reply-To: <faaa61f1-da3c-036b-e6b0-1107759e1c1d@youngman.org.uk>
On Fri, Jun 30, 2017 at 12:56 PM, Anthony Youngman
<antlists@youngman.org.uk> wrote:
> On 30/06/17 15:35, Phil Turmel wrote:
>>
>> The only good reason for hardware raid, in my opinion. Balanced against
>> vendor lock-in, limited layout options, and a plethora of management
>> interfaces.
>
>
> And lost data when your controller quits, and you can't find another one
> that implements the same sort of raid ...
Back in the days of SCSI that was very true but ..
In the defense of the hw raid vendor I've worked with quite a bit
(LSI), I've found you can migrate RAID arrays from controller to
controller quite easily. So if your raid controller fails, you can
always grab the current available controller that supports your
required raid level. I've created arrays in the older 1068 controller
(PCI-X card) and easily migrated it to a newer 2008 or 2108 based
controller with no fuss. See's the older array as an 'external' array
and imports just fine.
--
Drew
^ permalink raw reply
* Re: Disk Monitoring
From: Gandalf Corvotempesta @ 2017-07-01 14:12 UTC (permalink / raw)
To: Drew; +Cc: Linux RAID Mailing List
In-Reply-To: <CACJz6Quin5jReORQMk_-30yBq6MhmBYoO8S_3yw+OEqBwYiAww@mail.gmail.com>
2017-07-01 15:42 GMT+02:00 Drew <drew.kay@gmail.com>:
> In the defense of the hw raid vendor I've worked with quite a bit
> (LSI), I've found you can migrate RAID arrays from controller to
> controller quite easily. So if your raid controller fails, you can
> always grab the current available controller that supports your
> required raid level. I've created arrays in the older 1068 controller
> (PCI-X card) and easily migrated it to a newer 2008 or 2108 based
> controller with no fuss. See's the older array as an 'external' array
> and imports just fine.
This is true for "real" LSI controllers.
But if you look at DELL specs, DELL is supporting only 1 generation to
1 generation migration.
DELL firmware is different from LSI, I'm unsure what could happen by
migrating a raid array
between multiple generations.
And in additiojn to this, DELL doesn't provide any kind of support to
move disks skipping more than 1 generation.
^ permalink raw reply
* REF:- INSTRUCTION TO CREDIT YOUR ACCOUNT WITH THE SUM OF (US$10Million)TURBO
From: WESMINISTER BANK PLC UK @ 2017-07-01 14:35 UTC (permalink / raw)
To: Recipients
WESMINISTER BANK PLC,
10 Southwark Street ,
London Bridge , London - UK
SE1 1TT
RC: 121878
Our Ref: NTB/WESTMIN/INTER-15
Your Ref: Affidavit: AFX 076GD7B24
Tell=+447035969549
Fax+448435643403
REF:- INSTRUCTION TO CREDIT YOUR ACCOUNT WITH THE SUM OF (US$10Million)
This is the second time we are notifying you about this said fund. After due vetting and evaluation of your file that
Was
sent to us by the Nigerian Government in conjunction with the Ministry
of Finance and Central Bank of the Federal Republic of Nigeria.
This bank has an instruction to see to the immediate release of the sum of (US$10Million) of your claim that
has been holding since is transferred into your bank Account from their Domiciliary Account with this bank.
We were meant to understand from our findings that you have been going through hard ways by
Paying a lot of charges to see to the release of your fund (US$10Million),
Which has been the handwork of some miscreant elements from that Country.
We advice that you stop further communication with any correspondence from any bank, or anywhere
Concerning your funds as you will receive your fund from this bank if you follow our instruction.
Do not go through anybody again but through this Bank if you really want your fund.
Finally, you are advice to re-confirm these to us,
Your Full Name,
Contact address,
Occupation
Telephone and Fax Number for easy communication.
We need your second email gmail or hotmail for security and private reasons.
Yours sincerely,
Mr Anthony M. Smith
Head Of Account Department,
WesMinister Bank, London United Kingdom.
Here is my private! Email address (michaelsmith@post.cz)
^ permalink raw reply
* Re: Disk Monitoring
From: Drew @ 2017-07-01 15:36 UTC (permalink / raw)
To: Gandalf Corvotempesta; +Cc: Linux RAID Mailing List
In-Reply-To: <CAJH6TXg+AneWdtN=SggbJ9aQuZ8KXiUeO9LDYNSOruv70Nwihg@mail.gmail.com>
> This is true for "real" LSI controllers.
> But if you look at DELL specs, DELL is supporting only 1 generation to
> 1 generation migration.
> DELL firmware is different from LSI, I'm unsure what could happen by
> migrating a raid array
> between multiple generations.
>
> And in additiojn to this, DELL doesn't provide any kind of support to
> move disks skipping more than 1 generation.
There's your problem. :-)
I have nothing good to say about DELL, and what I could say, well it's
nothing I can print in a public forum that wouldn't be expletive
laced.
"Real" LSI, or IBM/Lenovo branded LSI raid cards don't restrict their
users in such a fashion. I've taken IBM branded drives out of a failed
IBM/LSI controller, imported them into a genuine LSI controller, and
then ran it for years before the machine became too old and was
replaced. It's telling when you take the IBM stickers off their LSI
raid controllers and you see the original OEM markings still on the
card. Add to that how easy it is to reflash 'genuine' LSI firmware on
the IBM cards and the cards run slightly faster because all IBM
apparently inserted into the controller BIOS was interface code for
the BMC & IMM. :)
Try doing that with a PERC card. :P
--
Drew
^ permalink raw reply
* [PATCH v3 00/28] simplify crypto wait for async op
From: Gilad Ben-Yossef @ 2017-07-02 14:41 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jonathan Corbet, David Howells,
Tom Lendacky, Gary Hook, Boris Brezillon, Arnaud Ebalard,
Matthias Brugger, Alasdair Kergon, Mike Snitzer, dm-devel,
Shaohua Li, Steve French, Theodore Y. Ts'o, Jaegeuk Kim,
Mimi Zohar, Dmitry Kasatkin, James Morris, Serge E. Hallyn,
linux-crypto
Cc: Ofir Drang
Many users of kernel async. crypto services have a pattern of
starting an async. crypto op and than using a completion
to wait for it to end.
This patch set simplifies this common use case in two ways:
First, by giving the case where a request was queued to the
backlog a separate return code (-EIOCBQUEUED) of its own
rather than sharing the -EBUSY return code with the fatal
error of a busy provider when backlog is not enabled.
Next, this change is than built on to create a generic way
to wait for a async. crypto operation to complete.
The end result is that after replacing all the call sites
I could find, the code is smaller by ~340 lines, a branch
is saved in some cases in run-time and the code is more
straightforward to follow.
Please note that patches 1-13 should be squashed together
when applied in order to function correctly. They are
only separated out to ease review.
The patch set was boot tested on x86_64 and arm64 which
at the very least tests the crypto users via testmgr and
tcrypt but I do note that I do not have access to some
of the HW whose drivers are modified nor do I claim I was
able to test all of the corner cases.
Last but not least, I do apologize for the size of this
patch set and number of recipients, but I did have to
touch every crypto async API user in the kernel. May the
340 deleted lines serve as penance for my sin :-)
Changes from v2:
- Patch title changed from "introduce crypto wait for
async op" to better reflect the current state.
- Rebase on top of latest linux-next.
- Add a new return code of -EIOCBQUEUED for backlog
queueing, as suggested by Herbert Xu.
- Transform more users to the new API.
- Update the drbg change to account for new init as
indicated by Stephan Muller.
Changes from v1:
- Address review comments from Eric Biggers.
- Separated out bug fixes of existing code and rebase
on top of that patch set.
- Rename 'ecr' to 'wait' in fscrypto code.
- Split patch introducing the new API from the change
moving over the algif code which it originated from
to the new API.
- Inline crypto_wait_req().
- Some code indentation fixes.
Gilad Ben-Yossef (28):
crypto: change backlog return code to -EIOCBQUEUED
crypto: atmel: use -EIOCBQUEUED for backlog indication
crypto: ccm: use -EIOCBQUEUED for backlog indication
crypto: marvell/cesa: use -EIOCBQUEUED for backlog indication
crypto: mediatek: use -EIOCBQUEUED for backlog indication
crypto: omap: use -EIOCBQUEUED for backlog indication
crypto: qce: use -EIOCBQUEUED for backlog indication
crypto: talitos: use -EIOCBQUEUED for backlog indication
dm: verity: use -EIOCBQUEUED for backlog indication
fscrypt: use -EIOCBQUEUED for backlog indication
cifs: use -EIOCBQUEUED for backlog indication
ima: use -EIOCBQUEUED for backlog indication
crypto: adapt api sample to -EIOCBQUEUED as backlog indication
crypto: introduce crypto wait for async op
crypto: move algif to generic async completion
crypto: move pub key to generic async completion
crypto: move drbg to generic async completion
crypto: move gcm to generic async completion
crypto: move testmgr to generic async completion
dm: move dm-verity to generic async completion
fscrypt: move to generic async completion
cifs: move to generic async completion
ima: move to generic async completion
crypto: tcrypt: move to generic async completion
crypto: talitos: move to generic async completion
crypto: qce: move to generic async completion
crypto: mediatek: move to generic async completion
crypto: adapt api sample to use async. op wait
Documentation/crypto/api-samples.rst | 52 ++-------
crypto/af_alg.c | 27 -----
crypto/ahash.c | 12 +--
crypto/algapi.c | 6 +-
crypto/algif_aead.c | 14 +--
crypto/algif_hash.c | 29 +++--
crypto/algif_skcipher.c | 15 ++-
crypto/api.c | 13 +++
crypto/asymmetric_keys/public_key.c | 28 +----
crypto/chacha20poly1305.c | 2 +-
crypto/cryptd.c | 4 +-
crypto/cts.c | 6 +-
crypto/drbg.c | 36 ++-----
crypto/gcm.c | 32 ++----
crypto/lrw.c | 8 +-
crypto/rsa-pkcs1pad.c | 16 +--
crypto/tcrypt.c | 84 +++++----------
crypto/testmgr.c | 204 ++++++++++++-----------------------
crypto/xts.c | 8 +-
drivers/crypto/atmel-sha.c | 2 +-
drivers/crypto/ccp/ccp-crypto-main.c | 10 +-
drivers/crypto/ccp/ccp-dev.c | 8 +-
drivers/crypto/ccp/ccp-dmaengine.c | 2 +-
drivers/crypto/marvell/cesa.c | 2 +-
drivers/crypto/marvell/cesa.h | 2 +-
drivers/crypto/mediatek/mtk-aes.c | 31 +-----
drivers/crypto/mediatek/mtk-sha.c | 2 +-
drivers/crypto/omap-sham.c | 2 +-
drivers/crypto/qce/sha.c | 30 +-----
drivers/crypto/talitos.c | 39 +------
drivers/md/dm-verity-target.c | 81 ++++----------
drivers/md/dm-verity.h | 5 -
fs/cifs/smb2ops.c | 30 +-----
fs/crypto/crypto.c | 29 +----
fs/crypto/fname.c | 36 ++-----
fs/crypto/fscrypt_private.h | 10 --
fs/crypto/keyinfo.c | 21 +---
include/crypto/drbg.h | 3 +-
include/crypto/if_alg.h | 14 ---
include/linux/crypto.h | 40 +++++++
security/integrity/ima/ima_crypto.c | 56 +++-------
41 files changed, 305 insertions(+), 746 deletions(-)
--
2.1.4
^ permalink raw reply
* [PATCH v3 00/28] simplify crypto wait for async op
From: Gilad Ben-Yossef @ 2017-07-02 14:41 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jonathan Corbet, David Howells,
Tom Lendacky, Gary Hook, Boris Brezillon, Arnaud Ebalard,
Matthias Brugger, Alasdair Kergon, Mike Snitzer, dm-devel,
Shaohua Li, Steve French, Theodore Y. Ts'o, Jaegeuk Kim,
Mimi Zohar, Dmitry Kasatkin, James Morris, Serge E. Hallyn,
linux-crypto, linux-doc, linux-kernel, keyrings, linux-arm-kernel
Cc: Ofir Drang
Many users of kernel async. crypto services have a pattern of
starting an async. crypto op and than using a completion
to wait for it to end.
This patch set simplifies this common use case in two ways:
First, by giving the case where a request was queued to the
backlog a separate return code (-EIOCBQUEUED) of its own
rather than sharing the -EBUSY return code with the fatal
error of a busy provider when backlog is not enabled.
Next, this change is than built on to create a generic way
to wait for a async. crypto operation to complete.
The end result is that after replacing all the call sites
I could find, the code is smaller by ~340 lines, a branch
is saved in some cases in run-time and the code is more
straightforward to follow.
Please note that patches 1-13 should be squashed together
when applied in order to function correctly. They are
only separated out to ease review.
The patch set was boot tested on x86_64 and arm64 which
at the very least tests the crypto users via testmgr and
tcrypt but I do note that I do not have access to some
of the HW whose drivers are modified nor do I claim I was
able to test all of the corner cases.
Last but not least, I do apologize for the size of this
patch set and number of recipients, but I did have to
touch every crypto async API user in the kernel. May the
340 deleted lines serve as penance for my sin :-)
Changes from v2:
- Patch title changed from "introduce crypto wait for
async op" to better reflect the current state.
- Rebase on top of latest linux-next.
- Add a new return code of -EIOCBQUEUED for backlog
queueing, as suggested by Herbert Xu.
- Transform more users to the new API.
- Update the drbg change to account for new init as
indicated by Stephan Muller.
Changes from v1:
- Address review comments from Eric Biggers.
- Separated out bug fixes of existing code and rebase
on top of that patch set.
- Rename 'ecr' to 'wait' in fscrypto code.
- Split patch introducing the new API from the change
moving over the algif code which it originated from
to the new API.
- Inline crypto_wait_req().
- Some code indentation fixes.
Gilad Ben-Yossef (28):
crypto: change backlog return code to -EIOCBQUEUED
crypto: atmel: use -EIOCBQUEUED for backlog indication
crypto: ccm: use -EIOCBQUEUED for backlog indication
crypto: marvell/cesa: use -EIOCBQUEUED for backlog indication
crypto: mediatek: use -EIOCBQUEUED for backlog indication
crypto: omap: use -EIOCBQUEUED for backlog indication
crypto: qce: use -EIOCBQUEUED for backlog indication
crypto: talitos: use -EIOCBQUEUED for backlog indication
dm: verity: use -EIOCBQUEUED for backlog indication
fscrypt: use -EIOCBQUEUED for backlog indication
cifs: use -EIOCBQUEUED for backlog indication
ima: use -EIOCBQUEUED for backlog indication
crypto: adapt api sample to -EIOCBQUEUED as backlog indication
crypto: introduce crypto wait for async op
crypto: move algif to generic async completion
crypto: move pub key to generic async completion
crypto: move drbg to generic async completion
crypto: move gcm to generic async completion
crypto: move testmgr to generic async completion
dm: move dm-verity to generic async completion
fscrypt: move to generic async completion
cifs: move to generic async completion
ima: move to generic async completion
crypto: tcrypt: move to generic async completion
crypto: talitos: move to generic async completion
crypto: qce: move to generic async completion
crypto: mediatek: move to generic async completion
crypto: adapt api sample to use async. op wait
Documentation/crypto/api-samples.rst | 52 ++-------
crypto/af_alg.c | 27 -----
crypto/ahash.c | 12 +--
crypto/algapi.c | 6 +-
crypto/algif_aead.c | 14 +--
crypto/algif_hash.c | 29 +++--
crypto/algif_skcipher.c | 15 ++-
crypto/api.c | 13 +++
crypto/asymmetric_keys/public_key.c | 28 +----
crypto/chacha20poly1305.c | 2 +-
crypto/cryptd.c | 4 +-
crypto/cts.c | 6 +-
crypto/drbg.c | 36 ++-----
crypto/gcm.c | 32 ++----
crypto/lrw.c | 8 +-
crypto/rsa-pkcs1pad.c | 16 +--
crypto/tcrypt.c | 84 +++++----------
crypto/testmgr.c | 204 ++++++++++++-----------------------
crypto/xts.c | 8 +-
drivers/crypto/atmel-sha.c | 2 +-
drivers/crypto/ccp/ccp-crypto-main.c | 10 +-
drivers/crypto/ccp/ccp-dev.c | 8 +-
drivers/crypto/ccp/ccp-dmaengine.c | 2 +-
drivers/crypto/marvell/cesa.c | 2 +-
drivers/crypto/marvell/cesa.h | 2 +-
drivers/crypto/mediatek/mtk-aes.c | 31 +-----
drivers/crypto/mediatek/mtk-sha.c | 2 +-
drivers/crypto/omap-sham.c | 2 +-
drivers/crypto/qce/sha.c | 30 +-----
drivers/crypto/talitos.c | 39 +------
drivers/md/dm-verity-target.c | 81 ++++----------
drivers/md/dm-verity.h | 5 -
fs/cifs/smb2ops.c | 30 +-----
fs/crypto/crypto.c | 29 +----
fs/crypto/fname.c | 36 ++-----
fs/crypto/fscrypt_private.h | 10 --
fs/crypto/keyinfo.c | 21 +---
include/crypto/drbg.h | 3 +-
include/crypto/if_alg.h | 14 ---
include/linux/crypto.h | 40 +++++++
security/integrity/ima/ima_crypto.c | 56 +++-------
41 files changed, 305 insertions(+), 746 deletions(-)
--
2.1.4
^ permalink raw reply
* [PATCH v3 00/28] simplify crypto wait for async op
From: Gilad Ben-Yossef @ 2017-07-02 14:41 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jonathan Corbet, David Howells,
Tom Lendacky, Gary Hook, Boris Brezillon, Arnaud Ebalard,
Matthias Brugger, Alasdair Kergon, Mike Snitzer,
dm-devel-H+wXaHxf7aLQT0dZR+AlfA, Shaohua Li, Steve French,
Theodore Y. Ts'o, Jaegeuk Kim, Mimi Zohar, Dmitry Kasatkin,
James Morris, Serge E. Hallyn,
linux-crypto-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
keyrings-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel
Cc: Ofir Drang
Many users of kernel async. crypto services have a pattern of
starting an async. crypto op and than using a completion
to wait for it to end.
This patch set simplifies this common use case in two ways:
First, by giving the case where a request was queued to the
backlog a separate return code (-EIOCBQUEUED) of its own
rather than sharing the -EBUSY return code with the fatal
error of a busy provider when backlog is not enabled.
Next, this change is than built on to create a generic way
to wait for a async. crypto operation to complete.
The end result is that after replacing all the call sites
I could find, the code is smaller by ~340 lines, a branch
is saved in some cases in run-time and the code is more
straightforward to follow.
Please note that patches 1-13 should be squashed together
when applied in order to function correctly. They are
only separated out to ease review.
The patch set was boot tested on x86_64 and arm64 which
at the very least tests the crypto users via testmgr and
tcrypt but I do note that I do not have access to some
of the HW whose drivers are modified nor do I claim I was
able to test all of the corner cases.
Last but not least, I do apologize for the size of this
patch set and number of recipients, but I did have to
touch every crypto async API user in the kernel. May the
340 deleted lines serve as penance for my sin :-)
Changes from v2:
- Patch title changed from "introduce crypto wait for
async op" to better reflect the current state.
- Rebase on top of latest linux-next.
- Add a new return code of -EIOCBQUEUED for backlog
queueing, as suggested by Herbert Xu.
- Transform more users to the new API.
- Update the drbg change to account for new init as
indicated by Stephan Muller.
Changes from v1:
- Address review comments from Eric Biggers.
- Separated out bug fixes of existing code and rebase
on top of that patch set.
- Rename 'ecr' to 'wait' in fscrypto code.
- Split patch introducing the new API from the change
moving over the algif code which it originated from
to the new API.
- Inline crypto_wait_req().
- Some code indentation fixes.
Gilad Ben-Yossef (28):
crypto: change backlog return code to -EIOCBQUEUED
crypto: atmel: use -EIOCBQUEUED for backlog indication
crypto: ccm: use -EIOCBQUEUED for backlog indication
crypto: marvell/cesa: use -EIOCBQUEUED for backlog indication
crypto: mediatek: use -EIOCBQUEUED for backlog indication
crypto: omap: use -EIOCBQUEUED for backlog indication
crypto: qce: use -EIOCBQUEUED for backlog indication
crypto: talitos: use -EIOCBQUEUED for backlog indication
dm: verity: use -EIOCBQUEUED for backlog indication
fscrypt: use -EIOCBQUEUED for backlog indication
cifs: use -EIOCBQUEUED for backlog indication
ima: use -EIOCBQUEUED for backlog indication
crypto: adapt api sample to -EIOCBQUEUED as backlog indication
crypto: introduce crypto wait for async op
crypto: move algif to generic async completion
crypto: move pub key to generic async completion
crypto: move drbg to generic async completion
crypto: move gcm to generic async completion
crypto: move testmgr to generic async completion
dm: move dm-verity to generic async completion
fscrypt: move to generic async completion
cifs: move to generic async completion
ima: move to generic async completion
crypto: tcrypt: move to generic async completion
crypto: talitos: move to generic async completion
crypto: qce: move to generic async completion
crypto: mediatek: move to generic async completion
crypto: adapt api sample to use async. op wait
Documentation/crypto/api-samples.rst | 52 ++-------
crypto/af_alg.c | 27 -----
crypto/ahash.c | 12 +--
crypto/algapi.c | 6 +-
crypto/algif_aead.c | 14 +--
crypto/algif_hash.c | 29 +++--
crypto/algif_skcipher.c | 15 ++-
crypto/api.c | 13 +++
crypto/asymmetric_keys/public_key.c | 28 +----
crypto/chacha20poly1305.c | 2 +-
crypto/cryptd.c | 4 +-
crypto/cts.c | 6 +-
crypto/drbg.c | 36 ++-----
crypto/gcm.c | 32 ++----
crypto/lrw.c | 8 +-
crypto/rsa-pkcs1pad.c | 16 +--
crypto/tcrypt.c | 84 +++++----------
crypto/testmgr.c | 204 ++++++++++++-----------------------
crypto/xts.c | 8 +-
drivers/crypto/atmel-sha.c | 2 +-
drivers/crypto/ccp/ccp-crypto-main.c | 10 +-
drivers/crypto/ccp/ccp-dev.c | 8 +-
drivers/crypto/ccp/ccp-dmaengine.c | 2 +-
drivers/crypto/marvell/cesa.c | 2 +-
drivers/crypto/marvell/cesa.h | 2 +-
drivers/crypto/mediatek/mtk-aes.c | 31 +-----
drivers/crypto/mediatek/mtk-sha.c | 2 +-
drivers/crypto/omap-sham.c | 2 +-
drivers/crypto/qce/sha.c | 30 +-----
drivers/crypto/talitos.c | 39 +------
drivers/md/dm-verity-target.c | 81 ++++----------
drivers/md/dm-verity.h | 5 -
fs/cifs/smb2ops.c | 30 +-----
fs/crypto/crypto.c | 29 +----
fs/crypto/fname.c | 36 ++-----
fs/crypto/fscrypt_private.h | 10 --
fs/crypto/keyinfo.c | 21 +---
include/crypto/drbg.h | 3 +-
include/crypto/if_alg.h | 14 ---
include/linux/crypto.h | 40 +++++++
security/integrity/ima/ima_crypto.c | 56 +++-------
41 files changed, 305 insertions(+), 746 deletions(-)
--
2.1.4
^ permalink raw reply
* [PATCH v3 01/28] crypto: change backlog return code to -EIOCBQUEUED
From: Gilad Ben-Yossef @ 2017-07-02 14:41 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jonathan Corbet, David Howells,
Tom Lendacky, Gary Hook, Boris Brezillon, Arnaud Ebalard,
Matthias Brugger, Alasdair Kergon, Mike Snitzer, dm-devel,
Shaohua Li, Steve French, Theodore Y. Ts'o, Jaegeuk Kim,
Mimi Zohar, Dmitry Kasatkin, James Morris, Serge E. Hallyn,
linux-crypto
Cc: Ofir Drang
In-Reply-To: <1499006535-19760-1-git-send-email-gilad@benyossef.com>
The crypto API was using the -EBUSY return value to indicate
both a hard failure to submit a crypto operation into a
transformation provider when the latter was busy and the backlog
mechanism was not enabled as well as a notification that the operation
was queued into the backlog when the backlog mechanism was enabled.
Having the same return code indicate two very different conditions
depending on a flag is both error prone and requires extra runtime
check like the following to discern between the cases:
if (err == -EINPROGRESS ||
(err == -EBUSY && (ahash_request_flags(req) &
CRYPTO_TFM_REQ_MAY_BACKLOG)))
This patch changes the return code used to indicate a crypto op
was queued in the backlog to -EIOCBQUEUED, thus resolving both
issues.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
---
crypto/af_alg.c | 2 +-
crypto/ahash.c | 12 +++---------
crypto/algapi.c | 6 ++++--
crypto/asymmetric_keys/public_key.c | 2 +-
crypto/chacha20poly1305.c | 2 +-
crypto/cryptd.c | 4 +---
crypto/cts.c | 6 ++----
crypto/drbg.c | 2 +-
crypto/gcm.c | 2 +-
crypto/lrw.c | 8 ++------
crypto/rsa-pkcs1pad.c | 16 ++++------------
crypto/tcrypt.c | 6 +++---
crypto/testmgr.c | 12 ++++++------
crypto/xts.c | 8 ++------
14 files changed, 32 insertions(+), 56 deletions(-)
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 3556d8e..c67daba 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -484,7 +484,7 @@ int af_alg_wait_for_completion(int err, struct af_alg_completion *completion)
{
switch (err) {
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&completion->completion);
reinit_completion(&completion->completion);
err = completion->err;
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 826cd7a..65d08db 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -334,9 +334,7 @@ static int ahash_op_unaligned(struct ahash_request *req,
return err;
err = op(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
ahash_restore_req(req, err);
@@ -394,9 +392,7 @@ static int ahash_def_finup_finish1(struct ahash_request *req, int err)
req->base.complete = ahash_def_finup_done2;
err = crypto_ahash_reqtfm(req)->final(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
out:
@@ -432,9 +428,7 @@ static int ahash_def_finup(struct ahash_request *req)
return err;
err = tfm->update(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
return ahash_def_finup_finish1(req, err);
diff --git a/crypto/algapi.c b/crypto/algapi.c
index e4cc761..3bfd1fa 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -897,9 +897,11 @@ int crypto_enqueue_request(struct crypto_queue *queue,
int err = -EINPROGRESS;
if (unlikely(queue->qlen >= queue->max_qlen)) {
- err = -EBUSY;
- if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) {
+ err = -EBUSY;
goto out;
+ }
+ err = -EIOCBQUEUED;
if (queue->backlog == &queue->list)
queue->backlog = &request->list;
}
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index 3cd6e12..3fad1fd 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey,
* signature and returns that to us.
*/
ret = crypto_akcipher_verify(req);
- if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
+ if ((ret == -EINPROGRESS) || (ret == -EIOCBQUEUED)) {
wait_for_completion(&compl.completion);
ret = compl.err;
}
diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c
index db1bc31..e0e2785 100644
--- a/crypto/chacha20poly1305.c
+++ b/crypto/chacha20poly1305.c
@@ -79,7 +79,7 @@ static inline void async_done_continue(struct aead_request *req, int err,
if (!err)
err = cont(req);
- if (err != -EINPROGRESS && err != -EBUSY)
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
aead_request_complete(req, err);
}
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 0508c48..5daca13 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -137,16 +137,14 @@ static int cryptd_enqueue_request(struct cryptd_queue *queue,
int cpu, err;
struct cryptd_cpu_queue *cpu_queue;
atomic_t *refcnt;
- bool may_backlog;
cpu = get_cpu();
cpu_queue = this_cpu_ptr(queue->cpu_queue);
err = crypto_enqueue_request(&cpu_queue->queue, request);
refcnt = crypto_tfm_ctx(request->tfm);
- may_backlog = request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG;
- if (err == -EBUSY && !may_backlog)
+ if (err == -EBUSY)
goto out_put_cpu;
queue_work_on(cpu, kcrypto_wq, &cpu_queue->work);
diff --git a/crypto/cts.c b/crypto/cts.c
index 243f591..e2068dc 100644
--- a/crypto/cts.c
+++ b/crypto/cts.c
@@ -136,8 +136,7 @@ static void crypto_cts_encrypt_done(struct crypto_async_request *areq, int err)
goto out;
err = cts_cbc_encrypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return;
out:
@@ -229,8 +228,7 @@ static void crypto_cts_decrypt_done(struct crypto_async_request *areq, int err)
goto out;
err = cts_cbc_decrypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return;
out:
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 633a88e..850b451 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1767,7 +1767,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&drbg->ctr_completion);
if (!drbg->ctr_async_err) {
reinit_completion(&drbg->ctr_completion);
diff --git a/crypto/gcm.c b/crypto/gcm.c
index 3841b5e..ffac821 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -151,7 +151,7 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key,
sizeof(data->hash), data->iv);
err = crypto_skcipher_encrypt(&data->req);
- if (err == -EINPROGRESS || err == -EBUSY) {
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED) {
wait_for_completion(&data->result.completion);
err = data->result.err;
}
diff --git a/crypto/lrw.c b/crypto/lrw.c
index a8bfae4..e2b1378 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -328,9 +328,7 @@ static int do_encrypt(struct skcipher_request *req, int err)
crypto_skcipher_encrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
@@ -380,9 +378,7 @@ static int do_decrypt(struct skcipher_request *req, int err)
crypto_skcipher_decrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c
index 407c64b..3c82542 100644
--- a/crypto/rsa-pkcs1pad.c
+++ b/crypto/rsa-pkcs1pad.c
@@ -279,9 +279,7 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)
req->dst, ctx->key_size - 1, req->dst_len);
err = crypto_akcipher_encrypt(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_encrypt_sign_complete(req, err);
return err;
@@ -383,9 +381,7 @@ static int pkcs1pad_decrypt(struct akcipher_request *req)
ctx->key_size);
err = crypto_akcipher_decrypt(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_decrypt_complete(req, err);
return err;
@@ -440,9 +436,7 @@ static int pkcs1pad_sign(struct akcipher_request *req)
req->dst, ctx->key_size - 1, req->dst_len);
err = crypto_akcipher_sign(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_encrypt_sign_complete(req, err);
return err;
@@ -561,9 +555,7 @@ static int pkcs1pad_verify(struct akcipher_request *req)
ctx->key_size);
err = crypto_akcipher_verify(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_verify_complete(req, err);
return err;
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 0dd6a43..57f7ac4 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -97,7 +97,7 @@ static void tcrypt_complete(struct crypto_async_request *req, int err)
static inline int do_one_aead_op(struct aead_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
ret = wait_for_completion_interruptible(&tr->completion);
@@ -397,7 +397,7 @@ static void test_hash_sg_init(struct scatterlist *sg)
static inline int do_one_ahash_op(struct ahash_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
wait_for_completion(&tr->completion);
@@ -765,7 +765,7 @@ static void test_hash_speed(const char *algo, unsigned int secs,
static inline int do_one_acipher_op(struct skcipher_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
wait_for_completion(&tr->completion);
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 7125ba3..fb5418f 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -195,7 +195,7 @@ static void testmgr_free_buf(char *buf[XBUFSIZE])
static int wait_async_op(struct tcrypt_result *tr, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
wait_for_completion(&tr->completion);
reinit_completion(&tr->completion);
ret = tr->err;
@@ -425,7 +425,7 @@ static int __test_hash(struct crypto_ahash *tfm,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&tresult.completion);
reinit_completion(&tresult.completion);
ret = tresult.err;
@@ -723,7 +723,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
}
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -880,7 +880,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
}
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -1171,7 +1171,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -1279,7 +1279,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
diff --git a/crypto/xts.c b/crypto/xts.c
index d86c11a..b4b90cc 100644
--- a/crypto/xts.c
+++ b/crypto/xts.c
@@ -269,9 +269,7 @@ static int do_encrypt(struct skcipher_request *req, int err)
crypto_skcipher_encrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
@@ -321,9 +319,7 @@ static int do_decrypt(struct skcipher_request *req, int err)
crypto_skcipher_decrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
--
2.1.4
^ permalink raw reply related
* [PATCH v3 01/28] crypto: change backlog return code to -EIOCBQUEUED
From: Gilad Ben-Yossef @ 2017-07-02 14:41 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jonathan Corbet, David Howells,
Tom Lendacky, Gary Hook, Boris Brezillon, Arnaud Ebalard,
Matthias Brugger, Alasdair Kergon, Mike Snitzer, dm-devel,
Shaohua Li, Steve French, Theodore Y. Ts'o, Jaegeuk Kim,
Mimi Zohar, Dmitry Kasatkin, James Morris, Serge E. Hallyn,
linux-crypto, linux-doc, linux-kernel, keyrings, linux-arm-kernel
Cc: Ofir Drang
In-Reply-To: <1499006535-19760-1-git-send-email-gilad@benyossef.com>
The crypto API was using the -EBUSY return value to indicate
both a hard failure to submit a crypto operation into a
transformation provider when the latter was busy and the backlog
mechanism was not enabled as well as a notification that the operation
was queued into the backlog when the backlog mechanism was enabled.
Having the same return code indicate two very different conditions
depending on a flag is both error prone and requires extra runtime
check like the following to discern between the cases:
if (err == -EINPROGRESS ||
(err == -EBUSY && (ahash_request_flags(req) &
CRYPTO_TFM_REQ_MAY_BACKLOG)))
This patch changes the return code used to indicate a crypto op
was queued in the backlog to -EIOCBQUEUED, thus resolving both
issues.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
---
crypto/af_alg.c | 2 +-
crypto/ahash.c | 12 +++---------
crypto/algapi.c | 6 ++++--
crypto/asymmetric_keys/public_key.c | 2 +-
crypto/chacha20poly1305.c | 2 +-
crypto/cryptd.c | 4 +---
crypto/cts.c | 6 ++----
crypto/drbg.c | 2 +-
crypto/gcm.c | 2 +-
crypto/lrw.c | 8 ++------
crypto/rsa-pkcs1pad.c | 16 ++++------------
crypto/tcrypt.c | 6 +++---
crypto/testmgr.c | 12 ++++++------
crypto/xts.c | 8 ++------
14 files changed, 32 insertions(+), 56 deletions(-)
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 3556d8e..c67daba 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -484,7 +484,7 @@ int af_alg_wait_for_completion(int err, struct af_alg_completion *completion)
{
switch (err) {
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&completion->completion);
reinit_completion(&completion->completion);
err = completion->err;
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 826cd7a..65d08db 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -334,9 +334,7 @@ static int ahash_op_unaligned(struct ahash_request *req,
return err;
err = op(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
ahash_restore_req(req, err);
@@ -394,9 +392,7 @@ static int ahash_def_finup_finish1(struct ahash_request *req, int err)
req->base.complete = ahash_def_finup_done2;
err = crypto_ahash_reqtfm(req)->final(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
out:
@@ -432,9 +428,7 @@ static int ahash_def_finup(struct ahash_request *req)
return err;
err = tfm->update(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
return ahash_def_finup_finish1(req, err);
diff --git a/crypto/algapi.c b/crypto/algapi.c
index e4cc761..3bfd1fa 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -897,9 +897,11 @@ int crypto_enqueue_request(struct crypto_queue *queue,
int err = -EINPROGRESS;
if (unlikely(queue->qlen >= queue->max_qlen)) {
- err = -EBUSY;
- if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) {
+ err = -EBUSY;
goto out;
+ }
+ err = -EIOCBQUEUED;
if (queue->backlog == &queue->list)
queue->backlog = &request->list;
}
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index 3cd6e12..3fad1fd 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey,
* signature and returns that to us.
*/
ret = crypto_akcipher_verify(req);
- if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
+ if ((ret == -EINPROGRESS) || (ret == -EIOCBQUEUED)) {
wait_for_completion(&compl.completion);
ret = compl.err;
}
diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c
index db1bc31..e0e2785 100644
--- a/crypto/chacha20poly1305.c
+++ b/crypto/chacha20poly1305.c
@@ -79,7 +79,7 @@ static inline void async_done_continue(struct aead_request *req, int err,
if (!err)
err = cont(req);
- if (err != -EINPROGRESS && err != -EBUSY)
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
aead_request_complete(req, err);
}
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 0508c48..5daca13 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -137,16 +137,14 @@ static int cryptd_enqueue_request(struct cryptd_queue *queue,
int cpu, err;
struct cryptd_cpu_queue *cpu_queue;
atomic_t *refcnt;
- bool may_backlog;
cpu = get_cpu();
cpu_queue = this_cpu_ptr(queue->cpu_queue);
err = crypto_enqueue_request(&cpu_queue->queue, request);
refcnt = crypto_tfm_ctx(request->tfm);
- may_backlog = request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG;
- if (err == -EBUSY && !may_backlog)
+ if (err == -EBUSY)
goto out_put_cpu;
queue_work_on(cpu, kcrypto_wq, &cpu_queue->work);
diff --git a/crypto/cts.c b/crypto/cts.c
index 243f591..e2068dc 100644
--- a/crypto/cts.c
+++ b/crypto/cts.c
@@ -136,8 +136,7 @@ static void crypto_cts_encrypt_done(struct crypto_async_request *areq, int err)
goto out;
err = cts_cbc_encrypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return;
out:
@@ -229,8 +228,7 @@ static void crypto_cts_decrypt_done(struct crypto_async_request *areq, int err)
goto out;
err = cts_cbc_decrypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return;
out:
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 633a88e..850b451 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1767,7 +1767,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&drbg->ctr_completion);
if (!drbg->ctr_async_err) {
reinit_completion(&drbg->ctr_completion);
diff --git a/crypto/gcm.c b/crypto/gcm.c
index 3841b5e..ffac821 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -151,7 +151,7 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key,
sizeof(data->hash), data->iv);
err = crypto_skcipher_encrypt(&data->req);
- if (err == -EINPROGRESS || err == -EBUSY) {
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED) {
wait_for_completion(&data->result.completion);
err = data->result.err;
}
diff --git a/crypto/lrw.c b/crypto/lrw.c
index a8bfae4..e2b1378 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -328,9 +328,7 @@ static int do_encrypt(struct skcipher_request *req, int err)
crypto_skcipher_encrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
@@ -380,9 +378,7 @@ static int do_decrypt(struct skcipher_request *req, int err)
crypto_skcipher_decrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c
index 407c64b..3c82542 100644
--- a/crypto/rsa-pkcs1pad.c
+++ b/crypto/rsa-pkcs1pad.c
@@ -279,9 +279,7 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)
req->dst, ctx->key_size - 1, req->dst_len);
err = crypto_akcipher_encrypt(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_encrypt_sign_complete(req, err);
return err;
@@ -383,9 +381,7 @@ static int pkcs1pad_decrypt(struct akcipher_request *req)
ctx->key_size);
err = crypto_akcipher_decrypt(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_decrypt_complete(req, err);
return err;
@@ -440,9 +436,7 @@ static int pkcs1pad_sign(struct akcipher_request *req)
req->dst, ctx->key_size - 1, req->dst_len);
err = crypto_akcipher_sign(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_encrypt_sign_complete(req, err);
return err;
@@ -561,9 +555,7 @@ static int pkcs1pad_verify(struct akcipher_request *req)
ctx->key_size);
err = crypto_akcipher_verify(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_verify_complete(req, err);
return err;
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 0dd6a43..57f7ac4 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -97,7 +97,7 @@ static void tcrypt_complete(struct crypto_async_request *req, int err)
static inline int do_one_aead_op(struct aead_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
ret = wait_for_completion_interruptible(&tr->completion);
@@ -397,7 +397,7 @@ static void test_hash_sg_init(struct scatterlist *sg)
static inline int do_one_ahash_op(struct ahash_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
wait_for_completion(&tr->completion);
@@ -765,7 +765,7 @@ static void test_hash_speed(const char *algo, unsigned int secs,
static inline int do_one_acipher_op(struct skcipher_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
wait_for_completion(&tr->completion);
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 7125ba3..fb5418f 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -195,7 +195,7 @@ static void testmgr_free_buf(char *buf[XBUFSIZE])
static int wait_async_op(struct tcrypt_result *tr, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
wait_for_completion(&tr->completion);
reinit_completion(&tr->completion);
ret = tr->err;
@@ -425,7 +425,7 @@ static int __test_hash(struct crypto_ahash *tfm,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&tresult.completion);
reinit_completion(&tresult.completion);
ret = tresult.err;
@@ -723,7 +723,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
}
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -880,7 +880,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
}
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -1171,7 +1171,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -1279,7 +1279,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
diff --git a/crypto/xts.c b/crypto/xts.c
index d86c11a..b4b90cc 100644
--- a/crypto/xts.c
+++ b/crypto/xts.c
@@ -269,9 +269,7 @@ static int do_encrypt(struct skcipher_request *req, int err)
crypto_skcipher_encrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
@@ -321,9 +319,7 @@ static int do_decrypt(struct skcipher_request *req, int err)
crypto_skcipher_decrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
--
2.1.4
^ permalink raw reply related
* [PATCH v3 01/28] crypto: change backlog return code to -EIOCBQUEUED
From: Gilad Ben-Yossef @ 2017-07-02 14:41 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jonathan Corbet, David Howells,
Tom Lendacky, Gary Hook, Boris Brezillon, Arnaud Ebalard,
Matthias Brugger, Alasdair Kergon, Mike Snitzer,
dm-devel-H+wXaHxf7aLQT0dZR+AlfA, Shaohua Li, Steve French,
Theodore Y. Ts'o, Jaegeuk Kim, Mimi Zohar, Dmitry Kasatkin,
James Morris, Serge E. Hallyn,
linux-crypto-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
keyrings-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel
Cc: Ofir Drang
In-Reply-To: <1499006535-19760-1-git-send-email-gilad-6S/DczAoZh3WXxRugSxzZg@public.gmane.org>
The crypto API was using the -EBUSY return value to indicate
both a hard failure to submit a crypto operation into a
transformation provider when the latter was busy and the backlog
mechanism was not enabled as well as a notification that the operation
was queued into the backlog when the backlog mechanism was enabled.
Having the same return code indicate two very different conditions
depending on a flag is both error prone and requires extra runtime
check like the following to discern between the cases:
if (err == -EINPROGRESS ||
(err == -EBUSY && (ahash_request_flags(req) &
CRYPTO_TFM_REQ_MAY_BACKLOG)))
This patch changes the return code used to indicate a crypto op
was queued in the backlog to -EIOCBQUEUED, thus resolving both
issues.
Signed-off-by: Gilad Ben-Yossef <gilad-6S/DczAoZh3WXxRugSxzZg@public.gmane.org>
---
crypto/af_alg.c | 2 +-
crypto/ahash.c | 12 +++---------
crypto/algapi.c | 6 ++++--
crypto/asymmetric_keys/public_key.c | 2 +-
crypto/chacha20poly1305.c | 2 +-
crypto/cryptd.c | 4 +---
crypto/cts.c | 6 ++----
crypto/drbg.c | 2 +-
crypto/gcm.c | 2 +-
crypto/lrw.c | 8 ++------
crypto/rsa-pkcs1pad.c | 16 ++++------------
crypto/tcrypt.c | 6 +++---
crypto/testmgr.c | 12 ++++++------
crypto/xts.c | 8 ++------
14 files changed, 32 insertions(+), 56 deletions(-)
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 3556d8e..c67daba 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -484,7 +484,7 @@ int af_alg_wait_for_completion(int err, struct af_alg_completion *completion)
{
switch (err) {
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&completion->completion);
reinit_completion(&completion->completion);
err = completion->err;
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 826cd7a..65d08db 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -334,9 +334,7 @@ static int ahash_op_unaligned(struct ahash_request *req,
return err;
err = op(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
ahash_restore_req(req, err);
@@ -394,9 +392,7 @@ static int ahash_def_finup_finish1(struct ahash_request *req, int err)
req->base.complete = ahash_def_finup_done2;
err = crypto_ahash_reqtfm(req)->final(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
out:
@@ -432,9 +428,7 @@ static int ahash_def_finup(struct ahash_request *req)
return err;
err = tfm->update(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && (ahash_request_flags(req) &
- CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
return ahash_def_finup_finish1(req, err);
diff --git a/crypto/algapi.c b/crypto/algapi.c
index e4cc761..3bfd1fa 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -897,9 +897,11 @@ int crypto_enqueue_request(struct crypto_queue *queue,
int err = -EINPROGRESS;
if (unlikely(queue->qlen >= queue->max_qlen)) {
- err = -EBUSY;
- if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (!(request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) {
+ err = -EBUSY;
goto out;
+ }
+ err = -EIOCBQUEUED;
if (queue->backlog == &queue->list)
queue->backlog = &request->list;
}
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index 3cd6e12..3fad1fd 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey,
* signature and returns that to us.
*/
ret = crypto_akcipher_verify(req);
- if ((ret == -EINPROGRESS) || (ret == -EBUSY)) {
+ if ((ret == -EINPROGRESS) || (ret == -EIOCBQUEUED)) {
wait_for_completion(&compl.completion);
ret = compl.err;
}
diff --git a/crypto/chacha20poly1305.c b/crypto/chacha20poly1305.c
index db1bc31..e0e2785 100644
--- a/crypto/chacha20poly1305.c
+++ b/crypto/chacha20poly1305.c
@@ -79,7 +79,7 @@ static inline void async_done_continue(struct aead_request *req, int err,
if (!err)
err = cont(req);
- if (err != -EINPROGRESS && err != -EBUSY)
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
aead_request_complete(req, err);
}
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 0508c48..5daca13 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -137,16 +137,14 @@ static int cryptd_enqueue_request(struct cryptd_queue *queue,
int cpu, err;
struct cryptd_cpu_queue *cpu_queue;
atomic_t *refcnt;
- bool may_backlog;
cpu = get_cpu();
cpu_queue = this_cpu_ptr(queue->cpu_queue);
err = crypto_enqueue_request(&cpu_queue->queue, request);
refcnt = crypto_tfm_ctx(request->tfm);
- may_backlog = request->flags & CRYPTO_TFM_REQ_MAY_BACKLOG;
- if (err == -EBUSY && !may_backlog)
+ if (err == -EBUSY)
goto out_put_cpu;
queue_work_on(cpu, kcrypto_wq, &cpu_queue->work);
diff --git a/crypto/cts.c b/crypto/cts.c
index 243f591..e2068dc 100644
--- a/crypto/cts.c
+++ b/crypto/cts.c
@@ -136,8 +136,7 @@ static void crypto_cts_encrypt_done(struct crypto_async_request *areq, int err)
goto out;
err = cts_cbc_encrypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return;
out:
@@ -229,8 +228,7 @@ static void crypto_cts_decrypt_done(struct crypto_async_request *areq, int err)
goto out;
err = cts_cbc_decrypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY && req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return;
out:
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 633a88e..850b451 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1767,7 +1767,7 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&drbg->ctr_completion);
if (!drbg->ctr_async_err) {
reinit_completion(&drbg->ctr_completion);
diff --git a/crypto/gcm.c b/crypto/gcm.c
index 3841b5e..ffac821 100644
--- a/crypto/gcm.c
+++ b/crypto/gcm.c
@@ -151,7 +151,7 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key,
sizeof(data->hash), data->iv);
err = crypto_skcipher_encrypt(&data->req);
- if (err == -EINPROGRESS || err == -EBUSY) {
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED) {
wait_for_completion(&data->result.completion);
err = data->result.err;
}
diff --git a/crypto/lrw.c b/crypto/lrw.c
index a8bfae4..e2b1378 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -328,9 +328,7 @@ static int do_encrypt(struct skcipher_request *req, int err)
crypto_skcipher_encrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
@@ -380,9 +378,7 @@ static int do_decrypt(struct skcipher_request *req, int err)
crypto_skcipher_decrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c
index 407c64b..3c82542 100644
--- a/crypto/rsa-pkcs1pad.c
+++ b/crypto/rsa-pkcs1pad.c
@@ -279,9 +279,7 @@ static int pkcs1pad_encrypt(struct akcipher_request *req)
req->dst, ctx->key_size - 1, req->dst_len);
err = crypto_akcipher_encrypt(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_encrypt_sign_complete(req, err);
return err;
@@ -383,9 +381,7 @@ static int pkcs1pad_decrypt(struct akcipher_request *req)
ctx->key_size);
err = crypto_akcipher_decrypt(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_decrypt_complete(req, err);
return err;
@@ -440,9 +436,7 @@ static int pkcs1pad_sign(struct akcipher_request *req)
req->dst, ctx->key_size - 1, req->dst_len);
err = crypto_akcipher_sign(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_encrypt_sign_complete(req, err);
return err;
@@ -561,9 +555,7 @@ static int pkcs1pad_verify(struct akcipher_request *req)
ctx->key_size);
err = crypto_akcipher_verify(&req_ctx->child_req);
- if (err != -EINPROGRESS &&
- (err != -EBUSY ||
- !(req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)))
+ if (err != -EINPROGRESS && err != -EIOCBQUEUED)
return pkcs1pad_verify_complete(req, err);
return err;
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 0dd6a43..57f7ac4 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -97,7 +97,7 @@ static void tcrypt_complete(struct crypto_async_request *req, int err)
static inline int do_one_aead_op(struct aead_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
ret = wait_for_completion_interruptible(&tr->completion);
@@ -397,7 +397,7 @@ static void test_hash_sg_init(struct scatterlist *sg)
static inline int do_one_ahash_op(struct ahash_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
wait_for_completion(&tr->completion);
@@ -765,7 +765,7 @@ static void test_hash_speed(const char *algo, unsigned int secs,
static inline int do_one_acipher_op(struct skcipher_request *req, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
struct tcrypt_result *tr = req->base.data;
wait_for_completion(&tr->completion);
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 7125ba3..fb5418f 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -195,7 +195,7 @@ static void testmgr_free_buf(char *buf[XBUFSIZE])
static int wait_async_op(struct tcrypt_result *tr, int ret)
{
- if (ret == -EINPROGRESS || ret == -EBUSY) {
+ if (ret == -EINPROGRESS || ret == -EIOCBQUEUED) {
wait_for_completion(&tr->completion);
reinit_completion(&tr->completion);
ret = tr->err;
@@ -425,7 +425,7 @@ static int __test_hash(struct crypto_ahash *tfm,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&tresult.completion);
reinit_completion(&tresult.completion);
ret = tresult.err;
@@ -723,7 +723,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
}
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -880,7 +880,7 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
}
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -1171,7 +1171,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
@@ -1279,7 +1279,7 @@ static int __test_skcipher(struct crypto_skcipher *tfm, int enc,
case 0:
break;
case -EINPROGRESS:
- case -EBUSY:
+ case -EIOCBQUEUED:
wait_for_completion(&result.completion);
reinit_completion(&result.completion);
ret = result.err;
diff --git a/crypto/xts.c b/crypto/xts.c
index d86c11a..b4b90cc 100644
--- a/crypto/xts.c
+++ b/crypto/xts.c
@@ -269,9 +269,7 @@ static int do_encrypt(struct skcipher_request *req, int err)
crypto_skcipher_encrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
@@ -321,9 +319,7 @@ static int do_decrypt(struct skcipher_request *req, int err)
crypto_skcipher_decrypt(subreq) ?:
post_crypt(req);
- if (err == -EINPROGRESS ||
- (err == -EBUSY &&
- req->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG))
+ if (err == -EINPROGRESS || err == -EIOCBQUEUED)
return err;
}
--
2.1.4
^ permalink raw reply related
* [PATCH v3 02/28] crypto: atmel: use -EIOCBQUEUED for backlog indication
From: Gilad Ben-Yossef @ 2017-07-02 14:41 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Jonathan Corbet, David Howells,
Tom Lendacky, Gary Hook, Boris Brezillon, Arnaud Ebalard,
Matthias Brugger, Alasdair Kergon, Mike Snitzer, dm-devel,
Shaohua Li, Steve French, Theodore Y. Ts'o, Jaegeuk Kim,
Mimi Zohar, Dmitry Kasatkin, James Morris, Serge E. Hallyn,
linux-crypto, linux-doc, linux-kernel, keyrings, linux-arm-kernel
Cc: Ofir Drang
In-Reply-To: <1499006535-19760-1-git-send-email-gilad@benyossef.com>
Replace -EBUSY with -EIOCBQUEUED for backlog queueing indication
as part of new API
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
---
This patch should be squashed with the first patch in the series
when applied.
drivers/crypto/atmel-sha.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index a948202..30223ee 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -1204,7 +1204,7 @@ static int atmel_sha_finup(struct ahash_request *req)
ctx->flags |= SHA_FLAGS_FINUP;
err1 = atmel_sha_update(req);
- if (err1 == -EINPROGRESS || err1 == -EBUSY)
+ if (err1 == -EINPROGRESS || err1 == -EIOCBQUEUED)
return err1;
/*
--
2.1.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox