svn commit: r352678 - in stable: 11/sys/fs/msdosfs 12/sys/fs/msdosfs
Kyle Evans
kevans at FreeBSD.org
Wed Sep 25 12:58:50 UTC 2019
Author: kevans
Date: Wed Sep 25 12:58:49 2019
New Revision: 352678
URL: https://svnweb.freebsd.org/changeset/base/352678
Log:
MFC r352564: msdosfs: do not deget unlinked denodes
When a file is unlinked, the denode is not reclaimed until the last
reference is dropped, but the directory entry is immediately up for reuse.
This is a problem later when createde goes to grab a denode for the newly
created entry -- we search the hash and find a dead denode, then return that
without even bumping the reference count and the data later gets truncated
when the the last reference to the unlinked file is dropped.
This manifested itself as a broken in-place strip(1) on msdosfs.
The comment indicating that we want to skip these denodes has been updated
to reflect where this is actually done.
Modified:
stable/11/sys/fs/msdosfs/msdosfs_denode.c
Directory Properties:
stable/11/ (props changed)
Changes in other areas also in this revision:
Modified:
stable/12/sys/fs/msdosfs/msdosfs_denode.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/11/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- stable/11/sys/fs/msdosfs/msdosfs_denode.c Wed Sep 25 11:58:54 2019 (r352677)
+++ stable/11/sys/fs/msdosfs/msdosfs_denode.c Wed Sep 25 12:58:49 2019 (r352678)
@@ -77,7 +77,7 @@ de_vncmpf(struct vnode *vp, void *arg)
a = arg;
de = VTODE(vp);
- return (de->de_inode != *a);
+ return (de->de_inode != *a) || (de->de_refcnt <= 0);
}
/*
@@ -122,8 +122,9 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon
* address of "." entry. For root dir (if not FAT32) use cluster
* MSDOSFSROOT, offset MSDOSFSROOT_OFS
*
- * NOTE: The check for de_refcnt > 0 below insures the denode being
- * examined does not represent an unlinked but still open file.
+ * NOTE: de_vncmpf will explicitly skip any denodes that do not have
+ * a de_refcnt > 0. This insures that that we do not attempt to use
+ * a denode that represents an unlinked but still open file.
* These files are not to be accessible even when the directory
* entry that represented the file happens to be reused while the
* deleted file is still open.
More information about the svn-src-all
mailing list