Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jun 2020 13:53:50 +0000 (UTC)
From:      Fedor Uporov <fsu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r362097 - stable/12/sys/fs/ext2fs
Message-ID:  <202006121353.05CDrohh095135@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fsu
Date: Fri Jun 12 13:53:50 2020
New Revision: 362097
URL: https://svnweb.freebsd.org/changeset/base/362097

Log:
  MFC r361134:
  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.

Modified:
  stable/12/sys/fs/ext2fs/ext2_vnops.c

Modified: stable/12/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- stable/12/sys/fs/ext2fs/ext2_vnops.c	Fri Jun 12 13:52:11 2020	(r362096)
+++ stable/12/sys/fs/ext2fs/ext2_vnops.c	Fri Jun 12 13:53:50 2020	(r362097)
@@ -1016,10 +1016,11 @@ abortit:
 		 */
 		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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006121353.05CDrohh095135>