All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: dm-devel@redhat.com
Subject: [PATCH v5 13/13] dm snapshot: report merge failure in status
Date: Sat, 5 Dec 2009 13:44:38 -0500	[thread overview]
Message-ID: <20091205184437.GA21045@redhat.com> (raw)
In-Reply-To: <1259893434-10792-14-git-send-email-snitzer@redhat.com>

Set 'merge_failed' flag if a snapshot fails to merge.  Update
snapshot_status() to report "Merge failed" if 'merge_failed' is set.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
NOTE: Revised slightly so all other merge failures in merge_callback()
properly set 'merge_failed'
---
 drivers/md/dm-snap.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Index: linux-2.6-dev/drivers/md/dm-snap.c
===================================================================
--- linux-2.6-dev.orig/drivers/md/dm-snap.c
+++ linux-2.6-dev/drivers/md/dm-snap.c
@@ -102,6 +102,9 @@ struct dm_snapshot {
 	spinlock_t tracked_chunk_lock;
 	struct hlist_head tracked_chunk_hash[DM_TRACKED_CHUNK_HASH_SIZE];
 
+	/* Merge operation failed if this is set */
+	int merge_failed;
+
 	/* Merge operation is in progress */
 	int merge_running;
 
@@ -775,9 +778,13 @@ static void snapshot_merge_process(struc
 	linear_chunks = s->store->type->prepare_merge(s->store,
 						      &old_chunk, &new_chunk);
 	if (linear_chunks <= 0) {
-		if (linear_chunks < 0)
+		if (linear_chunks < 0) {
 			DMERR("Read error in exception store, "
 			      "shutting down merge");
+			down_write(&s->lock);
+			s->merge_failed = 1;
+			up_write(&s->lock);
+		}
 		goto shut;
 	}
 	/* Adjust old_chunk and new_chunk to reflect start of linear region */
@@ -914,6 +921,7 @@ static void merge_callback(int read_err,
 
 shut:
 	down_write(&s->lock);
+	s->merge_failed = 1;
 	release_write_interlock(s, 1);
 	s->merge_running = 0;
 }
@@ -1002,6 +1010,7 @@ static int snapshot_ctr(struct dm_target
 	init_rwsem(&s->lock);
 	INIT_LIST_HEAD(&s->list);
 	spin_lock_init(&s->pe_lock);
+	s->merge_failed = 0;
 	s->merge_running = 0;
 	s->merge_shutdown = 0;
 	s->merge_write_interlock = 0;
@@ -1741,6 +1750,8 @@ static int snapshot_status(struct dm_tar
 
 		if (!snap->valid)
 			DMEMIT("Invalid");
+		else if (snap->merge_failed)
+			DMEMIT("Merge failed");
 		else {
 			if (snap->store->type->usage) {
 				sector_t total_sectors, sectors_allocated,

      reply	other threads:[~2009-12-05 18:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-04  2:23 [PATCH v5 00/13] snapshot-merge target Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 01/13] dm snapshot: rework writing to snapshot origin Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 02/13] dm exception store: add snapshot-merge specific methods Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 03/13] dm exception store: snapshot-merge usage accounting Mike Snitzer
2009-12-07 21:10   ` Mike Snitzer
2009-12-07 23:44     ` Alasdair G Kergon
2009-12-07 23:53       ` Mike Snitzer
2009-12-08  0:00         ` Alasdair G Kergon
2009-12-08  2:46         ` Mikulas Patocka
2009-12-04  2:23 ` [PATCH v5 04/13] dm snapshot: add snapshot-merge target Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 05/13] dm snapshot: merge target should not allocate new exceptions Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 06/13] dm snapshot: do not allow more than one merging snapshot Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 07/13] dm snapshot: the merge procedure Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 08/13] dm snapshot: queue writes to an area that is actively being merged Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 09/13] dm snapshot: do not merge a chunk until active writes to it finish Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 10/13] dm snapshot: make exceptions in other snapshots when merging Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 11/13] dm snapshot: redirect accesses to origin if merging snap invalidated Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 12/13] dm snapshot: merge a linear region of chunks using one large IO Mike Snitzer
2009-12-04  2:23 ` [PATCH v5 13/13] dm snapshot: report merge failure in status Mike Snitzer
2009-12-05 18:44   ` Mike Snitzer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091205184437.GA21045@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.