From owner-svn-src-head@FreeBSD.ORG Tue Dec 10 18:18:39 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1497926; Tue, 10 Dec 2013 18:18:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AD58312D0; Tue, 10 Dec 2013 18:18:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBAIId3O055279; Tue, 10 Dec 2013 18:18:39 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBAIId6U055278; Tue, 10 Dec 2013 18:18:39 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201312101818.rBAIId6U055278@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 10 Dec 2013 18:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259183 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2013 18:18:39 -0000 Author: trasz Date: Tue Dec 10 18:18:39 2013 New Revision: 259183 URL: http://svnweb.freebsd.org/changeset/base/259183 Log: Properly refuse handoff requests on already connected sessions. Previously this would result in dropping the session. MFC after: 2 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Tue Dec 10 17:27:11 2013 (r259182) +++ head/sys/dev/iscsi/iscsi.c Tue Dec 10 18:18:39 2013 (r259183) @@ -1247,6 +1247,18 @@ iscsi_ioctl_daemon_handoff(struct iscsi_ sx_sunlock(&sc->sc_lock); return (EINVAL); } + if (is->is_connected) { + /* + * This might have happened because another iscsid(8) + * instance handed off the connection in the meantime. + * Just return. + */ + ISCSI_SESSION_WARN(is, "handoff on already connected " + "session"); + ISCSI_SESSION_UNLOCK(is); + sx_sunlock(&sc->sc_lock); + return (EBUSY); + } strlcpy(is->is_target_alias, handoff->idh_target_alias, sizeof(is->is_target_alias));