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

Re: [dm-devel] [PATCH 2/2] dm-bdev-keep-bdev-always-referenced.patch



On Tue, 12 May 2009, Jun'ichi Nomura wrote:

> Mikulas Patocka wrote:
> > @@ -1280,8 +1284,7 @@ static int __bind(struct mapped_device *
> >  	if (size != get_capacity(md->disk))
> >  		memset(&md->geometry, 0, sizeof(md->geometry));
> >  
> > -	if (md->bdev)
> > -		__set_size(md, size);
> > +	__set_size(md, size);
> >  
> >  	if (!size) {
> >  		dm_table_destroy(t);
> > @@ -1523,11 +1526,6 @@ int dm_swap_table(struct mapped_device *
> >  	if (!dm_suspended(md))
> >  		goto out;
> >  
> > -	/* without bdev, the device size cannot be changed */
> > -	if (!md->bdev)
> > -		if (get_capacity(md->disk) != dm_table_get_size(table))
> > -			goto out;
> > -
> >  	__unbind(md);
> >  	r = __bind(md, table);
> 
> When the device is suspended with noflush,
> can __set_size() wait forever on i_mutex
> if somebody is waiting for I/O flushing with i_mutex held (e.g. fsync)?
> 
> md->bdev was also used as a marker to tell whether the device was
> suspended with noflush.
> Sorry, the original comment in the code was perhaps not adequate.
> 
> Thanks,
> -- 
> Jun'ichi Nomura, NEC Corporation

Hi

Thanks for reviewing it. Your concern is correct. But maybe that 
mutex_lock in __set_size is not needed at all --- because no one can 
change size simultaneously. What do you think?

BTW. I have found another problem --- a few places in dm don't use 
i_size_read and read i_size directly, which is wrong, see the next patch.

Mikulas


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