Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 May 2020 14:03:13 +0000 (UTC)
From:      Fedor Uporov <fsu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r361134 - head/sys/fs/ext2fs
Message-ID:  <202005171403.04HE3D1o032873@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fsu
Date: Sun May 17 14:03:13 2020
New Revision: 361134
URL: https://svnweb.freebsd.org/changeset/base/361134

Log:
  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:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c	Sun May 17 14:00:54 2020	(r361133)
+++ head/sys/fs/ext2fs/ext2_vnops.c	Sun May 17 14:03:13 2020	(r361134)
@@ -1018,10 +1018,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?202005171403.04HE3D1o032873>