diff options
| author | Krutika Dhananjay <kdhananj@redhat.com> | 2015-05-21 14:58:26 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-06-06 23:02:37 -0700 | 
| commit | 53b3c38f47251aff361c55005def8e3940114aa1 (patch) | |
| tree | 7f86cc95b198cfd39e7fe3c664e95199b83051e7 | |
| parent | 6fce83e55c2a4b96de8c9b1ce5b1bc8a60eaacc3 (diff) | |
features/shard: Handle symlinks appropriately in fops
        Backport of: http://review.gluster.org/10995
(f)stat, unlink and rename must skip doing inode_ctx_get()
of shard block size on symbolic links.
Change-Id: Iaf2502512a5838db137e5e1f0c14b12f5058865f
BUG: 1227572
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/11066
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
| -rw-r--r-- | xlators/features/shard/src/shard.c | 20 | 
1 files changed, 15 insertions, 5 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 670fc60ddc0..cbc836476d0 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -782,7 +782,8 @@ shard_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)          uint64_t           block_size = 0;          shard_local_t     *local      = NULL; -        if (IA_ISDIR (loc->inode->ia_type)) { +        if ((IA_ISDIR (loc->inode->ia_type)) || +            (IA_ISLNK (loc->inode->ia_type))) {                  STACK_WIND (frame, default_stat_cbk, FIRST_CHILD (this),                              FIRST_CHILD (this)->fops->stat, loc, xdata);                  return 0; @@ -832,7 +833,8 @@ shard_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)          uint64_t           block_size = 0;          shard_local_t     *local      = NULL; -        if (IA_ISDIR (fd->inode->ia_type)) { +        if ((IA_ISDIR (fd->inode->ia_type)) || +            (IA_ISLNK (fd->inode->ia_type))) {                  STACK_WIND (frame, default_fstat_cbk, FIRST_CHILD(this),                              FIRST_CHILD (this)->fops->fstat, fd, xdata);                  return 0; @@ -1856,7 +1858,7 @@ shard_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,          shard_local_t  *local      = NULL;          ret = shard_inode_ctx_get_block_size (loc->inode, this, &block_size); -        if (ret) { +        if ((ret) && (!IA_ISLNK(loc->inode->ia_type))) {                  gf_log (this->name, GF_LOG_ERROR, "Failed to get block size "                          "from inode ctx of %s", uuid_utoa (loc->inode->gfid));                  goto err; @@ -1981,7 +1983,8 @@ shard_rename_src_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          local->postoldparent = *postoldparent;          local->prenewparent = *prenewparent;          local->postnewparent = *postnewparent; -        local->xattr_rsp = dict_ref (xdata); +        if (xdata) +                local->xattr_rsp = dict_ref (xdata);          /* Now the base file is looked up to gather the ia_size and ia_blocks.*/ @@ -2046,8 +2049,15 @@ shard_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,          uint64_t        dst_block_size = 0;          shard_local_t  *local          = NULL; +        if (IA_ISDIR (oldloc->inode->ia_type)) { +                STACK_WIND (frame, default_rename_cbk, FIRST_CHILD(this), +                            FIRST_CHILD(this)->fops->rename, oldloc, newloc, +                            xdata); +                return 0; +        } +          ret = shard_inode_ctx_get_block_size (oldloc->inode, this, &block_size); -        if (ret) { +        if ((ret) && (!IA_ISLNK (oldloc->inode->ia_type))) {                  gf_log (this->name, GF_LOG_ERROR, "Failed to get block size "                          "from inode ctx of %s",                          uuid_utoa (oldloc->inode->gfid));  | 
