Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch

This commit is contained in:
Brian Behlendorf 2010-06-28 10:38:43 -07:00
commit 93664227c7
9 changed files with 35 additions and 36 deletions

View File

@ -48,6 +48,8 @@ getexecname(void)
execname[rc] = '\0'; execname[rc] = '\0';
ptr = execname; ptr = execname;
} }
} else {
ptr = execname;
} }
pthread_mutex_unlock(&mtx); pthread_mutex_unlock(&mtx);

View File

@ -146,7 +146,11 @@ extern void vpanic(const char *, __va_list);
* Threads * Threads
*/ */
#define TS_RUN 0x00000002 #define TS_RUN 0x00000002
#ifdef _linux_
#define STACK_SIZE 8192 /* Linux x86 and amd64 */ #define STACK_SIZE 8192 /* Linux x86 and amd64 */
#else
#define STACK_SIZE 24576 /* Solaris */
#endif
/* in libzpool, p0 exists only to have its address taken */ /* in libzpool, p0 exists only to have its address taken */
typedef struct proc { typedef struct proc {

View File

@ -146,14 +146,9 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
size_t len, proc_t *pp, int state, pri_t pri) size_t len, proc_t *pp, int state, pri_t pri)
{ {
kthread_t *kt; kthread_t *kt;
pthread_t tid;
pthread_attr_t attr; pthread_attr_t attr;
size_t stack; size_t stack;
/*
* Due to a race when getting/setting the thread ID, currently only
* detached threads are supported.
*/
ASSERT3S(state & ~TS_RUN, ==, 0); ASSERT3S(state & ~TS_RUN, ==, 0);
kt = umem_zalloc(sizeof(kthread_t), UMEM_NOFAIL); kt = umem_zalloc(sizeof(kthread_t), UMEM_NOFAIL);
@ -161,23 +156,23 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
kt->t_arg = arg; kt->t_arg = arg;
/* /*
* The Solaris kernel stack size in x86/x64 is 8K, so we reduce the * The Solaris kernel stack size is 24k for x86/x86_64.
* default stack size in userspace, for sanity checking. * The Linux kernel stack size is 8k for x86/x86_64.
* *
* PTHREAD_STACK_MIN is the stack required for a NULL procedure in * We reduce the default stack size in userspace, to ensure
* userspace. * we observe stack overruns in user space as well as in
* * kernel space. PTHREAD_STACK_MIN is the minimum stack
* XXX: Stack size for other architectures is not being taken into * required for a NULL procedure in user space and is added
* account. * in to the stack requirements.
*/ */
stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE); stack = PTHREAD_STACK_MIN + MAX(stksize, STACK_SIZE);
VERIFY3S(pthread_attr_init(&attr), ==, 0); VERIFY3S(pthread_attr_init(&attr), ==, 0);
VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0); VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0);
VERIFY3S(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED), VERIFY3S(pthread_attr_setguardsize(&attr, PAGESIZE), ==, 0);
==, 0);
VERIFY3S(pthread_create(&tid, &attr, &zk_thread_helper, kt), ==, 0); VERIFY3S(pthread_create(&kt->t_tid, &attr, &zk_thread_helper, kt),
==, 0);
VERIFY3S(pthread_attr_destroy(&attr), ==, 0); VERIFY3S(pthread_attr_destroy(&attr), ==, 0);

View File

@ -916,7 +916,7 @@ dmu_objset_snapshot(char *fsname, char *snapname,
if (dst->dst_err) if (dst->dst_err)
dsl_dataset_name(ds, sn->failed); dsl_dataset_name(ds, sn->failed);
zil_resume(dmu_objset_zil(os)); zil_resume(dmu_objset_zil(os));
dmu_objset_rele(os, &sn); dmu_objset_rele(os, sn);
} }
if (err) if (err)

View File

