mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-16 06:52:27 +00:00
Do not panic in case of corrupted directory
The panic() will be called under ext2_dirbad() function in case of rw mount. It cause user confusion, like in BZ 265951. PR: 265951 Reviewed by: pfg, mckusick MFC after: 2 week Differential revision: https://reviews.freebsd.org/D38503
This commit is contained in:
parent
366da717de
commit
3c2dc524c3
|
@ -539,8 +539,8 @@ ext2_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp
|
|||
if (entryoffsetinblock + EXT2_DIR_REC_LEN(ep->e2d_namlen) >
|
||||
dp->i_size) {
|
||||
ext2_dirbad(dp, i_offset, "i_size too small");
|
||||
dp->i_size = entryoffsetinblock + EXT2_DIR_REC_LEN(ep->e2d_namlen);
|
||||
dp->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
brelse(bp);
|
||||
return (EIO);
|
||||
}
|
||||
brelse(bp);
|
||||
|
||||
|
@ -802,13 +802,9 @@ ext2_dirbad(struct inode *ip, doff_t offset, char *how)
|
|||
struct mount *mp;
|
||||
|
||||
mp = ITOV(ip)->v_mount;
|
||||
if ((mp->mnt_flag & MNT_RDONLY) == 0)
|
||||
panic("ext2_dirbad: %s: bad dir ino %ju at offset %ld: %s\n",
|
||||
mp->mnt_stat.f_mntonname, (uintmax_t)ip->i_number,
|
||||
(long)offset, how);
|
||||
else
|
||||
SDT_PROBE4(ext2fs, , trace, ext2_dirbad_error,
|
||||
mp->mnt_stat.f_mntonname, ip->i_number, offset, how);
|
||||
|
||||
SDT_PROBE4(ext2fs, , trace, ext2_dirbad_error,
|
||||
mp->mnt_stat.f_mntonname, ip->i_number, offset, how);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1088,6 +1088,15 @@ ext2_rename(struct vop_rename_args *ap)
|
|||
if (namlen != 2 ||
|
||||
dirbuf->dotdot_name[0] != '.' ||
|
||||
dirbuf->dotdot_name[1] != '.') {
|
||||
/*
|
||||
* The filesystem is in corrupted state,
|
||||
* need to run fsck to fix mangled dir
|
||||
* entry. From other side this error
|
||||
* need to be ignored because it is
|
||||
* too difficult to revert directories
|
||||
* to state before rename from this
|
||||
* point.
|
||||
*/
|
||||
ext2_dirbad(xp, (doff_t)12,
|
||||
"rename: mangled dir");
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue