diff options
author | Anand Avati <avati@redhat.com> | 2013-07-22 10:02:34 -0700 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-09-10 01:23:17 -0700 |
commit | 2cd2532e149847771319ad56b8b745f0f38c0bd4 (patch) | |
tree | 6546d6dac4096783974bb16b639167b1d2369481 /api | |
parent | 8641a8641c4efec9cc7ac20108f2461a0300d01c (diff) |
gfapi: perform open() on pre-existing inode in glfs_creat()
Performing syncop_create() on a pre-existing file can result
in opening the linkfile if DHT has a linkfile for the file.
This is because dht_create() will perform the op on the
hashed_subvol() and overwrite the layout in dht_create_cbk.
Change-Id: I7a0db56921ec9fc3e278e0418db3b967f81e5598
BUG: 990410
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/5884
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs-fops.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index dd9ea451aae..1794e603f3f 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -394,8 +394,12 @@ retry: goto out; } - ret = syncop_create (subvol, &loc, flags, mode, glfd->fd, - xattr_req, &iatt); + if (ret == 0) { + ret = syncop_open (subvol, &loc, flags, glfd->fd); + } else { + ret = syncop_create (subvol, &loc, flags, mode, glfd->fd, + xattr_req, &iatt); + } ESTALE_RETRY (ret, errno, reval, &loc, retry); |