@ -96,7 +96,7 @@ spa_config_load(void)
if (kobj_get_filesize(file, &fsize) != 0) if (kobj_get_filesize(file, &fsize) != 0)
goto out; goto out;
buf = kmem_alloc(fsize, KM_SLEEP); buf = kmem_alloc(fsize, KM_SLEEP | KM_NODEBUG);
/* /*
* Read the nvlist from the file. * Read the nvlist from the file.
@ -159,7 +159,7 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl)
*/ */
VERIFY(nvlist_size(nvl, &buflen, NV_ENCODE_XDR) == 0); VERIFY(nvlist_size(nvl, &buflen, NV_ENCODE_XDR) == 0);
buf = kmem_alloc(buflen, KM_SLEEP); buf = kmem_alloc(buflen, KM_SLEEP | KM_NODEBUG);
temp = kmem_zalloc(MAXPATHLEN, KM_SLEEP); temp = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
VERIFY(nvlist_pack(nvl, &buf, &buflen, NV_ENCODE_XDR, VERIFY(nvlist_pack(nvl, &buf, &buflen, NV_ENCODE_XDR,

View File

@ -443,7 +443,7 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
ASSERT(MUTEX_HELD(&spa_namespace_lock)); ASSERT(MUTEX_HELD(&spa_namespace_lock));
spa = kmem_zalloc(sizeof (spa_t), KM_SLEEP); spa = kmem_zalloc(sizeof (spa_t), KM_SLEEP | KM_NODEBUG);
mutex_init(&spa->spa_async_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&spa->spa_async_lock, NULL, MUTEX_DEFAULT, NULL);
mutex_init(&spa->spa_errlist_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&spa->spa_errlist_lock, NULL, MUTEX_DEFAULT, NULL);

View File

@ -1638,8 +1638,11 @@ raidz_checksum_verify(zio_t *zio)
{ {
zio_bad_cksum_t zbc; zio_bad_cksum_t zbc;
raidz_map_t *rm = zio->io_vsd; raidz_map_t *rm = zio->io_vsd;
int ret;
int ret = zio_checksum_error(zio, &zbc); bzero(&zbc, sizeof (zio_bad_cksum_t));
ret = zio_checksum_error(zio, &zbc);
if (ret != 0 && zbc.zbc_injected != 0) if (ret != 0 && zbc.zbc_injected != 0)
rm->rm_ecksuminjected = 1; rm->rm_ecksuminjected = 1;

View File

@ -1052,10 +1052,7 @@ zio_taskq_dispatch(zio_t *zio, enum zio_taskq_type q, boolean_t cutinline)
{ {
spa_t *spa = zio->io_spa; spa_t *spa = zio->io_spa;
zio_type_t t = zio->io_type; zio_type_t t = zio->io_type;
int flags; int flags = TQ_NOSLEEP | (cutinline ? TQ_FRONT : 0);
flags = (cutinline ? TQ_FRONT : 0);
flags |= ((q == ZIO_TASKQ_INTERRUPT) ? TQ_NOSLEEP : TQ_SLEEP);
/* /*
* If we're a config writer or a probe, the normal issue and * If we're a config writer or a probe, the normal issue and

View File

@ -275,8 +275,6 @@ zvol_set_volsize(const char *name, uint64_t volsize)
zvol_state_t *zv; zvol_state_t *zv;
dmu_object_info_t doi; dmu_object_info_t doi;
objset_t *os = NULL; objset_t *os = NULL;
zvol_state_t state = { 0 };
uint64_t old_volsize = 0ULL;
uint64_t readonly; uint64_t readonly;
int error; int error;
@ -284,24 +282,24 @@ zvol_set_volsize(const char *name, uint64_t volsize)
zv = zvol_find_by_name(name); zv = zvol_find_by_name(name);
if (zv == NULL) { if (zv == NULL) {
error = dmu_objset_hold(name, FTAG, &os); error = ENXIO;
if (error) goto out;
goto out;
zv = &state;
} }
error = dmu_objset_hold(name, FTAG, &os);
if (error)
goto out;
if ((error = dmu_object_info(os, ZVOL_OBJ, &doi)) != 0 ||
(error = zvol_check_volsize(volsize,doi.doi_data_block_size)) != 0)
goto out;
VERIFY(dsl_prop_get_integer(name, "readonly", &readonly, NULL) == 0); VERIFY(dsl_prop_get_integer(name, "readonly", &readonly, NULL) == 0);
if (readonly) { if (readonly) {
error = EROFS; error = EROFS;
goto out; goto out;
} }
old_volsize = zv->zv_volsize;
if ((error = dmu_object_info(os, ZVOL_OBJ, &doi)) != 0 ||
(error = zvol_check_volsize(volsize,doi.doi_data_block_size)) != 0)
goto out;
if (get_disk_ro(zv->zv_disk) || (zv->zv_flags & ZVOL_RDONLY)) { if (get_disk_ro(zv->zv_disk) || (zv->zv_flags & ZVOL_RDONLY)) {
error = EROFS; error = EROFS;
goto out; goto out;