1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# CDDL HEADER START 5# 6# The contents of this file are subject to the terms of the 7# Common Development and Distribution License (the "License"). 8# You may not use this file except in compliance with the License. 9# 10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11# or https://opensource.org/licenses/CDDL-1.0. 12# See the License for the specific language governing permissions 13# and limitations under the License. 14# 15# When distributing Covered Code, include this CDDL HEADER in each 16# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17# If applicable, add the following below this CDDL HEADER, with the 18# fields enclosed by brackets "[]" replaced with your own identifying 19# information: Portions Copyright [yyyy] [name of copyright owner] 20# 21# CDDL HEADER END 22# 23 24# 25# Copyright (c) 2024 by Nutanix. All rights reserved. 26# 27 28. $STF_SUITE/tests/functional/upgrade/upgrade_common.kshlib 29 30# 31# DESCRIPTION: 32# 33# Check DXATTR is intact after sa re-layout by setting projid on old file/dir after upgrade 34# 35# STRATEGY: 36# 1. Create a pool with all features disabled 37# 2. Create a dataset for testing 38# 3. Set DXATTR on file and directory 39# 4. upgrade zpool to support all features 40# 5. set project id on file and directory to trigger sa re-layout for projid 41# 6. verify DXATTR on file and directory are intact 42# 43 44TESTFS=$TESTPOOL/testfs 45TESTFSDIR=$TESTDIR/testfs 46 47verify_runnable "global" 48 49log_assert "Check DXATTR is intact after sa re-layout by setting projid on old file/dir after upgrade" 50log_onexit cleanup_upgrade 51 52log_must zpool create -d -m $TESTDIR $TESTPOOL $TMPDEV 53 54log_must zfs create -o xattr=sa $TESTFS 55log_must mkdir $TESTFSDIR/dir 56log_must touch $TESTFSDIR/file 57log_must set_xattr test test $TESTFSDIR/dir 58log_must set_xattr test test $TESTFSDIR/file 59 60dirino=$(stat -c '%i' $TESTFSDIR/dir) 61fileino=$(stat -c '%i' $TESTFSDIR/file) 62log_must zpool sync $TESTPOOL 63log_must zdb -ddddd $TESTFS $dirino 64log_must zdb -ddddd $TESTFS $fileino 65 66log_mustnot chattr -p 100 $TESTFSDIR/dir 67log_mustnot chattr -p 100 $TESTFSDIR/file 68 69log_must zpool upgrade $TESTPOOL 70 71log_must chattr -p 100 $TESTFSDIR/dir 72log_must chattr -p 100 $TESTFSDIR/file 73log_must zpool sync $TESTPOOL 74log_must zfs umount $TESTFS 75log_must zfs mount $TESTFS 76log_must zdb -ddddd $TESTFS $dirino 77log_must zdb -ddddd $TESTFS $fileino 78log_must get_xattr test $TESTFSDIR/dir 79log_must get_xattr test $TESTFSDIR/file 80 81log_pass "Check DXATTR is intact after sa re-layout by setting projid on old file/dir after upgrade" 82