Change __find_pending_exception to return error code instead of a null pointer. It will be needed for the next patch that fixes a race condition in __find_pending_exception. Signed-off-by: Mikulas Patocka --- drivers/md/dm-snap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Index: linux-2.6.28-devel/drivers/md/dm-snap.c =================================================================== --- linux-2.6.28-devel.orig/drivers/md/dm-snap.c 2009-02-20 15:54:51.000000000 +0100 +++ linux-2.6.28-devel/drivers/md/dm-snap.c 2009-02-20 15:54:55.000000000 +0100 @@ -978,7 +978,7 @@ __find_pending_exception(struct dm_snaps if (!s->valid) { free_pending_exception(pe); - return NULL; + return ERR_PTR(-ENOMEM); } e = lookup_exception(&s->pending, chunk); @@ -997,7 +997,7 @@ __find_pending_exception(struct dm_snaps if (s->store.prepare_exception(&s->store, &pe->e)) { free_pending_exception(pe); - return NULL; + return ERR_PTR(-ENOMEM); } get_pending_exception(pe); @@ -1055,8 +1055,8 @@ static int snapshot_map(struct dm_target */ if (bio_rw(bio) == WRITE) { pe = __find_pending_exception(s, bio); - if (!pe) { - __invalidate_snapshot(s, -ENOMEM); + if (IS_ERR(pe)) { + __invalidate_snapshot(s, PTR_ERR(pe)); r = -EIO; goto out_unlock; } @@ -1189,8 +1189,8 @@ static int __origin_write(struct list_he goto next_snapshot; pe = __find_pending_exception(snap, bio); - if (!pe) { - __invalidate_snapshot(snap, -ENOMEM); + if (IS_ERR(pe)) { + __invalidate_snapshot(snap, PTR_ERR(pe)); goto next_snapshot; }