diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2014-09-02 09:40:44 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-12 02:55:51 -0700 |
commit | 444ffda19e2052b5fc78f7dc020de161ebee8563 (patch) | |
tree | 954dac07ba8f85f8345460c1693b476f3c1d7d02 /xlators/storage/posix/src/posix-handle.h | |
parent | 43d49fab8cce7d06fc63f23757abc7f2c70a6d48 (diff) |
storage/posix: Prefer gfid links for inode-handle
Backport of http://review.gluster.org/8575
Problem:
File path could change by other entry operations in-flight so if renames are in
progress at the time of other operations like open, it may lead to failures.
We observed that this issue can also happen while renames and readdirps/lookups
are in progress because dentry-table is going stale sometimes.
Fix:
Prefer gfid-handles over paths for files. For directory handles prefering
gfid-handles hits performance issues because it needs to resolve paths
traversing up the symlinks.
Tests which test if files are opened should check on gfid path after this change.
So changed couple of tests to reflect the same.
Note:
This patch doesn't fix the issue for directories. I think a complete fix is to
come up with an entry operation serialization xlator. Until then lets live with
this.
BUG: 1136821
Change-Id: If93e46d542a4e96a81a0639b5210330f7dbe8be0
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8594
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-handle.h')
-rw-r--r-- | xlators/storage/posix/src/posix-handle.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h index 0654bcd5ee0..a30e0296140 100644 --- a/xlators/storage/posix/src/posix-handle.h +++ b/xlators/storage/posix/src/posix-handle.h @@ -29,6 +29,8 @@ UUID0_STR) + 1) #define LOC_HAS_ABSPATH(loc) (loc && (loc->path) && (loc->path[0] == '/')) +#define LOC_IS_DIR(loc) (loc && (loc->inode) && \ + (loc->inode->ia_type == IA_IFDIR)) #define MAKE_PGFID_XATTR_KEY(var, prefix, pgfid) do { \ var = alloca (strlen (prefix) + UUID_CANONICAL_FORM_LEN + 1); \ @@ -152,7 +154,7 @@ "null gfid for path %s", (loc)->path); \ break; \ } \ - if (LOC_HAS_ABSPATH (loc)) { \ + if (LOC_IS_DIR (loc) && LOC_HAS_ABSPATH (loc)) { \ MAKE_REAL_PATH (rpath, this, (loc)->path); \ op_ret = posix_pstat (this, (loc)->gfid, rpath, iatt_p); \ break; \ |