Bug 1276534

Summary: [exportfs] exportfs -u cannot unexport when the specified path involves a trailing "/"
Product: Red Hat Enterprise Linux 7 Reporter: Yongcheng Yang <yoyang>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: eguan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nfs-utils-1.3.0-0.25.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1276538 (view as bug list) Environment:
Last Closed: 2016-11-04 05:01:11 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:    
Bug Blocks: 1276538    

Description Yongcheng Yang 2015-10-30 03:47:07 UTC
Description of problem:
When using "exportfs -u" to unexport just one directory, it always failed when the specified path involves a trailing "/", with error:
exportfs: Could not find 'client.example.com:/export/' to unexport.

Version-Release number of selected component (if applicable):
nfs-utils-1.3.0-0.21.el7

How reproducible:
100%

Steps to Reproduce:
1. exportfs -v $HOSTNAME:/export/
2. exportfs -u client2.example.com:/export/

Actual results:
[root@hp-dl388g8-17 ~]# exportfs -ua
[root@hp-dl388g8-17 ~]# exportfs -v $HOSTNAME:/export/
exporting hp-dl388g8-17.rhts.eng.pek2.redhat.com:/export/
[root@hp-dl388g8-17 ~]# exportfs -v
/export       	hp-dl388g8-17.rhts.eng.pek2.redhat.com(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash)
[root@hp-dl388g8-17 ~]# exportfs -u hp-dl388g8-17.rhts.eng.pek2.redhat.com:/export/ <<<<<<<<<<<<<<<<<<<<< failed
exportfs: Could not find 'hp-dl388g8-17.rhts.eng.pek2.redhat.com:/export/' to unexport.
[root@hp-dl388g8-17 ~]# echo $?
1
[root@hp-dl388g8-17 ~]# exportfs -v
/export       	hp-dl388g8-17.rhts.eng.pek2.redhat.com(ro,wdelay,root_squash,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash)
[root@hp-dl388g8-17 ~]# exportfs -uv hp-dl388g8-17.rhts.eng.pek2.redhat.com:/export  <<<<<<<<<<<<<<<<<<<< success without trailing "/"
unexporting hp-dl388g8-17.rhts.eng.pek2.redhat.com:/export
[root@hp-dl388g8-17 ~]# echo $?
0
[root@hp-dl388g8-17 ~]# exportfs -v
[root@hp-dl388g8-17 ~]# 
[root@hp-dl388g8-17 ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.21.el7.x86_64
[root@hp-dl388g8-17 ~]# 

Expected results:
Unexport success

Additional info:
Can reproduced with RHEL6 too, will file another bug

Comment 2 Yongcheng Yang 2016-05-03 06:15:12 UTC
commit a9a7728d874398c855e386d9583cf05e681ecc1c
Author: Yongcheng Yang <yongcheng.yang>
Date:   Fri Dec 11 11:01:17 2015 -0500

    exportfs: Deal with path's trailing "/" in unexportfs_parsed()
    
    When unexport directory, it's possible that the specified path ends with
    a '/'. So we need to deal with it to find the matched entry.
    
    If not, there will be error like "Could not find '*:/some_path/' to
    unexport."

Comment 5 Yongcheng Yang 2016-05-30 08:45:11 UTC
Move to VERIFIED as comment 4 and continue to run the automatic case.

Comment 7 errata-xmlrpc 2016-11-04 05:01:11 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://rhn.redhat.com/errata/RHBA-2016-2383.html