diff options
author | Pranith K <pranithk@gluster.com> | 2011-07-14 06:31:47 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-17 07:45:41 -0700 |
commit | 97807e75956a2d240282bc64fab1b71762de0546 (patch) | |
tree | 253a6ed83db50a0a18d062423980e2f5fff7dd98 /xlators/storage | |
parent | 61f68b31f24311d09f4d2a02968ff52fd7b5a73f (diff) |
storage/posix: Remove the interim fix that handles the gfid race
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2745 (failure to detect split brain)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2745
Diffstat (limited to 'xlators/storage')
-rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 68 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix.c | 2 |
2 files changed, 1 insertions, 69 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 43a5a7053b2..484e38c7158 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -784,74 +784,6 @@ unlock: UNLOCK (&priv->lock); } -static int -is_fresh_file (struct stat *stat) -{ - struct timeval tv; - - gettimeofday (&tv, NULL); - - if ((stat->st_ctime >= (tv.tv_sec - 1)) - && (stat->st_ctime <= tv.tv_sec)) - return 1; - - return 0; -} - - -int -posix_gfid_heal (xlator_t *this, const char *path, dict_t *xattr_req) -{ - /* The purpose of this function is to prevent a race - where an inode creation FOP (like mkdir/mknod/create etc) - races with lookup in the following way: - - {create thread} | {lookup thread} - | - t0 - mkdir ("name") | - t1 - | posix_gfid_set ("name", 2); - t2 - posix_gfid_set ("name", 1); | - t3 - lstat ("name"); | lstat ("name"); - - In the above case mkdir FOP would have resulted with GFID 2 while - it should have been GFID 1. It matters in the case where GFID would - have gotten set to 1 on other subvolumes of replciate/distribute - - The "solution" here is that, if we detect lookup is attempting to - set a GFID on a file which is created very recently, but does not - yet have a GFID (i.e, between t1 and t2), then "fake" it as though - posix_gfid_heal was called at t0 instead. - */ - - uuid_t uuid_curr; - int ret = 0; - struct stat stat = {0, }; - - if (!xattr_req) - goto out; - - if (sys_lstat (path, &stat) != 0) - goto out; - - ret = sys_lgetxattr (path, GFID_XATTR_KEY, uuid_curr, 16); - if (ret != 16) { - if (is_fresh_file (&stat)) { - ret = -1; - errno = ENOENT; - goto out; - } - } - - ret = posix_gfid_set (this, path, xattr_req); -out: - return ret; -} - - int posix_acl_xattr_set (xlator_t *this, const char *path, dict_t *xattr_req) { diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 8e613ff208e..6b7168338b0 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -113,7 +113,7 @@ posix_lookup (call_frame_t *frame, xlator_t *this, MAKE_REAL_PATH (real_path, this, loc->path); - posix_gfid_heal (this, real_path, xattr_req); + posix_gfid_set (this, real_path, xattr_req); op_ret = posix_lstat_with_gfid (this, real_path, &buf); op_errno = errno; |