FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 08-03-2011, 02:53 PM
Mikulas Patocka
 
Default Fix a race between reading a new block and having it recycled.

Ack.

Mikulas

On Tue, 2 Aug 2011, Joe Thornber wrote:

> ---
> drivers/md/persistent-data/dm-block-manager.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/md/persistent-data/dm-block-manager.c b/drivers/md/persistent-data/dm-block-manager.c
> index c9fb132..b68be88 100644
> --- a/drivers/md/persistent-data/dm-block-manager.c
> +++ b/drivers/md/persistent-data/dm-block-manager.c
> @@ -447,6 +447,7 @@ static int recycle_block(struct dm_block_manager *bm, dm_block_t where,
> * Wait for a block to appear on the empty or clean lists.
> */
> spin_lock_irqsave(&bm->lock, flags);
> +retry:
> while (1) {
> /*
> * Once we can lock and do io concurrently then we should
> @@ -486,7 +487,11 @@ static int recycle_block(struct dm_block_manager *bm, dm_block_t where,
> spin_lock_irqsave(&bm->lock, flags);
> __wait_io(b, &flags);
>
> - /* FIXME: Can b have been recycled between io completion and here? */
> + /*
> + * Has b been recycled whilst we were unlocked?
> + */
> + if (b->where != where)
> + goto retry;
>
> /*
> * Did the io succeed?
> --
> 1.7.4.1
>

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 03:32 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org