Bug 1594616

Summary: CephFS client library (ceph-fuse) gives stats for "." instead of the parent for the ".." dentry during readdir traversal
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Patrick Donnelly <pdonnell>
Component: CephFSAssignee: Patrick Donnelly <pdonnell>
Status: CLOSED ERRATA QA Contact: Vasishta <vashastr>
Severity: low Docs Contact:
Priority: low    
Version: 3.0CC: ceph-eng-bugs, ceph-qe-bugs, john.spray, rperiyas, tchandra
Target Milestone: z5   
Target Release: 3.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: RHEL: ceph-12.2.4-32 Ubuntu: ceph_12.2.4-36redhat1xenial Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-08-09 18:27:13 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:

Description Patrick Donnelly 2018-06-25 01:31:12 UTC
Description of problem:

Code incorrectly fills in stat information for the directory being traversed for the parent dentry, "..".

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

3.0

How reproducible:

100%

Steps to Reproduce:
1. Compile this C++ program:

> #include <assert.h>
> #include <string.h>
> #include <stddef.h>
> #include <dirent.h>
> #include "include/cephfs/libcephfs.h"
> 
> int main (int argc, char *argv[])
> { 
>   struct ceph_mount_info *admin;
> 
>   int r = ceph_create(&admin, NULL);
>   if (r < 0)
>     return r;
>   ceph_conf_read_file(admin, NULL);
>   ceph_conf_parse_env(admin, NULL);
>   r = ceph_mount(admin, "/");
>   if (r < 0)
>     return r;
> 
>   ceph_mkdir(admin, "foo", 0777);
>   struct ceph_statx fb;
>   ceph_statx(admin, "/foo", &fb, CEPH_STATX_INO, 0);
>   struct ceph_dir_result *dirp;
>   ceph_opendir(admin, "foo", &dirp);
>   struct ceph_statx b;
>   struct dirent de;
>   while (ceph_readdirplus_r(admin, dirp, &de, &b, CEPH_STATX_INO, 0, NULL)) {
>     if (strcmp("..", de.d_name) == 0) {
>       assert(fb.stx_ino != b.stx_ino);
>       break;
>     }
>   }
> 
>   ceph_shutdown(admin);
>   return 0;
> }


2. Run the program, it should not assert.


Actual results:

> sh-4.2# ./test
> test: /ceph/test.c:29: int main(int, char**): Assertion `fb.stx_ino != b.stx_ino' failed.
> Aborted (core dumped)

Expected results:

> sh-4.2# ./test
> sh-4.2#

Additional info:

Comment 10 errata-xmlrpc 2018-08-09 18:27:13 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-2018:2375