Merge commit 'refs/top-bases/linux-zpios' into linux-zpios

This commit is contained in:
Brian Behlendorf 2010-06-16 12:45:25 -07:00
commit 0c636b03c0
1 changed files with 8 additions and 5 deletions

View File

@ -303,7 +303,7 @@ int
dsl_dir_open_spa(spa_t *spa, const char *name, void *tag, dsl_dir_open_spa(spa_t *spa, const char *name, void *tag,
dsl_dir_t **ddp, const char **tailp) dsl_dir_t **ddp, const char **tailp)
{ {
char buf[MAXNAMELEN]; char *buf;
const char *next, *nextnext = NULL; const char *next, *nextnext = NULL;
int err; int err;
dsl_dir_t *dd; dsl_dir_t *dd;
@ -313,14 +313,15 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag,
dprintf("%s\n", name); dprintf("%s\n", name);
buf = kmem_alloc(MAXNAMELEN, KM_SLEEP);
err = getcomponent(name, buf, &next); err = getcomponent(name, buf, &next);
if (err) if (err)
return (err); goto error;
if (spa == NULL) { if (spa == NULL) {
err = spa_open(buf, &spa, FTAG); err = spa_open(buf, &spa, FTAG);
if (err) { if (err) {
dprintf("spa_open(%s) failed\n", buf); dprintf("spa_open(%s) failed\n", buf);
return (err); goto error;
} }
openedspa = TRUE; openedspa = TRUE;
@ -336,7 +337,7 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag,
rw_exit(&dp->dp_config_rwlock); rw_exit(&dp->dp_config_rwlock);
if (openedspa) if (openedspa)
spa_close(spa, FTAG); spa_close(spa, FTAG);
return (err); goto error;
} }
while (next != NULL) { while (next != NULL) {
@ -372,7 +373,7 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag,
dsl_dir_close(dd, tag); dsl_dir_close(dd, tag);
if (openedspa) if (openedspa)
spa_close(spa, FTAG); spa_close(spa, FTAG);
return (err); goto error;
} }
/* /*
@ -391,6 +392,8 @@ dsl_dir_open_spa(spa_t *spa, const char *name, void *tag,
if (openedspa) if (openedspa)
spa_close(spa, FTAG); spa_close(spa, FTAG);
*ddp = dd; *ddp = dd;
error:
kmem_free(buf, MAXNAMELEN);
return (err); return (err);
} }