Bug 1223889 - readdirp return 64bits inodes even if enable-ino32 is set
Summary: readdirp return 64bits inodes even if enable-ino32 is set
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: fuse
Version: mainline
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Niels de Vos
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1222150 1223890 1223891
TreeView+ depends on / blocked
 
Reported: 2015-05-21 15:49 UTC by Niels de Vos
Modified: 2016-06-16 13:03 UTC (History)
3 users (show)

Fixed In Version: glusterfs-3.8rc2
Doc Type: Bug Fix
Doc Text:
Clone Of: 1222150
: 1223890 1223891 (view as bug list)
Environment:
Last Closed: 2016-06-16 13:03:49 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)

Description Niels de Vos 2015-05-21 15:49:45 UTC
+++ This bug was initially created as a clone of Bug #1222150 +++

Description of problem:

No issue using nfs only with fuse.

For 32bits applications on 64bits systems, ino32 is mandadory but the readdirp optimisation still return 64 bits inodes when getdent syscall is triggerd.


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

How reproducible:

Always

Steps to Reproduce:
1. Have a 32 bits application listing directories on a 64 bits system
2. Run it
3. Cry

Actual results:

open("/usr/global/lib/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5
getdents(5, 0x9b27308, 32768)           = -1 EOVERFLOW (Value too large for defined data type)

Expected results:

open("/usr/global/lib/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5
getdents(5, /* 1 entries */, 32768)     = 88

Additional info:


use use-readdirp=off when mounting the volume as a workaround but impact performaces.

--- Additional comment from Niels de Vos on 2015-05-20 22:48:16 CEST ---

Compile tested only, needs real functional test and maybe a test-case too.

This bug needs to get cloned for the mainline version and the patch needs review+merging in the master branch before it can get included in 3.5.

--- Additional comment from Cyril Peponnet on 2015-05-21 01:22:27 CEST ---

I gave a try with RPMs generated through

http://koji.fedoraproject.org/koji/taskinfo?taskID=9810286

Seems to work fine with enable-ino32 to mount options and use 32bit binary to call getdents syscall.

Thanks !

For the record to test it you can compile:

/*
 *  * List directories using getdents() because ls, find and Python libraries
 *   * use readdir() which is slower (but uses getdents() underneath.
 *    *
 *     * Compile with
 *      * ]$ gcc  getdents.c -o getdents
 *       */
#define _GNU_SOURCE
#include <dirent.h>     /* Defines DT_* constants */
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>

#define handle_error(msg) \
       do { perror(msg); exit(EXIT_FAILURE); } while (0)

struct linux_dirent {
   long           d_ino;
   off_t          d_off;
   unsigned short d_reclen;
   char           d_name[];
};

#define BUF_SIZE 1024*1024*5

int
main(int argc, char *argv[])
{
   int fd, nread;
   char buf[BUF_SIZE];
   struct 

with gcc -m32 getdents getdents.c


And run it like ./getdents /path/

Before the patch:

strace -e getdents ./getdents /mnt/test/
[ Process PID=15906 runs in 32 bit mode. ]
getdents(3, /* 1 entries */, 5242880)   = 16
getdents(3, 0xff8f65bf, 5242880)        = -1 EOVERFLOW (Value too large for defined data type)
getdents: Value too large for defined data type
+++ exited with 1 +++

Comment 1 Anand Avati 2015-05-21 15:55:14 UTC
REVIEW: http://review.gluster.org/10881 (fuse: squash 64-bit inodes in readdirp when enable-ino32 is set) posted (#1) for review on master by Niels de Vos (ndevos@redhat.com)

Comment 2 Anand Avati 2015-05-28 09:15:01 UTC
COMMIT: http://review.gluster.org/10881 committed in master by Raghavendra G (rgowdapp@redhat.com) 
------
commit 47c604c2d2ccd8fb62c1ad155f63545b87ada851
Author: Niels de Vos <ndevos@redhat.com>
Date:   Thu May 21 17:47:33 2015 +0200

    fuse: squash 64-bit inodes in readdirp when enable-ino32 is set
    
    The structures returned by readdirp contain the inode 2x. Only one of
    them was squashed into 32-bits when enable-ino32 is enabled.
    
    Change-Id: I33a6d28fb118bb23971f918ffeb983d7f033106e
    BUG: 1223889
    Signed-off-by: Niels de Vos <ndevos@redhat.com>
    Tested-by: Cyril Peponnet <cyril@peponnet.fr> [on release-3.5]
    Reviewed-on: http://review.gluster.org/10881
    Tested-by: NetBSD Build System
    Tested-by: Gluster Build System <jenkins@build.gluster.com>
    Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
    Tested-by: Raghavendra G <rgowdapp@redhat.com>

Comment 3 Nagaprasad Sathyanarayana 2015-10-25 14:59:59 UTC
Fix for this BZ is already present in a GlusterFS release. You can find clone of this BZ, fixed in a GlusterFS release and closed. Hence closing this mainline BZ as well.

Comment 4 Niels de Vos 2016-06-16 13:03:49 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.0, please open a new bug report.

glusterfs-3.8.0 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://blog.gluster.org/2016/06/glusterfs-3-8-released/
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user


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