From owner-svn-src-projects@FreeBSD.ORG Sun Sep 14 09:20:01 2014 Return-Path: Delivered-To: svn-src-projects@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 C748BEC2; Sun, 14 Sep 2014 09:20:01 +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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B30D7BB4; Sun, 14 Sep 2014 09:20:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8E9K1r2092379; Sun, 14 Sep 2014 09:20:01 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8E9K163092377; Sun, 14 Sep 2014 09:20:01 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201409140920.s8E9K163092377@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sun, 14 Sep 2014 09:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271576 - projects/sendfile/sys/kern X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Sep 2014 09:20:01 -0000 Author: glebius Date: Sun Sep 14 09:20:01 2014 New Revision: 271576 URL: http://svnweb.freebsd.org/changeset/base/271576 Log: Simplify hard error handling code. Sponsored by: Netflix Sponsored by: Nginx, Inc. Modified: projects/sendfile/sys/kern/uipc_syscalls.c Modified: projects/sendfile/sys/kern/uipc_syscalls.c ============================================================================== --- projects/sendfile/sys/kern/uipc_syscalls.c Sun Sep 14 09:18:34 2014 (r271575) +++ projects/sendfile/sys/kern/uipc_syscalls.c Sun Sep 14 09:20:01 2014 (r271576) @@ -2932,7 +2932,7 @@ vn_sendfile(struct file *fp, int sockfd, struct shmfd *shmfd; struct vattr va; off_t off, sbytes, rem, obj_size; - int error, serror, bsize, hdrlen; + int error, bsize, hdrlen; obj = NULL; so = NULL; @@ -3211,29 +3211,24 @@ retry_space: CURVNET_SET(so->so_vnet); if (nios == 0) { free(sfio, M_TEMP); - serror = (*so->so_proto->pr_usrreqs->pru_send) + error = (*so->so_proto->pr_usrreqs->pru_send) (so, 0, m, NULL, NULL, td); } else { sfio->sock_fp = sock_fp; sfio->npages = npages; fhold(sock_fp); - serror = (*so->so_proto->pr_usrreqs->pru_send) + error = (*so->so_proto->pr_usrreqs->pru_send) (so, PRUS_NOTREADY, m, NULL, NULL, td); sf_io_done(sfio); } CURVNET_RESTORE(); - if (serror == 0) { - sbytes += space + hdrlen; - if (hdrlen) - hdrlen = 0; - } else if (error == 0) - error = serror; m = NULL; /* pru_send always consumes */ - - /* Quit outer loop on error. */ - if (error != 0) + if (error) goto done; + sbytes += space + hdrlen; + if (hdrlen) + hdrlen = 0; } /*