From 32519525108a2ac6bcc64ad931dc8048d33d64de Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Fri, 22 May 2020 13:25:26 +0530 Subject: features/shard: Aggregate file size, block-count before unwinding removexattr Posix translator returns pre and postbufs in the dict in {F}REMOVEXATTR fops. These iatts are further cached at layers like md-cache. Shard translator, in its current state, simply returns these values without updating the aggregated file size and block-count. This patch fixes this problem. Change-Id: I4b2dd41ede472c5829af80a67401ec5a6376d872 Fixes: #1243 Signed-off-by: Krutika Dhananjay --- tests/bugs/shard/issue-1243.t | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/bugs/shard') diff --git a/tests/bugs/shard/issue-1243.t b/tests/bugs/shard/issue-1243.t index b0c092cdb4..ba22d2b74f 100644 --- a/tests/bugs/shard/issue-1243.t +++ b/tests/bugs/shard/issue-1243.t @@ -1,6 +1,7 @@ #!/bin/bash . $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc cleanup; @@ -22,10 +23,21 @@ TEST $CLI volume set $V0 md-cache-timeout 10 # Write data into a file such that its size crosses shard-block-size TEST dd if=/dev/zero of=$M0/foo bs=1048576 count=8 oflag=direct +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + # Execute a setxattr on the file. TEST setfattr -n trusted.libvirt -v some-value $M0/foo # Size of the file should be the aggregated size, not the shard-block-size EXPECT '8388608' stat -c %s $M0/foo +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0 + +# Execute a removexattr on the file. +TEST setfattr -x trusted.libvirt $M0/foo + +# Size of the file should be the aggregated size, not the shard-block-size +EXPECT '8388608' stat -c %s $M0/foo cleanup -- cgit