Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1509245

Summary: fuser can hang on nonexistent file
Product: Red Hat Enterprise Linux 7 Reporter: Karel Volný <kvolny>
Component: psmiscAssignee: Jan Rybar <jrybar>
Status: CLOSED ERRATA QA Contact: Karel Volný <kvolny>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.5CC: extras-qa, fedora, hhorak, jaromir.capik, jrybar, jwright
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: psmisc-22.20-16.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1509243
: 1693785 (view as bug list) Environment:
Last Closed: 2019-08-06 13:07:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1509243    
Bug Blocks: 1630908, 1693785    
Attachments:
Description Flags
Proposed patch none

Description Karel Volný 2017-11-03 12:07:44 UTC
originally observed with psmisc-22.20-15.el7.s390x

+++ This bug was initially created as a clone of Bug #1509243 +++

Description of problem:
I have found a problem during mariadb startup, which turned out to be caused by a `fuser` call that timed out due to broken NFS.

While that's a string of unfortunate conditions, making `fuser` behave differently would be IMHO a good thing.

The problem is when a file doesn't exist, instead of bailing out immediately, fuser tries to stat tons of other things, and stating a stale NFS mount leads to hanging on it.

fuser shouldn't do this - I don't know what sense does it make during normal operation (if the file exists), it still would be nice if it could be skipped and so fuser doesn't get blocked by NFS.

But I'm pretty sure it doesn't make any sense when the file doesn't exist ... why to wait for "Specified filename ... does not exist." message until the system is scanned while it can be spit out immediately?

Version-Release number of selected component (if applicable):
psmisc-23.1-2.fc27.x86_64

How reproducible:
always

Steps to Reproduce:
0. have some nfs mounts
[supposing 'kravina' doesn't exist]
1. strace fuser kravina 2>&1 | grep your/mount

Actual results:
stat("your/mount", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

Expected results:
empty output, grep doesn't match your/mount


Additional info:

Comment 2 Jan Rybar 2018-08-31 12:31:59 UTC
Hello Karel,

so if I understand it correctly, the problem is not that fuser hangs, but it is slowed down by {non,slow-}responding mounts on the system, which is unnecessary from your point of view and it should first verify the existence of a file, right?

Comment 3 Karel Volný 2019-01-25 17:02:38 UTC
(In reply to Jan Rybar from comment #2)
> Hello Karel,
> 
> so if I understand it correctly, the problem is not that fuser hangs, but it
> is slowed down by {non,slow-}responding mounts on the system, which is
> unnecessary from your point of view and it should first verify the existence
> of a file, right?

Hi, I'm not sure if I recall correctly but I believe what we observed was that it hanged indefinitely when NFS was unresponsive

I don't know how does it work internally, but I'd think that it shouldn't try to touch the mountpoint at all, no matter if the file exists or not ... and if that is unavoidable, then yes, it should try that only after checking that the file exists

Comment 4 Jan Rybar 2019-02-19 16:07:01 UTC
Created attachment 1536393 [details]
Proposed patch

Due to missing NULLptr sanity checks in scanning functions, fuser runs excessive number of stats on entire /proc several times with no potential of finding anything.
There is a case that this activity causes NFS to stall and get stuck even when finding for a non-existing file.

Patch sent upstream.

Comment 5 Jan Rybar 2019-03-18 16:35:03 UTC
Fixed in version
psmisc-22.20-16.el7

Commit available at
http://pkgs.devel.redhat.com/cgit/rpms/psmisc/commit/?h=rhel-7.7&id=f70958b012a32f683efaec32e19

Comment 9 errata-xmlrpc 2019-08-06 13:07:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2225