diff options
| author | Meghana Madhusudhan <mmadhusu@redhat.com> | 2014-07-29 20:20:13 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2014-08-01 23:30:18 -0700 | 
| commit | 41e2384181e854c06d3a234c2f37aacf9d92f53c (patch) | |
| tree | a01fb180e4701492d4e6058b7ba6e170181f7e91 /api/src/glfs-handleops.c | |
| parent | 61e2ed9d178910fdf7d0499b54601a4191f9cb75 (diff) | |
nfs-ganesha  dumps core when Pynfs tests OPDG1O and OPDG11 are run.
Assgining -1 to ret if fd_create fails. The tests somehow
enter an error case 'if' block (this will be a separate bug fix),
before glfd is created. Need an addiitional check to see
if glfd exists before entering the 'else' block in 'out'.
glfs_h_creat was missing a similar check, adding that in
this bug fix.)
Change-Id: I3b69540c53e8169538848b9e7f23ffc8ef0ac189
BUG: 1121062
Signed-off-by: Meghana Madhusudhan <mmadhusu@redhat.com>
Reviewed-on: http://review.gluster.org/8333
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: soumya k <skoduri@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api/src/glfs-handleops.c')
| -rw-r--r-- | api/src/glfs-handleops.c | 21 | 
1 files changed, 15 insertions, 6 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index 0188128f712..cefe6e3157b 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -490,6 +490,7 @@ glfs_h_open (struct glfs *fs, struct glfs_object *object, int flags)          glfd = glfs_fd_new (fs);          if (!glfd) { +                ret = -1;                  errno = ENOMEM;                  goto out;          } @@ -509,6 +510,10 @@ glfs_h_open (struct glfs *fs, struct glfs_object *object, int flags)          ret = syncop_open (subvol, &loc, flags, glfd->fd);          DECODE_SYNCOP_ERR (ret); +        glfd->fd->flags = flags; +        fd_bind (glfd->fd); +        glfs_fd_bind (glfd); +  out:          loc_wipe (&loc); @@ -518,9 +523,6 @@ out:          if (ret && glfd) {                  glfs_fd_destroy (glfd);                  glfd = NULL; -        } else { -                fd_bind (glfd->fd); -                glfs_fd_bind (glfd);          }          glfs_subvol_done (fs, subvol); @@ -583,8 +585,11 @@ glfs_h_creat (struct glfs *fs, struct glfs_object *parent, const char *path,          GLFS_LOC_FILL_PINODE (inode, loc, ret, errno, out, path);          glfd = glfs_fd_new (fs); -        if (!glfd) -                goto out; +        if (!glfd) { +                 ret = -1; +                 errno = ENOMEM; +                 goto out; +        }          glfd->fd = fd_create (loc.inode, getpid());          if (!glfd->fd) { @@ -617,6 +622,10 @@ glfs_h_creat (struct glfs *fs, struct glfs_object *parent, const char *path,                  ret = glfs_create_object (&loc, &object);          } +        glfd->fd->flags = flags; +        fd_bind (glfd->fd); +        glfs_fd_bind (glfd); +  out:          if (ret && object != NULL) {                  glfs_h_close (object); @@ -631,7 +640,7 @@ out:          if (xattr_req)                  dict_unref (xattr_req); -        if (glfd) { +        if (ret && glfd) {                  glfs_fd_destroy (glfd);                  glfd = NULL;          }  | 
