public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 3] Block Layer Data Integrity Fixes
@ 2009-01-04  7:43 Martin K. Petersen
  2009-01-04  7:43 ` [PATCH 1 of 3] block: Don't verify integrity metadata on read error Martin K. Petersen
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Martin K. Petersen @ 2009-01-04  7:43 UTC (permalink / raw)
  To: jens.axboe, linux-kernel


Block integrity updates for 2.6.29.

3 files changed, 29 insertions(+), 23 deletions(-)
block/blk-integrity.c |   25 ++++++++++++++-----------
fs/bio-integrity.c    |   26 +++++++++++++++-----------
include/linux/bio.h   |    1 -



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

* [PATCH 1 of 3] block: Don't verify integrity metadata on read error
  2009-01-04  7:43 [PATCH 0 of 3] Block Layer Data Integrity Fixes Martin K. Petersen
@ 2009-01-04  7:43 ` Martin K. Petersen
  2009-01-04  7:43 ` [PATCH 2 of 3] block: Remove obsolete BUG_ON Martin K. Petersen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2009-01-04  7:43 UTC (permalink / raw)
  To: jens.axboe, linux-kernel

If we get an I/O error on a read request there is no point in doing a
verify pass on the integrity buffer.  Adjust the completion path
accordingly.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

---
2 files changed, 15 insertions(+), 11 deletions(-)
fs/bio-integrity.c  |   25 +++++++++++++++----------
include/linux/bio.h |    1 -



diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -465,7 +465,7 @@ static int bio_integrity_verify(struct b
 
 		if (ret) {
 			kunmap_atomic(kaddr, KM_USER0);
-			break;
+			return ret;
 		}
 
 		sectors = bv->bv_len / bi->sector_size;
@@ -493,18 +493,13 @@ static void bio_integrity_verify_fn(stru
 	struct bio_integrity_payload *bip =
 		container_of(work, struct bio_integrity_payload, bip_work);
 	struct bio *bio = bip->bip_bio;
-	int error = bip->bip_error;
+	int error;
 
-	if (bio_integrity_verify(bio)) {
-		clear_bit(BIO_UPTODATE, &bio->bi_flags);
-		error = -EIO;
-	}
+	error = bio_integrity_verify(bio);
 
 	/* Restore original bio completion handler */
 	bio->bi_end_io = bip->bip_end_io;
-
-	if (bio->bi_end_io)
-		bio->bi_end_io(bio, error);
+	bio_endio(bio, error);
 }
 
 /**
@@ -525,7 +520,17 @@ void bio_integrity_endio(struct bio *bio
 
 	BUG_ON(bip->bip_bio != bio);
 
-	bip->bip_error = error;
+	/* In case of an I/O error there is no point in verifying the
+	 * integrity metadata.  Restore original bio end_io handler
+	 * and run it.
+	 */
+	if (error) {
+		bio->bi_end_io = bip->bip_end_io;
+		bio_endio(bio, error);
+
+		return;
+	}
+
 	INIT_WORK(&bip->bip_work, bio_integrity_verify_fn);
 	queue_work(kintegrityd_wq, &bip->bip_work);
 }
diff --git a/include/linux/bio.h b/include/linux/bio.h
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -312,7 +312,6 @@ struct bio_integrity_payload {
 	void			*bip_buf;	/* generated integrity data */
 	bio_end_io_t		*bip_end_io;	/* saved I/O completion fn */
 
-	int			bip_error;	/* saved I/O error */
 	unsigned int		bip_size;
 
 	unsigned short		bip_pool;	/* pool the ivec came from */



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

* [PATCH 2 of 3] block: Remove obsolete BUG_ON
  2009-01-04  7:43 [PATCH 0 of 3] Block Layer Data Integrity Fixes Martin K. Petersen
  2009-01-04  7:43 ` [PATCH 1 of 3] block: Don't verify integrity metadata on read error Martin K. Petersen
