git: ef23df135468 - main - vfs: set NC_KEEPPOSENTRY alongside NOCACHE when creating a file

Mateusz Guzik mjg at FreeBSD.org
Wed Jan 13 15:33:28 UTC 2021


The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=ef23df13546811a49aeebb107dd17298bec8122e

commit ef23df13546811a49aeebb107dd17298bec8122e
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-01-13 14:53:55 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-01-13 15:29:34 +0000

    vfs: set NC_KEEPPOSENTRY alongside NOCACHE when creating a file
    
    Arguably the entire NOCACHE logic should get retired, in the meantime
    at least prevent the code from evicting existing entries.
---
 sys/kern/vfs_vnops.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index de5cd68501a7..6c6727c7f372 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -240,8 +240,11 @@ restart:
 		/*
 		 * Set NOCACHE to avoid flushing the cache when
 		 * rolling in many files at once.
-		*/
-		ndp->ni_cnd.cn_flags |= LOCKPARENT | NOCACHE;
+		 *
+		 * Set NC_KEEPPOSENTRY to keep positive entries if they already
+		 * exist despite NOCACHE.
+		 */
+		ndp->ni_cnd.cn_flags |= LOCKPARENT | NOCACHE | NC_KEEPPOSENTRY;
 		if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0)
 			ndp->ni_cnd.cn_flags |= FOLLOW;
 		if ((vn_open_flags & VN_OPEN_INVFS) == 0)


More information about the dev-commits-src-main mailing list