From owner-freebsd-fs@freebsd.org Sat Jan 23 16:03:23 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33F4DA8D218 for ; Sat, 23 Jan 2016 16:03:23 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0439F1036 for ; Sat, 23 Jan 2016 16:03:22 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u0NG3MP9042493 for ; Sat, 23 Jan 2016 16:03:22 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-fs@FreeBSD.org Subject: [Bug 206530] ext2fs: fsck.ext3 reports "Inode 157938 has INDEX_FL flag set but is not a directory" Date: Sat, 23 Jan 2016 16:03:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: patch X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: damjan.jov@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status keywords bug_severity priority component assigned_to reporter cc attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2016 16:03:23 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206530 Bug ID: 206530 Summary: ext2fs: fsck.ext3 reports "Inode 157938 has INDEX_FL flag set but is not a directory" Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: New Keywords: patch Severity: Affects Some People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: damjan.jov@gmail.com CC: freebsd-fs@FreeBSD.org Created attachment 166011 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D166011&action= =3Dedit Initialize the inode's i_flag to 0 during allocation fsck.ext3 on a cleanly unmounted EXT3 filesystem that went through heavy fi= le creation (OpenOffice build, about 80000 new files) gives a dozen or so of t= hese errors during "Pass 1: Checking inodes, blocks, and sizes": Inode 157938 has INDEX_FL flag set but is not a directory. Clear HTree index? This error is benign to our ext2fs driver, as it requires the inode's mode = to be directory for this flag to have any effect. However it's not benign to o= ther EXT3 implementations - it breaks at least fsck.ext3 itself if the "-n" opti= on to it is used or "no" is answered to that question, since it misinterprets = the inode as a directory, giving further false errors because that pseudo-direc= tory will appear corrupt. Adding this hack: if (!S_ISDIR(ip->i_mode) && (ip->i_flag & IN_E4INDEX) !=3D 0) panic("non-directory has index!?\n"); to ext2_i2ei() to catch wrong use of this flag just before the inode is wri= tten to disk, produces this revealing stack trace: KDB: stack backtrace: db_trace_self_wrapper() vpanic() panic() ext2_i2ei() ext2_update() ext2_makeinode() ext2_create() VOP_CREATE_APV() vn_open_cred() kern_openat() amd64_syscall() Xfast_syscall() Reading through those functions shows ext2_makeinode() calls ext2_valloc() which apparently reuses inodes from disk without initializing their i_flag field, hence if a previously deleted directory's inode is reused for a file, the IN_E4INDEX flag from it will still be set, and wrongly written to the file's inode! I am attaching a patch that initializes i_flag to 0. With it, fsck.ext3 rep= orts a clean scan after the same test. --=20 You are receiving this mail because: You are on the CC list for the bug.=