Fix incorrect inode link count check in case of rename.
The check was incorrect because the directory inode link count have min value 2 after dir_nlink extfs feature introduction.
This commit is contained in:
parent
ec81c9cc06
commit
86e2d48bf9
@ -1018,10 +1018,11 @@ ext2_rename(struct vop_rename_args *ap)
|
||||
*/
|
||||
ext2_dec_nlink(xp);
|
||||
if (doingdirectory) {
|
||||
if (--xp->i_nlink != 0)
|
||||
if (xp->i_nlink > 2)
|
||||
panic("ext2_rename: linked directory");
|
||||
error = ext2_truncate(tvp, (off_t)0, IO_SYNC,
|
||||
tcnp->cn_cred, tcnp->cn_thread);
|
||||
xp->i_nlink = 0;
|
||||
}
|
||||
xp->i_flag |= IN_CHANGE;
|
||||
vput(tvp);
|
||||
|
Loading…
Reference in New Issue
Block a user