-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't count '@' for dataset namelen if not a snapshot
Don't count '@' for dataset namelen if not a snapshot. This fixes making a pool unimportable when the dataset namelen is 255. Add test file for zfs create name length 255. Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #5432 Closes #5456
- Loading branch information
1 parent
c077090
commit a806cb6
Showing
4 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_014_pos.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or http://www.opensolaris.org/os/licensing. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright 2007 Sun Microsystems, Inc. All rights reserved. | ||
# Use is subject to license terms. | ||
# | ||
. $STF_SUITE/include/libtest.shlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# check 'zfs create <filesystem>' works at the name length boundary | ||
# | ||
# STRATEGY: | ||
# 1. Verify creating filesystem with name length 255 would succeed | ||
# 2. Verify creating filesystem with name length 256 would fail | ||
# 3. Verify the pool can be re-imported | ||
|
||
verify_runnable "both" | ||
|
||
# namelen 255 and 256 | ||
TESTFS1=$(for i in $(seq $((254 - ${#TESTPOOL}))); do echo z ; done | tr -d '\n') | ||
TESTFS2=$(for i in $(seq $((255 - ${#TESTPOOL}))); do echo z ; done | tr -d '\n') | ||
|
||
function cleanup | ||
{ | ||
datasetexists $TESTPOOL/$TESTFS1 && | ||
log_must $ZFS destroy $TESTPOOL/$TESTFS1 | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
log_assert "'zfs create <filesystem>' can create a ZFS filesystem with name length 255." | ||
|
||
log_must $ZFS create $TESTPOOL/$TESTFS1 | ||
log_mustnot $ZFS create $TESTPOOL/$TESTFS2 | ||
log_must $ZPOOL export $TESTPOOL | ||
log_must $ZPOOL import $TESTPOOL | ||
|
||
log_pass "'zfs create <filesystem>' works as expected." |