Bug 1386071

Summary: Spurious permission denied problems observed
Product: [Community] GlusterFS Reporter: Pranith Kumar K <pkarampu>
Component: posixAssignee: Pranith Kumar K <pkarampu>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.8CC: bugs
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-3.8.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1386072 (view as bug list) Environment:
Last Closed: 2016-11-29 09:36:46 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: 1386072    

Description Pranith Kumar K 2016-10-18 03:24:30 UTC
Description of problem:
    Problem:
    When one thread is in the process of creating a file/directory
    and the other thread is doing readdirp, there is a chance that
    posix_pstat, creation fops race in the following manner which
    will lead to wrong stat values to be read by parent xlators
    like posix-acl.
    
    Creation fops                           posix_pstat() as part of readdirp
    1) file is created with uid/gid 0/0     1) does stat of the path that
                                               is created just now.
    2) Does chown to set the correct
       uid/gid
    3) Sets the acl/user/internal xattrs
    4) Sets the gfid on the entry and
       completes the creation of the file/dir
                                            2) fills the gfid in the iatt
    
    If unwind of readdirp hits server xlator before creation fop, then
    posix-acl remembers uid/gid of the file to be root/root and fails
    fops like open etc on it.
    
    Fix:
    Reverse the order of filling gfid and filling lstat() values in
    posix_pstat() so that if there is gfid in iatt buffer uid/gid
    are valid.
    


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Worker Ant 2016-10-18 03:30:05 UTC
REVIEW: http://review.gluster.org/15665 (storage/posix: Fix race in posix_pstat) posted (#1) for review on release-3.8 by Pranith Kumar Karampuri (pkarampu)

Comment 2 Worker Ant 2016-10-25 08:54:49 UTC
COMMIT: http://review.gluster.org/15665 committed in release-3.8 by Pranith Kumar Karampuri (pkarampu) 
------
commit 7e1d7a9db6dbc20bd3bc24c99d5a4c89c63de0d2
Author: Pranith Kumar K <pkarampu>
Date:   Fri Sep 23 21:06:37 2016 +0530

    storage/posix: Fix race in posix_pstat
    
    Problem:
    When one thread is in the process of creating a file/directory
    and the other thread is doing readdirp, there is a chance that
    posix_pstat, creation fops race in the following manner which
    will lead to wrong stat values to be read by parent xlators
    like posix-acl.
    
    Creation fops                           posix_pstat() as part of readdirp
    1) file is created with uid/gid 0/0     1) does stat of the path that
                                               is created just now.
    2) Does chown to set the correct
       uid/gid
    3) Sets the acl/user/internal xattrs
    4) Sets the gfid on the entry and
       completes the creation of the file/dir
                                            2) fills the gfid in the iatt
    
    If unwind of readdirp hits server xlator before creation fop, then
    posix-acl remembers uid/gid of the file to be root/root and fails
    fops like open etc on it.
    
    Fix:
    Reverse the order of filling gfid and filling lstat() values in
    posix_pstat() so that if there is gfid in iatt buffer uid/gid
    are valid.
    
     >Change-Id: I46caa7f6da7abfa40a0b1d70e35b88de9c64959c
     >Signed-off-by: Pranith Kumar K <pkarampu>
     >Reviewed-on: http://review.gluster.org/15564
     >NetBSD-regression: NetBSD Build System <jenkins.org>
     >CentOS-regression: Gluster Build System <jenkins.org>
     >Smoke: Gluster Build System <jenkins.org>
     >Reviewed-by: Shyamsundar Ranganathan <srangana>
    
    BUG: 1386071
    Change-Id: I81c4c6e6b8d4037cee9b23da262b254c126c0a19
    Signed-off-by: Pranith Kumar K <pkarampu>
    Reviewed-on: http://review.gluster.org/15665
    Smoke: Gluster Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: Niels de Vos <ndevos>
    NetBSD-regression: NetBSD Build System <jenkins.org>

Comment 3 Niels de Vos 2016-11-29 09:36:46 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.8.6, please open a new bug report.

glusterfs-3.8.6 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://www.gluster.org/pipermail/packaging/2016-November/000217.html
[2] https://www.gluster.org/pipermail/gluster-users/