diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 17 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.h | 4 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-helpers.c | 47 | ||||
-rwxr-xr-x | xlators/mount/fuse/utils/mount.glusterfs.in | 13 |
4 files changed, 51 insertions, 30 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 51e644269..ed24c7382 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -246,7 +246,7 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.path, buf->ia_ino); buf->ia_blksize = this->ctx->page_size; - gf_fuse_stat2attr (buf, &feo.attr); + gf_fuse_stat2attr (buf, &feo.attr, priv->enable_ino32); if (!buf->ia_ino) { gf_log ("glusterfs-fuse", GF_LOG_WARNING, @@ -437,7 +437,7 @@ fuse_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prebuf->ia_ino); postbuf->ia_blksize = this->ctx->page_size; - gf_fuse_stat2attr (postbuf, &fao.attr); + gf_fuse_stat2attr (postbuf, &fao.attr, priv->enable_ino32); fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); fao.attr_valid_nsec = @@ -489,7 +489,7 @@ fuse_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, buf->ia_ino); buf->ia_blksize = this->ctx->page_size; - gf_fuse_stat2attr (buf, &fao.attr); + gf_fuse_stat2attr (buf, &fao.attr, priv->enable_ino32); fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); fao.attr_valid_nsec = @@ -761,7 +761,7 @@ fuse_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, statpost->ia_ino); statpost->ia_blksize = this->ctx->page_size; - gf_fuse_stat2attr (statpost, &fao.attr); + gf_fuse_stat2attr (statpost, &fao.attr, priv->enable_ino32); fao.attr_valid = calc_timeout_sec (priv->attribute_timeout); fao.attr_valid_nsec = @@ -1673,7 +1673,7 @@ fuse_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, state->loc.path, fd, buf->ia_ino); buf->ia_blksize = this->ctx->page_size; - gf_fuse_stat2attr (buf, &feo.attr); + gf_fuse_stat2attr (buf, &feo.attr, priv->enable_ino32); linked_inode = inode_link (inode, state->loc.parent, state->loc.name, buf); @@ -4515,6 +4515,13 @@ init (xlator_t *this_xl) GF_ASSERT (ret == 0); } + priv->enable_ino32 = 0; + ret = dict_get_str (options, "enable-ino32", &value_string); + if (ret == 0) { + ret = gf_string2boolean (value_string, &priv->enable_ino32); + GF_ASSERT (ret == 0); + } + priv->fuse_dump_fd = -1; ret = dict_get_str (options, "dump-fuse", &value_string); if (ret == 0) { diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index eb43e6686..4811ad120 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -109,6 +109,7 @@ struct fuse_private { gf_boolean_t acl; gf_boolean_t selinux; gf_boolean_t read_only; + gf_boolean_t enable_ino32; fdtable_t *fdtable; /* For fuse-reverse-validation */ @@ -342,7 +343,8 @@ fuse_loc_fill (loc_t *loc, fuse_state_t *state, ino_t ino, call_frame_t *get_call_frame_for_req (fuse_state_t *state); 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); +void gf_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa, + 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 feec23998..e0a63e4c3 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -403,32 +403,39 @@ fail: } +/* 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_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa, gf_boolean_t enable_ino32) { - fa->ino = st->ia_ino; - fa->size = st->ia_size; - fa->blocks = st->ia_blocks; - fa->atime = st->ia_atime; - fa->mtime = st->ia_mtime; - fa->ctime = st->ia_ctime; - fa->atimensec = st->ia_atime_nsec; - fa->mtimensec = st->ia_mtime_nsec; - fa->ctimensec = st->ia_ctime_nsec; - fa->mode = st_mode_from_ia (st->ia_prot, st->ia_type); - fa->nlink = st->ia_nlink; - fa->uid = st->ia_uid; - fa->gid = st->ia_gid; - fa->rdev = makedev (ia_major (st->ia_rdev), - ia_minor (st->ia_rdev)); + if (enable_ino32) + fa->ino = GF_FUSE_SQUASH_INO(st->ia_ino); + else + fa->ino = st->ia_ino; + + fa->size = st->ia_size; + fa->blocks = st->ia_blocks; + fa->atime = st->ia_atime; + fa->mtime = st->ia_mtime; + fa->ctime = st->ia_ctime; + fa->atimensec = st->ia_atime_nsec; + fa->mtimensec = st->ia_mtime_nsec; + fa->ctimensec = st->ia_ctime_nsec; + fa->mode = st_mode_from_ia (st->ia_prot, st->ia_type); + fa->nlink = st->ia_nlink; + fa->uid = st->ia_uid; + fa->gid = st->ia_gid; + fa->rdev = makedev (ia_major (st->ia_rdev), + ia_minor (st->ia_rdev)); #if FUSE_KERNEL_MINOR_VERSION >= 9 - fa->blksize = st->ia_blksize; + fa->blksize = st->ia_blksize; #endif #ifdef GF_DARWIN_HOST_OS - fa->crtime = (uint64_t)-1; - fa->crtimensec = (uint32_t)-1; - fa->flags = 0; + fa->crtime = (uint64_t)-1; + fa->crtimensec = (uint32_t)-1; + fa->flags = 0; #endif } diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index 381a61bd9..0ed0af882 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -83,6 +83,10 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --selinux"); fi + if [ -n "$enable_ino32" ]; then + cmd_line=$(echo "$cmd_line --enable-ino32"); + fi + if [ -n "$worm" ]; then cmd_line=$(echo "$cmd_line --worm"); fi @@ -278,10 +282,11 @@ main () for pair in $(echo "$opt" | tr "," " "); do # Handle options without values. case "$pair" in - "ro") read_only=1 ;; - "acl") acl=1 ;; - "selinux") selinux=1 ;; - "worm") worm=1 ;; + "ro") read_only=1 ;; + "acl") acl=1 ;; + "selinux") selinux=1 ;; + "worm") worm=1 ;; + "enable-ino32") enable_ino32=1 ;; # "mount -t glusterfs" sends this, but it's useless. "rw") ;; *) |