NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/57005: excessive namecache purging in ufs_rmdir



>Number:         57005
>Category:       kern
>Synopsis:       excessive namecache purging in ufs_rmdir
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 12 01:15:00 +0000 2022
>Originator:     David A. Holland
>Release:        NetBSD 9.99.96 (20220310)
>Organization:
>Environment:
System: NetBSD valkyrie 9.99.97 NetBSD 9.99.97 (VALKYRIE) #10: Thu Aug 18 04:09:11 EDT 2022  dholland@valkyrie:/usr/src/sys/arch/amd64/compile/VALKYRIE amd64
Architecture: x86_64
Machine: amd64
>Description:

ufs_rmdir calls cache_purge(dvp), where dvp is the directory the
removal is happening in.

cache_purge(dvp) expands to cache_purge1(dvp, NULL, 0,
PURGE_PARENTS|PURGE_CHILDREN) which...

(a) purges *all* namecache entries in the directory, not just the one
for the directory being removed; and, even worse,
(b) purges any entries for dvp in _its_ parent.

From mjg at freebsd.

>How-To-Repeat:

Code inspection.

>Fix:

Call cache_purge1(dvp, cnp->cn_name, cnp->cn_namelen, 0). Unless the
name has been trashed or something at this stage, in which case the
name needs to be copied.

Also merge the change into ulfs_vnops.c and look for additional
cutpaste in other filesystems.

XXX: this call should really be in the caller, not in every
XXX: filesystem, but that's a bigger deal to change.



Home | Main Index | Thread Index | Old Index