Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 45852
b: refs/heads/master
c: 2a2275d
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jan 26, 2007
1 parent 61920db commit b61d2e6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a0ad13ef643a5829d63c456ab6143bbda60b44a9
refs/heads/master: 2a2275d630b982e5f90206f9bc497f6695a3ec5d
29 changes: 29 additions & 0 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -3564,6 +3564,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg)
char *ptr, *buf = NULL;
int err = -ENOMEM;

md_allow_write(mddev);

file = kmalloc(sizeof(*file), GFP_KERNEL);
if (!file)
goto out;
Expand Down Expand Up @@ -5032,6 +5034,33 @@ void md_write_end(mddev_t *mddev)
}
}

/* md_allow_write(mddev)
* Calling this ensures that the array is marked 'active' so that writes
* may proceed without blocking. It is important to call this before
* attempting a GFP_KERNEL allocation while holding the mddev lock.
* Must be called with mddev_lock held.
*/
void md_allow_write(mddev_t *mddev)
{
if (!mddev->pers)
return;
if (mddev->ro)
return;

spin_lock_irq(&mddev->write_lock);
if (mddev->in_sync) {
mddev->in_sync = 0;
set_bit(MD_CHANGE_CLEAN, &mddev->flags);
if (mddev->safemode_delay &&
mddev->safemode == 0)
mddev->safemode = 1;
spin_unlock_irq(&mddev->write_lock);
md_update_sb(mddev, 0);
} else
spin_unlock_irq(&mddev->write_lock);
}
EXPORT_SYMBOL_GPL(md_allow_write);

static DECLARE_WAIT_QUEUE_HEAD(resync_wait);

#define SYNC_MARKS 10
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,8 @@ static int raid1_reshape(mddev_t *mddev)
return -EINVAL;
}

md_allow_write(mddev);

raid_disks = mddev->raid_disks + mddev->delta_disks;

if (raid_disks < conf->raid_disks) {
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ static int resize_stripes(raid5_conf_t *conf, int newsize)
if (newsize <= conf->pool_size)
return 0; /* never bother to shrink */

md_allow_write(conf->mddev);

/* Step 1 */
sc = kmem_cache_create(conf->cache_name[1-conf->active_name],
sizeof(struct stripe_head)+(newsize-1)*sizeof(struct r5dev),
Expand Down Expand Up @@ -3250,6 +3252,7 @@ raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
else
break;
}
md_allow_write(mddev);
while (new > conf->max_nr_stripes) {
if (grow_one_stripe(conf))
conf->max_nr_stripes++;
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/raid/md.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
struct page *page, int rw);
extern void md_do_sync(mddev_t *mddev);
extern void md_new_event(mddev_t *mddev);

extern void md_allow_write(mddev_t *mddev);

#endif /* CONFIG_MD */
#endif
Expand Down

0 comments on commit b61d2e6

Please sign in to comment.