aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/cmd
diff options
context:
space:
mode:
authorAntonio Russo <[email protected]>2023-01-06 11:52:08 -0700
committerGitHub <[email protected]>2023-01-06 10:52:08 -0800
commita7304ab9c1ea62c556aa7d007821322afc75ff79 (patch)
treedaa30b65bb00ae4ce9a40764478322c19e56d036 /tests/zfs-tests/cmd
parentee6bf97c7727c118f7bbb8be4bb0eedcaca2ad35 (diff)
ZTS: close in mmapwrite.c
mmapwrite is used during the ZTS to identify issues with mmap-ed files. This helper program exercises this pathway by continuously writing to a file. ee6bf97c7 modified the writing threads to terminate after a set amount of total data is written. This change allows standard program execution to reach the end of a writer thread without closing the file descriptor, introducing a resource "leak." This patch appeases resource leak analyses by close()-ing the file at the end of the thread. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Antonio Russo <[email protected]> Closes #14353
Diffstat (limited to 'tests/zfs-tests/cmd')
-rw-r--r--tests/zfs-tests/cmd/mmapwrite.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/zfs-tests/cmd/mmapwrite.c b/tests/zfs-tests/cmd/mmapwrite.c
index 0a57daff5..20a50085a 100644
--- a/tests/zfs-tests/cmd/mmapwrite.c
+++ b/tests/zfs-tests/cmd/mmapwrite.c
@@ -82,6 +82,10 @@ normal_writer(void *filename)
break;
}
}
+
+ if (close(fd) != 0)
+ err(1, "failed to close file");
+
return (NULL);
}