On 09/18/2012 01:18 AM, Anand Avati wrote:
The right place to do it is in fuse_readdir_cbk, based on
priv->enable_ino32 (see c13823bd16b26bc471d3efb15f63b76fbfdf0309)
Yeah, it seems that fuse_readdir_cbk uses d_ino directly. Could you try the
attached patch? I probably won't have the time to test this in the next days,
but if you can confirm this works for you I can post it for review.
On Mon, Sep 17, 2012 at 4:13 PM, Steve Bakke<sbakke@xxxxxxxxxx> wrote:
Found a temporary solution. We patched
xlators/protocol/client/src/client-helpers.c ~ line 159
was: entry->d_ino = trav->d_ino
now: entry->d_ino = GF_FUSE_SQUASH_INO(trav->d_info);
This will work, but does not take the mount-option in consideration. When you
test the attached patch, please revert the above change.
Thanks,
Niels
All the 32 bit apps that did not work before, now work. Need both the
original enable-ino32 patch and this one.
Not sure what the actual patch should be, but this does work at least for
our running only 32 bit apps on a Gluster mount.
Steve
------------------------------
*From:* Steve Bakke<sbakke@xxxxxxxxxx>
*To:* "gluster-devel@xxxxxxxxxx"<gluster-devel@xxxxxxxxxx>
*Sent:* Monday, September 17, 2012 11:42 AM
*Subject:* Re: Fuse mount option: enable-ino32
Yes we are running the patched version on client. We modified the print
line in our test program to display the inode values and compiled the
program for 64 bit mode, so it will run.
printf("inode:%016lx file:%s\n", dirEntry.d_ino, dirEntry.d_name );
Also to make sure client was working correctly we added logging calls to
gf_fuse_stat2attr() in fuse-helpers.c, at line 444 added:
fprintf( mylogfile, "ino32: %i st:%lx fuse:%lx \n", enable_ino32,
st->ia_ino, fa->ino );
When the test program was run, it printed this out:
inode:a2bdc7aeaee47329 file:steve.txt
inode:821222a0edf18a37 file:george.txt
inode:0000000000000001 file:.
inode:a7f29365717fb464 file:testnfs
inode:ffffffffffffffff file:..
inode:9aa3f33d3c366b4e file:fred.txt
The log file contained:
ino32: 1 st:1 fuse:1
ino32: 1 st:1 fuse:1
ino32: 1 st:1 fuse:1
ino32: 1 st:a2bdc7aeaee47329 fuse:c59b487
ino32: 1 st:821222a0edf18a37 fuse:6fe3a897
ino32: 1 st:a7f29365717fb464 fuse:d68d2701
ino32: 1 st:9aa3f33d3c366b4e fuse:a6959873
ino32: 1 st:1 fuse:1
ino32: 1 st:1 fuse:1
ino32: 1 st:1 fuse:1
ino32: 1 st:1 fuse:1
ino32: 1 st:1 fuse:1
As the inode values return to the test program are> 32 bits, seems like
there is some path that the inodes are not getting adjusted?
When we compile the test program in 32 bit mode, we get error 75, which is
EOVERFLOW. Looking at the 32bit Getdents (called by readdir) EOVERFLOW is
returned when inode values are> 32 bits.
Steve
------------------------------
*From:* Niels de Vos<ndevos@xxxxxxxxxx>
*To:* Steve Bakke<sbakke@xxxxxxxxxx>
*Cc:* "gluster-devel@xxxxxxxxxx"<gluster-devel@xxxxxxxxxx>
*Sent:* Monday, September 17, 2012 3:49 AM
*Subject:* Re: Fuse mount option: enable-ino32
On 09/15/2012 11:15 PM, Steve Bakke wrote:
All,
Just compiled and installed the Sept 15 git which includes the fuse
mount option enable-ino32 patch.
Then on the server:
gluster volume fred set enable-ino32 on
Note: volume info prints out nfs.enable-ino32: on, which I guess is ok???
The volume option is for the NFS-server only. It does not affect the
GlusterFS-native mount, therefore there is no need to set this option for
the
volume.
On client:
mount -t glusterfs -o enable-ino32 1.2.3.4:/fred mntfs
This is the correct usage.
Mounts, but still returns wrong entries, using the test program below.
This program works fine with using nfs mount, and with nfs.enable-ino32 on
server. However for other reasons must use native client.
Do I need to do something else??
Are you using the version with the patch on the client? The conversion of
the
64-bit to 32-bit inodes is done client-side, not server-side. This makes
it
possible for clients to choose if they want/need 32- or 64-bit inodes.
Cheers,
Niels
Steve
#include<stdlib.h>
#include<stdio.h>
#include<sys/types.h>
#include<dirent.h>
int main()
{
DIR* hDir = opendir(".");
if (hDir==NULL)
return 1;
struct dirent dirEntry;
struct dirent * pOut;
int err = readdir_r(hDir,&dirEntry,&pOut);
while(err==0&& pOut!=NULL)
{
printf("%s ", dirEntry.d_name);
err = readdir_r(hDir,&dirEntry,&pOut);
}
printf("\nLast Error: %d\n", err);
return 0;
}
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 6dfc334..9bf07bf 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -2425,9 +2425,11 @@ fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
char *buf = NULL;
gf_dirent_t *entry = NULL;
struct fuse_dirent *fde = NULL;
+ fuse_private_t *priv = NULL;
state = frame->root->state;
finh = state->finh;
+ priv = state->this->private;
if (op_ret < 0) {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,
@@ -2459,11 +2461,7 @@ fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
size = 0;
list_for_each_entry (entry, &entries->list, list) {
fde = (struct fuse_dirent *)(buf + size);
- fde->ino = entry->d_ino;
- fde->off = entry->d_off;
- fde->type = entry->d_type;
- fde->namelen = strlen (entry->d_name);
- strncpy (fde->name, entry->d_name, fde->namelen);
+ gf_fuse_fill_dirent (entry, fde, priv->enable_ino32);
size += FUSE_DIRENT_SIZE (fde);
}
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index 22097f5..c700554 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -416,6 +416,8 @@ fuse_state_t *get_fuse_state (xlator_t *this, fuse_in_header_t *finh);
void free_fuse_state (fuse_state_t *state);
void gf_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa,
gf_boolean_t enable_ino32);
+void gf_fuse_fill_dirent (gf_dirent_t *entry, struct fuse_dirent *fde,
+ gf_boolean_t enable_ino32);
uint64_t inode_to_fuse_nodeid (inode_t *inode);
xlator_t *fuse_active_subvol (xlator_t *fuse);
inode_t *fuse_ino_to_inode (uint64_t ino, xlator_t *fuse);
diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c
index 461f748..577be2f 100644
--- a/xlators/mount/fuse/src/fuse-helpers.c
+++ b/xlators/mount/fuse/src/fuse-helpers.c
@@ -465,6 +465,20 @@ gf_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa, gf_boolean_t enable_in
#endif
}
+void
+gf_fuse_fill_dirent (gf_dirent_t *entry, struct fuse_dirent *fde, gf_boolean_t enable_ino32)
+{
+ if (enable_ino32)
+ fde->ino = GF_FUSE_SQUASH_INO(entry->d_ino);
+ else
+ fde->ino = entry->d_ino;
+
+ fde->off = entry->d_off;
+ fde->type = entry->d_type;
+ fde->namelen = strlen (entry->d_name);
+ strncpy (fde->name, entry->d_name, fde->namelen);
+}
+
static int
fuse_do_flip_xattr_ns (char *okey, const char *nns, char **nkey)
{