mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix projid accounting for xattr objects
zpool upgraded with 'feature@project_quota' needs re-layout of SA's to fix the SA_ZPL_PROJID at SA_PROJID_OFFSET (128). Its necessary for the correct accounting of object usage against its projid. Old object (created before upgrade) when gets a projid assigned, its SA gets re-layout via sa_add_projid(). If object has xattr dir, SA of xattr dir also gets re-layout. But SA re-layout of xattr objects inside a xattr dir is not done. Fix zfs_setattr_dir() to re-layout SA's on xattr objects, when setting projid on old xattr object (created before upgrade). Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Jitendra Patidar <jitendra.patidar@nutanix.com> Closes #16355 Closes #16356
This commit is contained in:
@@ -63,6 +63,7 @@ log_must mkfiles $TESTDIR/fs2/tf $((RANDOM % 100 + 1))
|
||||
log_must zfs create $TESTPOOL/fs3
|
||||
log_must mkdir $TESTDIR/fs3/dir
|
||||
log_must mkfiles $TESTDIR/fs3/tf $((RANDOM % 100 + 1))
|
||||
log_must set_xattr_stdin passwd $TESTDIR/fs3/dir < /etc/passwd
|
||||
|
||||
# Make sure project quota is disabled
|
||||
zfs projectspace -o used $TESTPOOL | grep -q "USED" &&
|
||||
@@ -109,9 +110,23 @@ log_must chattr -p 100 $TESTDIR/fs3/dir
|
||||
log_must sleep 5 # upgrade done in the background so let's wait for a while
|
||||
zfs projectspace -o used $TESTPOOL/fs3 | grep -q "USED" ||
|
||||
log_fail "project quota should be enabled for $TESTPOOL/fs3"
|
||||
dirino=$(stat -c '%i' $TESTDIR/fs3/dir)
|
||||
log_must zdb -ddddd $TESTPOOL/fs3 $dirino
|
||||
xattrdirino=$(zdb -ddddd $TESTPOOL/fs3 $dirino |grep -w "xattr" |awk '{print $2}')
|
||||
echo "xattrdirino: $xattrdirino"
|
||||
expectedcnt=1
|
||||
echo "expectedcnt: $expectedcnt"
|
||||
if [ "$xattrdirino" != "" ]; then
|
||||
expectedcnt=$(($expectedcnt + 1))
|
||||
echo "expectedcnt: $expectedcnt"
|
||||
log_must zdb -ddddd $TESTPOOL/fs3 $xattrdirino
|
||||
xattrinocnt=$(zdb -ddddd $TESTPOOL/fs3 $xattrdirino |grep -w "(type:" |wc -l)
|
||||
echo "xattrinocnt: $xattrinocnt"
|
||||
expectedcnt=$(($expectedcnt + $xattrinocnt))
|
||||
echo "expectedcnt: $expectedcnt"
|
||||
fi
|
||||
cnt=$(get_prop projectobjused@100 $TESTPOOL/fs3)
|
||||
# if 'xattr=on', then 'cnt = 2'
|
||||
[[ $cnt -ne 1 ]] && [[ $cnt -ne 2 ]] &&
|
||||
[[ $cnt -ne $expectedcnt ]] &&
|
||||
log_fail "projectquota accounting failed $cnt"
|
||||
|
||||
# All in all, after having been through this, the dataset for testpool
|
||||
|
||||
Reference in New Issue
Block a user