[dm-devel] [PATCH v3 1/2] dm: prevent table type changes after initial table load
Mike Snitzer
snitzer at redhat.com
Thu May 27 03:41:11 UTC 2010
On Wed, May 26, 2010 at 11:11 PM, Kiyoshi Ueda <k-ueda at ct.jp.nec.com> wrote:
> Hi Mike,
>
> Some small comments below.
>
> For others,
> Acked-by: Kiyoshi Ueda <k-ueda at ct.jp.nec.com>
>
> On 05/25/2010 11:43 PM +0900, Mike Snitzer wrote:
>> @@ -1176,6 +1176,21 @@ static int table_load(struct dm_ioctl *p
>> goto out;
>> }
>>
>> + /* Protect md->type against concurrent table loads. */
>> + dm_lock_md_type(md);
>> + if (dm_get_md_type(md) == DM_TYPE_NONE) {
>> + /* initial table load, set md's type based on table's type */
>> + dm_set_md_type(md, t);
>
> dm_set_md_type(md, dm_table_get_type(t));
>
> Although I don't impose this interface, I feel it is straightforward
> for this function. Then, dm_set_md_type() just set the type in md->type;
>
> void dm_set_md_type(struct mapped_device *md, unsigned type)
> {
> md->type = type;
> }
Looks good, I'll change it as you suggest.
Thanks,
Mike
More information about the dm-devel
mailing list