From owner-svn-src-head@FreeBSD.ORG Sat May 3 16:11:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2EE4B88B; Sat, 3 May 2014 16:11:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1BF3A1A85; Sat, 3 May 2014 16:11:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s43GBtqP039828; Sat, 3 May 2014 16:11:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s43GBtXV039826; Sat, 3 May 2014 16:11:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201405031611.s43GBtXV039826@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 3 May 2014 16:11:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265275 - head/sys/fs/msdosfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2014 16:11:56 -0000 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);