[Bug 270632] [ext2fs] files <4096 bytes are corrupted on ext4 filesystems
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Apr 2023 17:39:26 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270632 Mark Millard <marklmi26-fbsd@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marklmi26-fbsd@yahoo.com --- Comment #12 from Mark Millard <marklmi26-fbsd@yahoo.com> --- (In reply to Konstantin Belousov from comment #11) I the context: # uname -apKU FreeBSD generic 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC arm64 aarch64 1301000 1301000 The script I later provide below, it produced: # ./writes_nulls_check.sh Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. Checking integrity... done (0 conflicting) The most recent versions of packages are already installed mke2fs 1.47.0 (5-Feb-2023) Creating filesystem with 131072 4k blocks and 32768 inodes Filesystem UUID: 1fd9b001-e5f5-45d0-89a8-4f4df64a9adc Superblock backups stored on blocks: 32768, 98304 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done 00000000 00 00 00 00 00 00 00 00 00 00 00 00 |............| 0000000c I'll note that it did not produce such on main [so: 14]. # more writes_nulls_check.sh #! /bin/sh pkg install e2fsprogs mdconfig -u0 -s512M mke2fs -t ext4 /dev/md0 mount -t ext2fs /dev/md0 /mnt rm -f writes_nulls_check.c cat <<'EOF' >writes_nulls_check.c // Example compile/link, producing a.out: cc -std=c17 -pedantic -Wall -Wextra writes_nulls_check.c -owrites_nulls_check #include <err.h> // err related #include <fcntl.h> // open related #include <string.h> // strlen #include <unistd.h> // fsync related int main(void) { const char* const fn = "/mnt/writes_nulls_check.txt"; const char* const S = "hello world\n"; const size_t n = strlen(S); int fd = open(fn, O_WRONLY|O_CREAT, 0666); if (fd == -1) err(1, "%s: open failed", fn); if (write(fd, S, n) != n) err(1, "%s: write failed", fn); if (close(fd) == -1) err(1, "%s: close failed", fn); fd = open(fn, O_WRONLY | O_TRUNC | O_DIRECT, 0666); if (fd == -1) err(1, "%s: open failed", fn); if (write(fd, S, n) != n) err(1, "%s: write failed", fn); if (fsync(fd)) err(1, "fsync failed"); if (close(fd) == -1) err(1, "%s: close failed", fn); return 0; } EOF cc -std=c17 -pedantic -Wall -Wextra writes_nulls_check.c -owrites_nulls_check ./writes_nulls_check hd /mnt/writes_nulls_check.txt umount /mnt mdconfig -d -u0 # Leave writes_nulls_check.c and writes_nulls_check in place for reference. -- You are receiving this mail because: You are the assignee for the bug.