Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 May 2014 16:11:55 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265275 - head/sys/fs/msdosfs
Message-ID:  <201405031611.s43GBtXV039826@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat May  3 16:11:55 2014
New Revision: 265275
URL: http://svnweb.freebsd.org/changeset/base/265275

Log:
  After r254627, the deupdate() started writing the directory entries to
  disk.  That has a side effect of corrupting the "." entries names on
  rename, since the call to createde() in the msdosfs_rename() sets the
  de_Name to the target name.  If any change to the directory attributes
  is performed, the wrong name is written back to the on-disk direntry
  on update.
  
  Overwrite the de_Name for the directories on rename to correct the dot
  name.
  
  Submitted by:	bde
  MFC after:	1 week

Modified:
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_vnops.c	Sat May  3 16:09:08 2014	(r265274)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c	Sat May  3 16:11:55 2014	(r265275)
@@ -1240,6 +1240,17 @@ abortit:
 			VOP_UNLOCK(fvp, 0);
 			goto bad;
 		}
+		/*
+		 * If ip is for a directory, then its name should always
+		 * be "." since it is for the directory entry in the
+		 * directory itself (msdosfs_lookup() always translates
+		 * to the "." entry so as to get a unique denode, except
+		 * for the root directory there are different
+		 * complications).  However, we just corrupted its name
+		 * to pass the correct name to createde().  Undo this.
+		 */
+		if ((ip->de_Attributes & ATTR_DIRECTORY) != 0)
+			bcopy(oldname, ip->de_Name, 11);
 		ip->de_refcnt++;
 		zp->de_fndoffset = from_diroffset;
 		error = removede(zp, ip);



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