diff mbox

dm-integrity: Do not check integrity for failed read operations

Message ID 1501485740-27519-1-git-send-email-hyc.lee@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show

Commit Message

Hyunchul Lee July 31, 2017, 7:22 a.m. UTC
From: Hyunchul Lee <cheol.lee@lge.com>

Even though read operations fail, dm_integrity_map_continue()
calls integrity_metadata() to check integrity. In this case,
just complete these.

Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
---
 drivers/md/dm-integrity.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Milan Broz Aug. 1, 2017, 7:53 a.m. UTC | #1
On 07/31/2017 09:22 AM, Hyunchul Lee wrote:
> From: Hyunchul Lee <cheol.lee@lge.com>
> 
> Even though read operations fail, dm_integrity_map_continue()
> calls integrity_metadata() to check integrity. In this case,
> just complete these.

Yes this makes sense to me.

If bio->bi_status is set, it is directly propagated and the whole
bio is failed.

But this is just shortcut, the bio will fail the same way (with bi_status),
just integrity calculation code is skipped, so I think it should go to 4.13.

Thanks,
Milan

> 
> Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
> ---
>  drivers/md/dm-integrity.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 10f123e..f99eee9 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -1697,7 +1697,11 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
>  
>  	if (need_sync_io) {
>  		wait_for_completion_io(&read_comp);
> -		integrity_metadata(&dio->work);
> +		if (likely(!bio->bi_status))
> +			integrity_metadata(&dio->work);
> +		else
> +			dec_in_flight(dio);
> +
>  	} else {
>  		INIT_WORK(&dio->work, integrity_metadata);
>  		queue_work(ic->metadata_wq, &dio->work);
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
Mikulas Patocka Aug. 1, 2017, 11:05 p.m. UTC | #2
On Tue, 1 Aug 2017, Milan Broz wrote:

> On 07/31/2017 09:22 AM, Hyunchul Lee wrote:
> > From: Hyunchul Lee <cheol.lee@lge.com>
> > 
> > Even though read operations fail, dm_integrity_map_continue()
> > calls integrity_metadata() to check integrity. In this case,
> > just complete these.
> 
> Yes this makes sense to me.
> 
> If bio->bi_status is set, it is directly propagated and the whole
> bio is failed.
> 
> But this is just shortcut, the bio will fail the same way (with bi_status),
> just integrity calculation code is skipped, so I think it should go to 4.13.
> 
> Thanks,
> Milan

I would also mark this patch for backporting to the stable kernels - so 
that I/O errors do not generate integrity warnings in the log.

Mikulas

> > Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
> > ---
> >  drivers/md/dm-integrity.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> > index 10f123e..f99eee9 100644
> > --- a/drivers/md/dm-integrity.c
> > +++ b/drivers/md/dm-integrity.c
> > @@ -1697,7 +1697,11 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
> >  
> >  	if (need_sync_io) {
> >  		wait_for_completion_io(&read_comp);
> > -		integrity_metadata(&dio->work);
> > +		if (likely(!bio->bi_status))
> > +			integrity_metadata(&dio->work);
> > +		else
> > +			dec_in_flight(dio);
> > +
> >  	} else {
> >  		INIT_WORK(&dio->work, integrity_metadata);
> >  		queue_work(ic->metadata_wq, &dio->work);
> > 
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox

Patch

diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 10f123e..f99eee9 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -1697,7 +1697,11 @@  static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
 
 	if (need_sync_io) {
 		wait_for_completion_io(&read_comp);
-		integrity_metadata(&dio->work);
+		if (likely(!bio->bi_status))
+			integrity_metadata(&dio->work);
+		else
+			dec_in_flight(dio);
+
 	} else {
 		INIT_WORK(&dio->work, integrity_metadata);
 		queue_work(ic->metadata_wq, &dio->work);