Skip to content

Commit

Permalink
Fix parse_dataset error handling
Browse files Browse the repository at this point in the history
A mount failure was accidentally introduced by commit 0c1171d
which reworked the parse_dataset() function to read pool names
from devices.  The error case where a label is read from the
device but the pool name/value pair doesn't exist was not
handled properly.  In this case we should fall back to the
previous behavior.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1560
  • Loading branch information
behlendorf authored and unya committed Dec 13, 2013
1 parent 7650d39 commit 4f2c512
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/mount_zfs/mount_zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,13 @@ parse_dataset(char *dataset)

error = nvlist_lookup_string(config,
ZPOOL_CONFIG_POOL_NAME, &name);
if (error == 0)
if (error) {
nvlist_free(config);
} else {
dataset = strdup(name);

nvlist_free(config);
return (dataset);
nvlist_free(config);
return (dataset);
}
}
out:
/*
Expand Down

0 comments on commit 4f2c512

Please sign in to comment.