Skip to content

Commit

Permalink
Borrow a fix from FreeBSD: add boolean spa_splitting_newspa for `zpoo…
Browse files Browse the repository at this point in the history
…l split`
  • Loading branch information
evansus committed Jun 14, 2014
1 parent ed1463a commit 4857136
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/sys/spa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ struct spa {
*/
spa_config_lock_t spa_config_lock[SCL_LOCKS]; /* config changes */
refcount_t spa_refcount; /* number of opens */
#ifndef sun
boolean_t spa_splitting_newspa; /* creating new spa in split */
#endif
};

extern char *spa_config_path;
Expand Down
7 changes: 7 additions & 0 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -5105,8 +5105,15 @@ spa_vdev_split_mirror(spa_t *spa, char *newname, nvlist_t *config,
spa_activate(newspa, spa_mode_global);
spa_async_suspend(newspa);

#ifndef sun
/* mark that we are creating new spa by splitting */
newspa->spa_splitting_newspa = B_TRUE;
#endif
/* create the new pool from the disks of the original pool */
error = spa_load(newspa, SPA_LOAD_IMPORT, SPA_IMPORT_ASSEMBLE, B_TRUE);
#ifndef sun
newspa->spa_splitting_newspa = B_FALSE;
#endif
if (error)
goto out;

Expand Down
2 changes: 1 addition & 1 deletion module/zfs/vdev_iokit.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ vdev_iokit_open(vdev_t *vd, uint64_t *size,

/* When creating or splitting pools, don't validate guid */
if (vd->vdev_spa->spa_load_state != SPA_LOAD_NONE &&
vd->vdev_spa->spa_config_splitting == 0) {
vd->vdev_spa->spa_splitting_newspa != B_TRUE) {
checkguid = vd->vdev_guid;
}

Expand Down

0 comments on commit 4857136

Please sign in to comment.