Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Apr 2023 02:18:42 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 270632] [ext2fs] files <4096 bytes are corrupted on ext4 filesystems
Message-ID:  <bug-270632-227@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 270632
           Summary: [ext2fs] files <4096 bytes are corrupted on ext4
                    filesystems
           Product: Base System
           Version: 13.2-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: rajeev_v_pillai@yahoo.com

Files smaller than 4096 bytes (probably the ext4 block-size?) get corrupted
when
they're written to if the filesystem is ext4. ext2 and ext3 FSes look OK.

$ uname -a
FreeBSD  13.2-RC6 FreeBSD 13.2-RC6 releng/13.2-n254616-a92e3fa2ade5 GENERIC
amd64

# Create an ext4 FS somewhere--here on an USB thumb drive (problem first
noticed
# on an existing ext4 FS on a HDD).

gpart destroy -F da0
gpart create -s GPT da0
gpart add -t linux-data da0
mke2fs -L thumbdrive -t ext4 /dev/da0p1

# Copy/create a file <=3D 4096 bytes on FS (files >4096 bytes are unaffecte=
d).
mount -t ext2fs /dev/da0p1 /mnt
echo 'hello world' >/mnt/a.txt

# Without unmounting and remounting the FS, edit the file, making a trivial
change,
# eg. replacing any char. with the same one.
# The issue does not occur if you unmount and remount the FS first before
editing
# the file.
ed -s /mnt/a.txt <<\EoF
1s/./&/
wq
EoF

# Check file
cat /mnt/a.txt
umount /mnt

# Remount & check file again.
mount -r -t ext2fs /dev/da0p1 /mnt

# File contents are replaced with NULs. File size is unchanged. e2fsck shows
# no problems.
hexdump -C /mnt/a.txt
umount /mnt

--=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-227>