From 08041c321229bdfb2cbe1b638fb4fabb0b9da013 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Mon, 12 Sep 2011 15:14:26 +0530 Subject: protocol/client : prevent client from reconnecting when server authentication fails This prevents the client from trying to reconnect on server authentication failure. Reconnecting on authentcation failure causes hung mounts on unauthorised clients. This patch fixes this problem. Also, mount.glusterfs script unmounts mount-point on mount failure to prevent hung mounts. Change-Id: I5615074d27948077bad491a38cecae1b7f5159fb BUG: 765240 Signed-off-by: Kaushal M Reviewed-on: http://review.gluster.com/398 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- xlators/mount/fuse/src/fuse-bridge.c | 14 ++++++++++++++ xlators/mount/fuse/utils/mount.glusterfs.in | 1 + 2 files changed, 15 insertions(+) (limited to 'xlators/mount/fuse') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 7ced17831..72bb1b157 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -22,6 +22,8 @@ static int gf_fuse_conn_err_log; static int gf_fuse_xattr_enotsup_log; +void fini (xlator_t *this_xl); + fuse_fd_ctx_t * __fuse_fd_ctx_check_n_create (fd_t *fd, xlator_t *this) { @@ -3885,6 +3887,14 @@ notify (xlator_t *this, int32_t event, void *data, ...) break; } + case GF_EVENT_AUTH_FAILED: + { + /* Authentication failure is an error and glusterfs should stop */ + gf_log (this->name, GF_LOG_ERROR, "Server authenication failed. Shutting down."); + fini (this); + break; + } + default: break; } @@ -4249,6 +4259,10 @@ fini (xlator_t *this_xl) gf_fuse_unmount (mount_point, priv->fd); close (priv->fuse_dump_fd); } + /* Process should terminate once fuse xlator is finished. + * Required for AUTH_FAILED event. + */ + raise (SIGTERM); } struct xlator_fops fops = { diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index daf8ba92b..40bf48150 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -162,6 +162,7 @@ start_glusterfs () if [ $err -eq "1" ]; then echo "Mount failed. Please check the log file for more details." + umount $mount_point > /dev/null 2>&1; exit 1; fi } -- cgit