Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 May 2022 09:22:07 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 232702] fuser does not list id of processes that have a file
Message-ID:  <bug-232702-227-aW4zn0Fb44@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-232702-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-232702-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D232702

--- Comment #2 from Ali Abdallah <ali.abdallah@suse.com> ---
Created attachment 234203
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D234203&action=
=3Dedit
Fix looping over active processes

I haven't tested fuser since long time. I'm running 13.1 now on multiple
machines, fuser sometimes gets active processes opening a specific file, and
sometimes not!=20

It seemed random for me, but after having a closer look at the code, I think
the following loop is wrong:

while(cnt--)
    if (p->ki_stat !=3D SZOMB)
        dofiles(procstat, p++, reqfiles, nfiles);

The above might skip active process entries, and IMHO it should be as follo=
ws

while(cnt--) {
    if (p->ki_stat !=3D SZOMB) {
        dofiles(procstat, p, reqfiles, nfiles);
    }
    p++;
}

Attached a tiny patch that fixes the issue for me.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-232702-227-aW4zn0Fb44>