summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2015-05-20 22:34:44 +0200
committerNiels de Vos <ndevos@redhat.com>2015-06-03 13:23:55 -0700
commit86487dfb7f51f552bb27a16568a612f14221cd49 (patch)
tree827dbe617ca87aaa9ebeb61501b5168b9646bb4e
parentbfce25666d8a0d198292df4884d7d8d56ec0dc8c (diff)
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. Backport of: > Change-Id: I33a6d28fb118bb23971f918ffeb983d7f033106e > BUG: 1223889 > Reviewed-on: http://review.gluster.org/10881 > Signed-off-by: Niels de Vos <ndevos@redhat.com> > Tested-by: Cyril Peponnet <cyril@peponnet.fr> [on release-3.5] Change-Id: I33a6d28fb118bb23971f918ffeb983d7f033106e BUG: 1222150 Signed-off-by: Niels de Vos <ndevos@redhat.com> Tested-by: Cyril Peponnet <cyril@peponnet.fr> Reviewed-on: http://review.gluster.org/10884 Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c7
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.h3
-rw-r--r--xlators/mount/fuse/src/fuse-helpers.c3
3 files changed, 9 insertions, 4 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 0bbdf86b695..3b2df131fa3 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -2713,7 +2713,12 @@ fuse_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
fde = (struct fuse_direntplus *)(buf + size);
feo = &fde->entry_out;
- fde->dirent.ino = entry->d_ino;
+
+ if (priv->enable_ino32)
+ fde->dirent.ino = GF_FUSE_SQUASH_INO(entry->d_ino);
+ else
+ fde->dirent.ino = entry->d_ino;
+
fde->dirent.off = entry->d_off;
fde->dirent.type = entry->d_type;
fde->dirent.namelen = strlen (entry->d_name);
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index 1a85cd348b8..f0ab546f662 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -143,6 +143,9 @@ typedef struct fuse_graph_switch_args fuse_graph_switch_args_t;
#define FH_TO_FD(fh) ((_FH_TO_FD (fh))?(fd_ref (_FH_TO_FD (fh))):((fd_t *) 0))
+/* Use the same logic as the Linux NFS-client */
+#define GF_FUSE_SQUASH_INO(ino) (((uint32_t) ino) ^ (ino >> 32))
+
#define FUSE_FOP(state, ret, op_num, fop, args ...) \
do { \
xlator_t *xl = NULL; \
diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c
index 6584dcfb6fc..e5e5ca1b329 100644
--- a/xlators/mount/fuse/src/fuse-helpers.c
+++ b/xlators/mount/fuse/src/fuse-helpers.c
@@ -450,9 +450,6 @@ fail:
return ret;
}
-/* Use the same logic as the Linux NFS-client */
-#define GF_FUSE_SQUASH_INO(ino) ((uint32_t) ino) ^ (ino >> 32)
-
/* courtesy of folly */
void
gf_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa, gf_boolean_t enable_ino32)