@ 2009-01-04  7:43 ` Martin K. Petersen
  2009-01-04  7:43 ` [PATCH 3 of 3] block: Allow empty integrity profile Martin K. Petersen
  2009-01-05  9:13 ` [PATCH 0 of 3] Block Layer Data Integrity Fixes Jens Axboe
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2009-01-04  7:43 UTC (permalink / raw)
  To: jens.axboe, linux-kernel

Now that bio_vecs are no longer cleared in bvec_alloc_bs() the following
BUG_ON must go.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

---
1 file changed, 1 deletion(-)
fs/bio-integrity.c |    1 -



diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -140,7 +140,6 @@ int bio_integrity_add_page(struct bio *b
 
 	iv = bip_vec_idx(bip, bip->bip_vcnt);
 	BUG_ON(iv == NULL);
-	BUG_ON(iv->bv_page != NULL);
 
 	iv->bv_page = page;
 	iv->bv_len = len;



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

* [PATCH 3 of 3] block: Allow empty integrity profile
  2009-01-04  7:43 [PATCH 0 of 3] Block Layer Data Integrity Fixes Martin K. Petersen
  2009-01-04  7:43 ` [PATCH 1 of 3] block: Don't verify integrity metadata on read error Martin K. Petersen
  2009-01-04  7:43 ` [PATCH 2 of 3] block: Remove obsolete BUG_ON Martin K. Petersen
@ 2009-01-04  7:43 ` Martin K. Petersen
  2009-01-05  9:13 ` [PATCH 0 of 3] Block Layer Data Integrity Fixes Jens Axboe
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2009-01-04  7:43 UTC (permalink / raw)
  To: jens.axboe, linux-kernel

Allow a block device to allocate and register an integrity profile
without providing a template.  This allows DM to preallocate a profile
to avoid deadlocks during table reconfiguration.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

---
1 file changed, 14 insertions(+), 11 deletions(-)
block/blk-integrity.c |   25 ++++++++++++++-----------



diff --git a/block/blk-integrity.c b/block/blk-integrity.c
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -309,24 +309,24 @@ static struct kobj_type integrity_ktype 
 /**
  * blk_integrity_register - Register a gendisk as being integrity-capable
  * @disk:	struct gendisk pointer to make integrity-aware
- * @template:	integrity profile
+ * @template:	optional integrity profile to register
  *
  * Description: When a device needs to advertise itself as being able
  * to send/receive integrity metadata it must use this function to
  * register the capability with the block layer.  The template is a
  * blk_integrity struct with values appropriate for the underlying
- * hardware.  See Documentation/block/data-integrity.txt.
+ * hardware.  If template is NULL the new profile is allocated but
+ * not filled out. See Documentation/block/data-integrity.txt.
  */
 int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
 {
 	struct blk_integrity *bi;
 
 	BUG_ON(disk == NULL);
-	BUG_ON(template == NULL);
 
 	if (disk->integrity == NULL) {
 		bi = kmem_cache_alloc(integrity_cachep,
-						GFP_KERNEL | __GFP_ZERO);
+				      GFP_KERNEL | __GFP_ZERO);
 		if (!bi)
 			return -1;
 
@@ -346,13 +346,16 @@ int blk_integrity_register(struct gendis
 		bi = disk->integrity;
 
 	/* Use the provided profile as template */
-	bi->name = template->name;
-	bi->generate_fn = template->generate_fn;
-	bi->verify_fn = template->verify_fn;
-	bi->tuple_size = template->tuple_size;
-	bi->set_tag_fn = template->set_tag_fn;
-	bi->get_tag_fn = template->get_tag_fn;
-	bi->tag_size = template->tag_size;
+	if (template != NULL) {
+		bi->name = template->name;
+		bi->generate_fn = template->generate_fn;
+		bi->verify_fn = template->verify_fn;
+		bi->tuple_size = template->tuple_size;
+		bi->set_tag_fn = template->set_tag_fn;
+		bi->get_tag_fn = template->get_tag_fn;
+		bi->tag_size = template->tag_size;
+	} else
+		bi->name = "unsupported";
 
 	return 0;
 }



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

* Re: [PATCH 0 of 3] Block Layer Data Integrity Fixes
  2009-01-04  7:43 [PATCH 0 of 3] Block Layer Data Integrity Fixes Martin K. Petersen
                   ` (2 preceding siblings ...)
  2009-01-04  7:43 ` [PATCH 3 of 3] block: Allow empty integrity profile Martin K. Petersen
@ 2009-01-05  9:13 ` Jens Axboe
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2009-01-05  9:13 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: linux-kernel

On Sun, Jan 04 2009, Martin K. Petersen wrote:
> 
> Block integrity updates for 2.6.29.
> 
> 3 files changed, 29 insertions(+), 23 deletions(-)
> block/blk-integrity.c |   25 ++++++++++++++-----------
> fs/bio-integrity.c    |   26 +++++++++++++++-----------
> include/linux/bio.h   |    1 -

Applied 1-3 for 2.6.29

-- 
Jens Axboe


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

end of thread, other threads:[~2009-01-05  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-04  7:43 [PATCH 0 of 3] Block Layer Data Integrity Fixes Martin K. Petersen
2009-01-04  7:43 ` [PATCH 1 of 3] block: Don't verify integrity metadata on read error Martin K. Petersen
2009-01-04  7:43 ` [PATCH 2 of 3] block: Remove obsolete BUG_ON Martin K. Petersen
2009-01-04  7:43 ` [PATCH 3 of 3] block: Allow empty integrity profile Martin K. Petersen
2009-01-05  9:13 ` [PATCH 0 of 3] Block Layer Data Integrity Fixes Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox