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>
This commit is contained in:
Meghana Madhusudhan 2014-07-29 20:20:13 +05:30 committed by Vijay Bellur
parent 61e2ed9d17
commit 41e2384181

View File

@ -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;
}