Date: Tue, 6 Apr 2021 20:21:32 +0800 From: Raymond Yuan <number201724@me.com> To: freebsd-fs@freebsd.org Subject: Why does ufs choose panic instead of EIO when processing illegal directory data? Message-ID: <D693D307-D159-4324-97D5-1DF926A98E0A@me.com>
next in thread | raw e-mail | index | archive | help
Why does ufs choose panic instead of EIO when processing illegal = directory data? I have a virtual machine. When my database directory is damaged, every = time I start the system, once I start the mysql system, it will panic = and keep panic. Many times when this kind of problem occurs, it is caused by accidental = power failure or panic. The problem is that the file system has been damaged, but after panic, = the last panic crash information will be written to the file system = every time it is started. Is this a bit too dangerous? void ufs_dirbad(ip, offset, how) struct inode *ip; doff_t offset; char *how; { struct mount *mp; mp =3D ITOV(ip)->v_mount; if ((mp->mnt_flag & MNT_RDONLY) =3D=3D 0) panic("ufs_dirbad: %s: bad dir ino %ju at offset %ld: = %s", mp->mnt_stat.f_mntonname, (uintmax_t)ip->i_number, (long)offset, how); else (void)printf("%s: bad dir ino %ju at offset %ld: %s\n", mp->mnt_stat.f_mntonname, (uintmax_t)ip->i_number, (long)offset, how); } ep =3D (struct direct *)((char *)bp->b_data + = entryoffsetinblock); if (ep->d_reclen =3D=3D 0 || ep->d_reclen > DIRBLKSIZ - (entryoffsetinblock & (DIRBLKSIZ - 1)) = || (dirchk && ufs_dirbadentry(vdp, ep, = entryoffsetinblock))) { int i; ufs_dirbad(dp, i_offset, "mangled entry"); i =3D DIRBLKSIZ - (entryoffsetinblock & = (DIRBLKSIZ - 1)); i_offset +=3D i; entryoffsetinblock +=3D i; continue; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D693D307-D159-4324-97D5-1DF926A98E0A>