Bug 510184

Summary: NFSD returns NFS4_OK(0) when OPEN with access==read/write on a read-denied/write-denied file
Product: Red Hat Enterprise Linux 4 Reporter: Harshula Jayasuriya <harshula>
Component: kernelAssignee: Jeff Layton <jlayton>
Status: CLOSED ERRATA QA Contact: yanfu,wang <yanwang>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.8CC: bfields, eguan, jlayton, kzhang, moshiro, rwheeler, steved, tao
Target Milestone: rc   
Target Release: 4.9   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1023271 (view as bug list) Environment:
Last Closed: 2011-02-16 16:00:02 UTC Type: ---
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: 1023271, 1646129    
Attachments:
Description Flags
Testcase from Fujitsu
none
Patch from Fujitsu (untested) none

Description Harshula Jayasuriya 2009-07-08 08:05:42 UTC
Details from Fujitsu:
------------------------------------------------------------
Description of Problem:

    According to RFC3530, the checking of share reservations on OPEN is done with no
    exception for an existing OPEN for the same open_owner, but the RHEL4.8GA doesn't
    check the share reservations when it finds an existing OPEN for the same open_owner.
    
    So when open with access == read/write on a read-denied/write-denied file should return
    NFS4ERR_SHARE_DENIED(10015), instead got NFS4_OK(0).

Version-Release number of selected component:

 Red Hat Enterprise Linux Version Number: RHEL4
 Release Number:    4.8 GA
 Architecture:       x86_64
 Kernel Version:    kernel-2.6.9-89.EL
 Related Package Version:    none
 Related Middleware / Application:    none

Drivers or hardware or architecture dependency:

 None

How reproducible:

 Every time

Step to Reproduce:

 I prepared a reproduction program.
 Please execute this program according to the following procedure.
 
Server :
  Step1
       # cat /etc/exports
          /mnt *(rw,insecure,fsid=0,no_root_squash)
   Step2
        # service nfs start
     
 Client :
      Step1: # mount -t nfs4 SERVERADDR:/ /mnt

      Step2: create a temporary directory for test
     # mkdir /mnt/tmp

      Step3: # gcc -o open_share_deny open_share_deny.c

      Step4: # ./open_share_deny SERVERADDR

      Step5: clean up the test file
             # rm -rf /mnt/tmp
             
Actual Results:

  Kernel return NFS4_OK(0).

  Reproduction program log.
  # ./open 10.167.141.170
    ==================== FAIL ===========================
      OPEN with access==read on a read-denied file should
      return NFS4ERR_SHARE_DENIED, instead got NFS4_OK

Expected Results:

 Kernel return NFS4ERR_SHARE_DENIED(10015)
 
  Reproduction program log.
  # ./open 10.167.141.170
      ==================== PASS===========================
       OPEN with access==read on a read-denied file
       return NFS4ERR_SHARE_DENIED
       
Summary of actions taken to resolve issue:

 None

Location of diagnostic data:

 None

Hardware configuration:

 Model:        PRIMERGY TX150 S5
 CPU Info:     Intel(R) Xeon(R) CPU   3040  @ 1.86GHz
 Memory Info:  6GB

Business Impact:

 Target Release: 4.9

 Errata Request: No

 Hotfix Request: No

Additional Info:

 Patch file :
   NFSD-check-open.patch

 Reproduction program :
   open_share_deny.c
------------------------------------------------------------

* The aforementioned patch appears to be based on:
  - http://marc.info/?l=linux-nfs&m=109600225123868&w=2
  - http://marc.info/?l=linux-nfs&m=111147024324636&w=2
* RHEL 5 kernel contains the code that is referred to in these patches.

Comment 1 Harshula Jayasuriya 2009-07-08 08:06:46 UTC
Created attachment 350904 [details]
Testcase from Fujitsu

Comment 2 Harshula Jayasuriya 2009-07-08 08:10:14 UTC
Created attachment 350905 [details]
Patch from Fujitsu (untested)

Comment 3 Jeff Layton 2009-08-12 18:42:30 UTC
I went ahead and added these patches to my test kernels:

http://people.redhat.com/jlayton

If you're able to test them and confirm that it fixes the problem for you, then that would also be helpful.

Comment 7 RHEL Program Management 2010-07-19 10:59:08 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 9 Vivek Goyal 2010-09-17 17:51:36 UTC
Committed in 89.36.EL . RPMS are available at http://people.redhat.com/vgoyal/rhel4/

Comment 14 errata-xmlrpc 2011-02-16 16:00:02 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0263.html