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 2149394 - umount outputs inaccurate error message when umount() fails with EACCES
Summary: umount outputs inaccurate error message when umount() fails with EACCES
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: util-linux
Version: 8.6
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Karel Zak
QA Contact: Radka Brychtova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-29 19:37 UTC by Frank Sorenson
Modified: 2023-05-16 11:22 UTC (History)
1 user (show)

Fixed In Version: util-linux-2.32.1-40.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-16 09:12:29 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-140821 0 None None None 2022-11-29 19:51:10 UTC
Red Hat Product Errata RHBA-2023:3054 0 None None None 2023-05-16 09:12:40 UTC

Description Frank Sorenson 2022-11-29 19:37:04 UTC
Description of problem:

When umount() fails with EACCES, libmount returns the error string "block devices are not permitted on filesystem", regardless of the reason for the EACCES (i.e. the filesystem to be unmounted may have nothing to do with block devices).

This is misleading in cases where umount() returns EACCES for a different reason.

In this particular case, unmounting an nfs mount which is no longer exported to the client system may return a permission error from the server, resulting in umount() returning EACCES.



Version-Release number of selected component (if applicable):

util-linux-2.32.1-39.el8_7
(really, all versions of util-linux, including upstream)


How reproducible:

with certain nfs servers, easy
RHEL nfs server does not return the error which leads to the EACCES


Steps to Reproduce:

using a particular nfs server (customer reported the issue with a NetApp nfs server; RHEL will not reproduce the error):

on nfs server:
    /etc/exports:
	/exports *(rw,no_root_squash)

on nfs client:
    # mount server:/exports /mnt -overs=4.2,sec=sys

on nfs server, change /etc/exports and re-export:
    /etc/exports:
	#/exports *(rw,no_root_squash)
	/exports some_other_hostname(rw,no_root_squash)

    (filesystem is still exported, but not to this nfs client)

on nfs client:
    # umount /mnt
    /mnt: block devices are not permitted on filesystem.



Actual results:

error message is "block devices are not permitted on filesystem."



Expected results:

the error message is more accurate with respect to the actual problem being experienced



Additional info:

an strace indicates that umount() failed with EACCES:

	15:40:18.941193 umount2("/mnt", 0) = -1 EACCES (Permission denied) <0.000656>

and the error message is determined here:

libmount/src/context_umount.c
int mnt_context_get_umount_excode(
                        struct libmnt_context *cxt,
                        int rc,
                        char *buf,
                        size_t bufsz)
{
...
        /*
         * umount(2) errors
         */
        if (buf) {
                int syserr = mnt_context_get_syscall_errno(cxt);

                switch (syserr) {
...
                case EACCES:
                        snprintf(buf, bufsz, _("block devices are not permitted on filesystem"));
                        break;


a packet capture indicates that during the umount(), the nfs client performs a GETATTR call to the server with the filehandle of the directory/filesystem to be unmounted, and the server responds with NFS4ERR_PERM:

16:46:00.846472 IP client.949 > server.nfs: Flags [P.], seq 408:628, ack 365, win 9798, options [nop,nop,TS val 296853323 ecr 1813851030], length 220: NFS request xid 2973536849 216 getattr fh 0,1/53
16:46:00.847151 IP server.nfs > client.949: Flags [P.], seq 365:465, ack 628, win 257, options [nop,nop,TS val 1813851032 ecr 296853323], length 100: NFS reply xid 2973536849 reply ok 96 getattr ERROR: Permission denied

(the RHEL nfs server responds to the request without error)



Note: this BZ is regarding the inaccurate error message.  I will address the issue of the inability to unmount in this condition in a separate BZ against the kernel.

Comment 1 Karel Zak 2023-01-31 07:55:29 UTC
It would be possible to detect that the problem is related to the network filesystem and, in this case, avoid "block device" in the message. Do you have suggestions for the error message? 

Or maybe we can replace the message with something more human-readable, for example, "filesystem not accessible".

Comment 10 errata-xmlrpc 2023-05-16 09:12:29 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 (util-linux bug fix and enhancement update), 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-2023:3054


Note You need to log in before you can comment on or make changes to this bug.