From nobody Sun Apr 09 03:09:14 2023 X-Original-To: fs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PvHBf5H2nz45CTy for ; Sun, 9 Apr 2023 03:09:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PvHBf3zRhz41Gk for ; Sun, 9 Apr 2023 03:09:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681009754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PH3wbpS/3fA8H8Oyoz3wmYESePYarYS9BxtQ+lTfmDA=; b=rih/CIiFwpV8OISCoOGdw/TTuCk1JBYGTVEmoEmgCaqAtGDsYPcDNaRcIaWvC2iFY84e2R HlAgEuObTKuPBVvcJzAojQnn5kup1Jrh/mCvBIr7uqY3gJtIiQG2e0Pz+4qrhWoxzHMKTn 6osBBQQVAemoYWWJGdyqwBlULBp6wyZwpQwZCpVYtwaTxP0C312lVjEE+ATF7AqlhrQdVW hOW3Thaj1sIOG1y3ZoCuxuAv0guPqTHHDTz/lu8J6ySYDBlb7KaEj/q7neMTNJUVQev3rA 0MwasPhJDuRwHMu+H/KqOUvyUGD5F4j4E0JZsh0gwybajUkkpGp6+YJIwFpsnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681009754; a=rsa-sha256; cv=none; b=T/94T43fQehT3AQud2f2ZuFaIbj9jo21ONNbmM4D0o32t6W1UqGqgshPSuykXaxpxm/X1v ZDDAwwBB0nwve3hIolDwquLPkVQIvUCmQ8syO0yh1BCnnuEcKqOY4p7kfIbOCewmb+RNpW wlKJ9lT1EPLQyad3QvNMPPBxkrrr1fdjKl4YS/DNnxvTELJPn+L8sqH0SBpqpvrf49AYxK XrOnU5znfG4TQq45oaoXoGcBiYghQyaVU8GBfmXjN/76nJbgshrdM4qWv+tUlVcW/u+H2i JLPH3+lmIXL+84fttJUoMt4TDcGSY/kuBxodY6nxhGaWzI9EoUPMK7x+cDzpKQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PvHBf34wMzsCx for ; Sun, 9 Apr 2023 03:09:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 33939E8f054212 for ; Sun, 9 Apr 2023 03:09:14 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 33939EBF054211 for fs@FreeBSD.org; Sun, 9 Apr 2023 03:09:14 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: fs@FreeBSD.org Subject: [Bug 270632] [ext2fs] files <4096 bytes are corrupted on ext4 filesystems Date: Sun, 09 Apr 2023 03:09:14 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rajeev_v_pillai@yahoo.com X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: fs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D270632 --- Comment #8 from Rajeev Pillai --- (In reply to Alexey Dokuchaev from comment #7) > Until then, the real bug could be just masked out by other things or e.g.= extra > debugging turned on in -CURRENT by default. > Good point. I've cooked up an even simpler test program to help things alon= g. When the program prompts, you can either flip to another terminal and check the file, or Ctrl-C it and unmount/remount before examining the file. ``` #include #include #include #include #include #include static bool prompt(char* msg) { char line[64] =3D ""; printf("%s", msg); fflush(stdout); fgets(line, sizeof line, stdin); return (line[0] =3D=3D 'Y' || line[0] =3D=3D 'y'); } int main(int argc, char* argv[]) { const char* const S =3D "hello world\n"; char* fn; size_t n; int fd; if (argc !=3D 2) errx(1, "filename required"); fn =3D argv[1]; if ((fd =3D open(fn, O_WRONLY|O_CREAT, 0666)) =3D=3D -1) err(1, "%s: open failed", fn); n =3D strlen(S); if (write(fd, S, n) !=3D n) err(1, "%s: write failed", fn);=20 if (close(fd) =3D=3D -1) err(1, "%s: close failed", fn); prompt("Created file. Enter to continue: "); if ((fd =3D open(fn, O_WRONLY|O_TRUNC, 0666)) =3D=3D -1) err(1, "%s: open failed", fn); prompt("Truncated file. Enter to continue: "); if (write(fd, S, n) !=3D n)=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=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 err(1, "%s: write failed", fn);=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=20=20=20=20=20 if (prompt("Re-wrote file. fsync (y/n)? ")) if (fsync(fd)) err(1, "fsync failed"); if (close(fd) =3D=3D -1)=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=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 err(1, "%s: close failed", fn);=20=20=20=20 prompt("Done. Enter to exit: "); return 0; } ``` Things to note: * The file is initially created and written OK. * The truncation operation succeeds--new file size is 0 after an unmount/remount. * Doing an fsync() doesn't help. * The _second_ write op. fails. The file-size is updated correctly, but, the contents are all NULs. HTH --=20 You are receiving this mail because: You are the assignee for the bug.=