Re: questions about compat_filldir

From: Jeff Layton
Date: Sun May 15 2011 - 09:50:36 EST


On Sun, 15 May 2011 11:09:56 +0800
errik <waitingfor2009marry@xxxxxxxxx> wrote:

> Hi Jeff,
> I have noticed your good comments on kernel mailing list about CIFS.
> http://kerneltrap.org/mailarchive/linux-kernel/2010/12/6/4655183/thread#mid-4655183
>
> Actually I also confront the same problem that 32 bit userspace
> applications in an amd64 environment was not able to list the directories of
> a CIFS-mounted share. The application is an legacy code built without
> option -D_FILE_OFFSET_BITS=64.
> Our code supports series of RedHat enterprise server such as RHEL4/RHEL5,
> it works fine on RHEL5 x86_64 (2.6.18). Now it can't work on RHEL6 x86_64
> (kernel version is 2.6.32). Afer compared the related codes of the two
> versions kernel, the root cause is change of function compat_filldir in
> compat.c.
> >>>
> if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) {
> buf->error = -EOVERFLOW;
> return -EOVERFLOW;
> }
> >>>
> My questions are:
> 1) Why RHEL6 (2.6.32) need to do the change? Does that because CIFS on RHEL6
> (2.6.32) use 64 bit inode while RHEL5 use 32-bit inode? If this, How I can
> get the inode information from kernel code?
> I think RHEL6 changes because kernel source change. I just want to know
> the root cause of the change.
> I haved compared the struct inode in 2.6.32 and 2.6.18, still no idea the
> change from 32-bit inode to 64-bit inode.
>

The default on RHEL6 is to use server inode numbers if they are
provided (-o serverino). The default on RHEL5 is to manufacture them.
This is primarily because server inode numbers weren't properly
supported when RHEL5 first shipped.

You can make RHEL6 have RHEL5's behavior by mounting with "-o
noserverino". That will make the kernel replace the inode numbers
provided by the server with ones generated by iunique().

> 2) compat_filldir is used for 32-bit system call on 64 bit OS, what's the
> use of compat_filldir64 while this is filldir64.
>

compat_filldir64 is for the 32-bit version of the getdents64() system
call. compat_filldir is for the 32-bit version of getdents().

> Thanks for your time. I am looking forward to your comments.
>
>
> Regards,
> Errik


--
Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/