summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-fops.c
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-07-22 10:02:34 -0700
committerAnand Avati <avati@redhat.com>2013-07-31 13:29:35 -0700
commitdfedfec3593ca0fc026d8a094916824e1b90e60b (patch)
tree1a4ffec469ca2c48032c120c40a9f00d0451a363 /api/src/glfs-fops.c
parent691b973704b4ba511b295ee6f8baf1c4a1d8d89c (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/5447 Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Tested-by: Raghavendra Talur <rtalur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'api/src/glfs-fops.c')
-rw-r--r--api/src/glfs-fops.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c
index 0e4acb76bec..605913ae517 100644
--- a/api/src/glfs-fops.c
+++ b/api/src/glfs-fops.c
@@ -388,8 +388,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);
@@ -404,7 +408,7 @@ out:
if (ret && glfd) {
glfs_fd_destroy (glfd);
glfd = NULL;
- } else {
+ } else if (glfd) {
fd_bind (glfd->fd);
glfs_fd_bind (glfd);
}