Re: [PATCH 9/9] device-mapper snapshot: fix invalidation

From: Pavel Machek
Date: Mon Jan 23 2006 - 15:46:50 EST


On Pá 20-01-06 21:34:57, Alasdair G Kergon wrote:
> When a snapshot becomes invalid, s->valid is set to 0.
> In this state, a snapshot can no longer be accessed.
>
> When s->lock is acquired, before doing anything else, s->valid must be
> checked to ensure the snapshot remains valid.
>
> This patch eliminates some races (that may cause panics) by adding
> some missing checks. At the same time, some unnecessary levels of
> indentation are removed and snapshot invalidation is moved into a
> single function that always generates a device-mapper event.
>
> Signed-Off-By: Alasdair G Kergon <agk@xxxxxxxxxx>

> +static void __invalidate_snapshot(struct dm_snapshot *s, struct pending_exception *pe, int err)
> +{
> + if (!s->valid)
> + return;
> +
> + if ((err == -EIO))
> + DMERR("Invalidating snapshot: Error reading/writing.");
> + else if ((err == -ENOMEM))

I see you are trying to make it look distinct from assignment,
but... please don't do this.
Pavel

--
Thanks, Sharp!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/