Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2023 17:39:26 +0000
From:      bugzilla-noreply@freebsd.org
To:        fs@FreeBSD.org
Subject:   [Bug 270632] [ext2fs] files <4096 bytes are corrupted on ext4 filesystems
Message-ID:  <bug-270632-3630-M2VbkRNa7B@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-270632-3630@https.bugs.freebsd.org/bugzilla/>
References:  <bug-270632-3630@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D270632

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:=20
        32768, 98304

Allocating group tables: done=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20
Writing inode tables: done=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
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=20
#! /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=3Dc17 -pedantic -Wall -We=
xtra
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   =3D "/mnt/writes_nulls_check.txt";
        const char* const S    =3D "hello world\n";
        const size_t      n    =3D strlen(S);

        int fd =3D open(fn, O_WRONLY|O_CREAT, 0666);
        if (fd =3D=3D -1)
                err(1, "%s: open failed", fn);
        if (write(fd, S, n) !=3D n)
                err(1, "%s: write failed", fn);
        if (close(fd) =3D=3D -1)
                err(1, "%s: close failed", fn);

        fd =3D open(fn, O_WRONLY | O_TRUNC | O_DIRECT, 0666);
        if (fd =3D=3D -1)
                err(1, "%s: open failed", fn);
        if (write(fd, S, n) !=3D n)
                err(1, "%s: write failed", fn);
        if (fsync(fd))
                err(1, "fsync failed");
        if (close(fd) =3D=3D -1)
                err(1, "%s: close failed", fn);
        return 0;
}
EOF
cc -std=3Dc17 -pedantic -Wall -Wextra writes_nulls_check.c -owrites_nulls_c=
heck
./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.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-270632-3630-M2VbkRNa7B>