Merge commit 'refs/top-bases/linux-have-idmap' into linux-have-idmap
This commit is contained in:
commit
00a1ab0d45
|
@ -382,9 +382,10 @@ fatal(int do_perror, char *message, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
char buf[FATAL_MSG_SZ];
|
char *buf;
|
||||||
|
|
||||||
(void) fflush(stdout);
|
(void) fflush(stdout);
|
||||||
|
buf = umem_alloc(FATAL_MSG_SZ, UMEM_NOFAIL);
|
||||||
|
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
(void) sprintf(buf, "ztest: ");
|
(void) sprintf(buf, "ztest: ");
|
||||||
|
@ -649,10 +650,12 @@ ztest_get_ashift(void)
|
||||||
static nvlist_t *
|
static nvlist_t *
|
||||||
make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift)
|
make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift)
|
||||||
{
|
{
|
||||||
char pathbuf[MAXPATHLEN];
|
char *pathbuf;
|
||||||
uint64_t vdev;
|
uint64_t vdev;
|
||||||
nvlist_t *file;
|
nvlist_t *file;
|
||||||
|
|
||||||
|
pathbuf = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
|
|
||||||
if (ashift == 0)
|
if (ashift == 0)
|
||||||
ashift = ztest_get_ashift();
|
ashift = ztest_get_ashift();
|
||||||
|
|
||||||
|
@ -683,6 +686,7 @@ make_vdev_file(char *path, char *aux, size_t size, uint64_t ashift)
|
||||||
VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_TYPE, VDEV_TYPE_FILE) == 0);
|
VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_TYPE, VDEV_TYPE_FILE) == 0);
|
||||||
VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_PATH, path) == 0);
|
VERIFY(nvlist_add_string(file, ZPOOL_CONFIG_PATH, path) == 0);
|
||||||
VERIFY(nvlist_add_uint64(file, ZPOOL_CONFIG_ASHIFT, ashift) == 0);
|
VERIFY(nvlist_add_uint64(file, ZPOOL_CONFIG_ASHIFT, ashift) == 0);
|
||||||
|
umem_free(pathbuf, MAXPATHLEN);
|
||||||
|
|
||||||
return (file);
|
return (file);
|
||||||
}
|
}
|
||||||
|
@ -825,7 +829,7 @@ ztest_dsl_prop_set_uint64(char *osname, zfs_prop_t prop, uint64_t value,
|
||||||
{
|
{
|
||||||
const char *propname = zfs_prop_to_name(prop);
|
const char *propname = zfs_prop_to_name(prop);
|
||||||
const char *valname;
|
const char *valname;
|
||||||
char setpoint[MAXPATHLEN];
|
char *setpoint;
|
||||||
uint64_t curval;
|
uint64_t curval;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
@ -839,6 +843,7 @@ ztest_dsl_prop_set_uint64(char *osname, zfs_prop_t prop, uint64_t value,
|
||||||
}
|
}
|
||||||
ASSERT3U(error, ==, 0);
|
ASSERT3U(error, ==, 0);
|
||||||
|
|
||||||
|
setpoint = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
|
VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval),
|
||||||
1, &curval, setpoint), ==, 0);
|
1, &curval, setpoint), ==, 0);
|
||||||
|
|
||||||
|
@ -847,6 +852,7 @@ ztest_dsl_prop_set_uint64(char *osname, zfs_prop_t prop, uint64_t value,
|
||||||
(void) printf("%s %s = %s at '%s'\n",
|
(void) printf("%s %s = %s at '%s'\n",
|
||||||
osname, propname, valname, setpoint);
|
osname, propname, valname, setpoint);
|
||||||
}
|
}
|
||||||
|
umem_free(setpoint, MAXPATHLEN);
|
||||||
|
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
@ -2228,9 +2234,12 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
|
||||||
vdev_t *rvd = spa->spa_root_vdev;
|
vdev_t *rvd = spa->spa_root_vdev;
|
||||||
spa_aux_vdev_t *sav;
|
spa_aux_vdev_t *sav;
|
||||||
char *aux;
|
char *aux;
|
||||||
|
char *path;
|
||||||
uint64_t guid = 0;
|
uint64_t guid = 0;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
path = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
|
|
||||||
if (ztest_random(2) == 0) {
|
if (ztest_random(2) == 0) {
|
||||||
sav = &spa->spa_spares;
|
sav = &spa->spa_spares;
|
||||||
aux = ZPOOL_CONFIG_SPARES;
|
aux = ZPOOL_CONFIG_SPARES;
|
||||||
|
@ -2254,7 +2263,6 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
|
||||||
*/
|
*/
|
||||||
zs->zs_vdev_aux = 0;
|
zs->zs_vdev_aux = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char path[MAXPATHLEN];
|
|
||||||
int c;
|
int c;
|
||||||
(void) sprintf(path, ztest_aux_template, zopt_dir,
|
(void) sprintf(path, ztest_aux_template, zopt_dir,
|
||||||
zopt_pool, aux, zs->zs_vdev_aux);
|
zopt_pool, aux, zs->zs_vdev_aux);
|
||||||
|
@ -2296,6 +2304,8 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id)
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_exit(&zs->zs_vdev_lock);
|
mutex_exit(&zs->zs_vdev_lock);
|
||||||
|
|
||||||
|
umem_free(path, MAXPATHLEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2412,13 +2422,16 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
|
||||||
uint64_t ashift = ztest_get_ashift();
|
uint64_t ashift = ztest_get_ashift();
|
||||||
uint64_t oldguid, pguid;
|
uint64_t oldguid, pguid;
|
||||||
size_t oldsize, newsize;
|
size_t oldsize, newsize;
|
||||||
char oldpath[MAXPATHLEN], newpath[MAXPATHLEN];
|
char *oldpath, *newpath;
|
||||||
int replacing;
|
int replacing;
|
||||||
int oldvd_has_siblings = B_FALSE;
|
int oldvd_has_siblings = B_FALSE;
|
||||||
int newvd_is_spare = B_FALSE;
|
int newvd_is_spare = B_FALSE;
|
||||||
int oldvd_is_log;
|
int oldvd_is_log;
|
||||||
int error, expected_error;
|
int error, expected_error;
|
||||||
|
|
||||||
|
oldpath = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
|
newpath = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
|
|
||||||
mutex_enter(&zs->zs_vdev_lock);
|
mutex_enter(&zs->zs_vdev_lock);
|
||||||
leaves = MAX(zs->zs_mirrors, 1) * zopt_raidz;
|
leaves = MAX(zs->zs_mirrors, 1) * zopt_raidz;
|
||||||
|
|
||||||
|
@ -2480,8 +2493,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
|
||||||
if (error != 0 && error != ENODEV && error != EBUSY &&
|
if (error != 0 && error != ENODEV && error != EBUSY &&
|
||||||
error != ENOTSUP)
|
error != ENOTSUP)
|
||||||
fatal(0, "detach (%s) returned %d", oldpath, error);
|
fatal(0, "detach (%s) returned %d", oldpath, error);
|
||||||
mutex_exit(&zs->zs_vdev_lock);
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2572,8 +2584,11 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id)
|
||||||
oldpath, (longlong_t)oldsize, newpath,
|
oldpath, (longlong_t)oldsize, newpath,
|
||||||
(longlong_t)newsize, replacing, error, expected_error);
|
(longlong_t)newsize, replacing, error, expected_error);
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
mutex_exit(&zs->zs_vdev_lock);
|
mutex_exit(&zs->zs_vdev_lock);
|
||||||
|
|
||||||
|
umem_free(oldpath, MAXPATHLEN);
|
||||||
|
umem_free(newpath, MAXPATHLEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2919,14 +2934,17 @@ void
|
||||||
ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||||
{
|
{
|
||||||
ztest_shared_t *zs = ztest_shared;
|
ztest_shared_t *zs = ztest_shared;
|
||||||
ztest_ds_t zdtmp;
|
ztest_ds_t *zdtmp;
|
||||||
int iters;
|
int iters;
|
||||||
int error;
|
int error;
|
||||||
objset_t *os, *os2;
|
objset_t *os, *os2;
|
||||||
char name[MAXNAMELEN];
|
char *name;
|
||||||
zilog_t *zilog;
|
zilog_t *zilog;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
zdtmp = umem_alloc(sizeof (ztest_ds_t), UMEM_NOFAIL);
|
||||||
|
name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
|
||||||
(void) rw_enter(&zs->zs_name_lock, RW_READER);
|
(void) rw_enter(&zs->zs_name_lock, RW_READER);
|
||||||
|
|
||||||
(void) snprintf(name, MAXNAMELEN, "%s/temp_%llu",
|
(void) snprintf(name, MAXNAMELEN, "%s/temp_%llu",
|
||||||
|
@ -2939,9 +2957,9 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||||
*/
|
*/
|
||||||
if (ztest_random(2) == 0 &&
|
if (ztest_random(2) == 0 &&
|
||||||
dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os) == 0) {
|
dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os) == 0) {
|
||||||
ztest_zd_init(&zdtmp, os);
|
ztest_zd_init(zdtmp, os);
|
||||||
zil_replay(os, &zdtmp, ztest_replay_vector);
|
zil_replay(os, zdtmp, ztest_replay_vector);
|
||||||
ztest_zd_fini(&zdtmp);
|
ztest_zd_fini(zdtmp);
|
||||||
dmu_objset_disown(os, FTAG);
|
dmu_objset_disown(os, FTAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2965,8 +2983,7 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error == ENOSPC) {
|
if (error == ENOSPC) {
|
||||||
ztest_record_enospc(FTAG);
|
ztest_record_enospc(FTAG);
|
||||||
(void) rw_exit(&zs->zs_name_lock);
|
goto out;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
fatal(0, "dmu_objset_create(%s) = %d", name, error);
|
fatal(0, "dmu_objset_create(%s) = %d", name, error);
|
||||||
}
|
}
|
||||||
|
@ -2974,7 +2991,7 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||||
VERIFY3U(0, ==,
|
VERIFY3U(0, ==,
|
||||||
dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
|
dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os));
|
||||||
|
|
||||||
ztest_zd_init(&zdtmp, os);
|
ztest_zd_init(zdtmp, os);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the intent log for it.
|
* Open the intent log for it.
|
||||||
|
@ -2987,7 +3004,7 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||||
*/
|
*/
|
||||||
iters = ztest_random(5);
|
iters = ztest_random(5);
|
||||||
for (i = 0; i < iters; i++) {
|
for (i = 0; i < iters; i++) {
|
||||||
ztest_dmu_object_alloc_free(&zdtmp, id);
|
ztest_dmu_object_alloc_free(zdtmp, id);
|
||||||
if (ztest_random(iters) == 0)
|
if (ztest_random(iters) == 0)
|
||||||
(void) ztest_snapshot_create(name, i);
|
(void) ztest_snapshot_create(name, i);
|
||||||
}
|
}
|
||||||
|
@ -3012,9 +3029,12 @@ ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||||
|
|
||||||
zil_close(zilog);
|
zil_close(zilog);
|
||||||
dmu_objset_disown(os, FTAG);
|
dmu_objset_disown(os, FTAG);
|
||||||
ztest_zd_fini(&zdtmp);
|
ztest_zd_fini(zdtmp);
|
||||||
|
out:
|
||||||
(void) rw_exit(&zs->zs_name_lock);
|
(void) rw_exit(&zs->zs_name_lock);
|
||||||
|
|
||||||
|
umem_free(name, MAXNAMELEN);
|
||||||
|
umem_free(zdtmp, sizeof (ztest_ds_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3037,13 +3057,19 @@ ztest_dmu_snapshot_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||||
void
|
void
|
||||||
ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
|
ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
|
||||||
{
|
{
|
||||||
char snap1name[MAXNAMELEN];
|
char *snap1name;
|
||||||
char clone1name[MAXNAMELEN];
|
char *clone1name;
|
||||||
char snap2name[MAXNAMELEN];
|
char *snap2name;
|
||||||
char clone2name[MAXNAMELEN];
|
char *clone2name;
|
||||||
char snap3name[MAXNAMELEN];
|
char *snap3name;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
snap1name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
clone1name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
snap2name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
clone2name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
snap3name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
|
||||||
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu",
|
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu",
|
||||||
osname, (u_longlong_t)id);
|
osname, (u_longlong_t)id);
|
||||||
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu",
|
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu",
|
||||||
|
@ -3070,6 +3096,12 @@ ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
|
||||||
error = dmu_objset_destroy(snap1name, B_FALSE);
|
error = dmu_objset_destroy(snap1name, B_FALSE);
|
||||||
if (error && error != ENOENT)
|
if (error && error != ENOENT)
|
||||||
fatal(0, "dmu_objset_destroy(%s) = %d", snap1name, error);
|
fatal(0, "dmu_objset_destroy(%s) = %d", snap1name, error);
|
||||||
|
|
||||||
|
umem_free(snap1name, MAXNAMELEN);
|
||||||
|
umem_free(clone1name, MAXNAMELEN);
|
||||||
|
umem_free(snap2name, MAXNAMELEN);
|
||||||
|
umem_free(clone2name, MAXNAMELEN);
|
||||||
|
umem_free(snap3name, MAXNAMELEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3081,14 +3113,20 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
|
||||||
ztest_shared_t *zs = ztest_shared;
|
ztest_shared_t *zs = ztest_shared;
|
||||||
objset_t *clone;
|
objset_t *clone;
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds;
|
||||||
char snap1name[MAXNAMELEN];
|
char *snap1name;
|
||||||
char clone1name[MAXNAMELEN];
|
char *clone1name;
|
||||||
char snap2name[MAXNAMELEN];
|
char *snap2name;
|
||||||
char clone2name[MAXNAMELEN];
|
char *clone2name;
|
||||||
char snap3name[MAXNAMELEN];
|
char *snap3name;
|
||||||
char *osname = zd->zd_name;
|
char *osname = zd->zd_name;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
snap1name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
clone1name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
snap2name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
clone2name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
snap3name = umem_alloc(MAXNAMELEN, UMEM_NOFAIL);
|
||||||
|
|
||||||
(void) rw_enter(&zs->zs_name_lock, RW_READER);
|
(void) rw_enter(&zs->zs_name_lock, RW_READER);
|
||||||
|
|
||||||
ztest_dsl_dataset_cleanup(osname, id);
|
ztest_dsl_dataset_cleanup(osname, id);
|
||||||
|
@ -3175,31 +3213,46 @@ out:
|
||||||
ztest_dsl_dataset_cleanup(osname, id);
|
ztest_dsl_dataset_cleanup(osname, id);
|
||||||
|
|
||||||
(void) rw_exit(&zs->zs_name_lock);
|
(void) rw_exit(&zs->zs_name_lock);
|
||||||
|
|
||||||
|
umem_free(snap1name, MAXNAMELEN);
|
||||||
|
umem_free(clone1name, MAXNAMELEN);
|
||||||
|
umem_free(snap2name, MAXNAMELEN);
|
||||||
|
umem_free(clone2name, MAXNAMELEN);
|
||||||
|
umem_free(snap3name, MAXNAMELEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define OD_ARRAY_SIZE 4
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify that dmu_object_{alloc,free} work as expected.
|
* Verify that dmu_object_{alloc,free} work as expected.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
|
ztest_dmu_object_alloc_free(ztest_ds_t *zd, uint64_t id)
|
||||||
{
|
{
|
||||||
ztest_od_t od[4];
|
ztest_od_t *od;
|
||||||
int batchsize = sizeof (od) / sizeof (od[0]);
|
int batchsize;
|
||||||
|
int size;
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
|
size = sizeof(ztest_od_t) * OD_ARRAY_SIZE;
|
||||||
|
od = umem_alloc(size, UMEM_NOFAIL);
|
||||||
|
batchsize = OD_ARRAY_SIZE;
|
||||||
|
|
||||||
for (b = 0; b < batchsize; b++)
|
for (b = 0; b < batchsize; b++)
|
||||||
ztest_od_init(&od[b], id, FTAG, b, DMU_OT_UINT64_OTHER, 0, 0);
|
ztest_od_init(od + b, id, FTAG, b, DMU_OT_UINT64_OTHER, 0, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destroy the previous batch of objects, create a new batch,
|
* Destroy the previous batch of objects, create a new batch,
|
||||||
* and do some I/O on the new objects.
|
* and do some I/O on the new objects.
|
||||||
*/
|
*/
|
||||||
if (ztest_object_init(zd, od, sizeof (od), B_TRUE) != 0)
|
if (ztest_object_init(zd, od, size, B_TRUE) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (ztest_random(4 * batchsize) != 0)
|
while (ztest_random(4 * batchsize) != 0)
|
||||||
ztest_io(zd, od[ztest_random(batchsize)].od_object,
|
ztest_io(zd, od[ztest_random(batchsize)].od_object,
|
||||||
ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT);
|
ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT);
|
||||||
|
|
||||||
|
umem_free(od, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4424,8 +4477,8 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||||
uint64_t leaves;
|
uint64_t leaves;
|
||||||
uint64_t bad = 0x1990c0ffeedecadeull;
|
uint64_t bad = 0x1990c0ffeedecadeull;
|
||||||
uint64_t top, leaf;
|
uint64_t top, leaf;
|
||||||
char path0[MAXPATHLEN];
|
char *path0;
|
||||||
char pathrand[MAXPATHLEN];
|
char *pathrand;
|
||||||
size_t fsize;
|
size_t fsize;
|
||||||
int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
|
int bshift = SPA_MAXBLOCKSHIFT + 2; /* don't scrog all labels */
|
||||||
int iters = 1000;
|
int iters = 1000;
|
||||||
|
@ -4435,6 +4488,9 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||||
uint64_t guid0 = 0;
|
uint64_t guid0 = 0;
|
||||||
boolean_t islog = B_FALSE;
|
boolean_t islog = B_FALSE;
|
||||||
|
|
||||||
|
path0 = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
|
pathrand = umem_alloc(MAXPATHLEN, UMEM_NOFAIL);
|
||||||
|
|
||||||
mutex_enter(&zs->zs_vdev_lock);
|
mutex_enter(&zs->zs_vdev_lock);
|
||||||
maxfaults = MAXFAULTS();
|
maxfaults = MAXFAULTS();
|
||||||
leaves = MAX(zs->zs_mirrors, 1) * zopt_raidz;
|
leaves = MAX(zs->zs_mirrors, 1) * zopt_raidz;
|
||||||
|
@ -4501,7 +4557,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||||
|
|
||||||
if (sav->sav_count == 0) {
|
if (sav->sav_count == 0) {
|
||||||
spa_config_exit(spa, SCL_STATE, FTAG);
|
spa_config_exit(spa, SCL_STATE, FTAG);
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
vd0 = sav->sav_vdevs[ztest_random(sav->sav_count)];
|
vd0 = sav->sav_vdevs[ztest_random(sav->sav_count)];
|
||||||
guid0 = vd0->vdev_guid;
|
guid0 = vd0->vdev_guid;
|
||||||
|
@ -4546,7 +4602,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxfaults == 0)
|
if (maxfaults == 0)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We have at least single-fault tolerance, so inject data corruption.
|
* We have at least single-fault tolerance, so inject data corruption.
|
||||||
|
@ -4554,7 +4610,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||||
fd = open(pathrand, O_RDWR);
|
fd = open(pathrand, O_RDWR);
|
||||||
|
|
||||||
if (fd == -1) /* we hit a gap in the device namespace */
|
if (fd == -1) /* we hit a gap in the device namespace */
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
fsize = lseek(fd, 0, SEEK_END);
|
fsize = lseek(fd, 0, SEEK_END);
|
||||||
|
|
||||||
|
@ -4570,7 +4626,7 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||||
if (mirror_save != zs->zs_mirrors) {
|
if (mirror_save != zs->zs_mirrors) {
|
||||||
mutex_exit(&zs->zs_vdev_lock);
|
mutex_exit(&zs->zs_vdev_lock);
|
||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pwrite(fd, &bad, sizeof (bad), offset) != sizeof (bad))
|
if (pwrite(fd, &bad, sizeof (bad), offset) != sizeof (bad))
|
||||||
|
@ -4585,6 +4641,9 @@ ztest_fault_inject(ztest_ds_t *zd, uint64_t id)
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
|
out:
|
||||||
|
umem_free(path0, MAXPATHLEN);
|
||||||
|
umem_free(pathrand, MAXPATHLEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue