[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [dm-devel] [PATCH v3 1/2] dm: prevent table type changes after initial table load



On Wed, May 26, 2010 at 11:11 PM, Kiyoshi Ueda <k-ueda ct jp nec com> wrote:
> Hi Mike,
>
> Some small comments below.
>
> For others,
> Acked-by: Kiyoshi Ueda <k-ueda 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]