===================================================================
@@ -741,20 +741,14 @@ static void pending_complete(struct dm_s
struct bio *snapshot_bios = NULL;
int error = 0;
+ down_write(&s->lock);
if (!success) {
/* Read/write error - snapshot is unusable */
- down_write(&s->lock);
__invalidate_snapshot(s, -EIO);
error = 1;
goto out;
}
- down_write(&s->lock);
- if (!s->valid) {
- error = 1;
- goto out;
- }
-
/*
* Check for conflicting reads. This is extremely improbable,
* so msleep(1) is sufficient and there is no need for a wait queue.