From owner-freebsd-net@freebsd.org Thu Jan 19 01:03:36 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C55FCB606D for ; Thu, 19 Jan 2017 01:03:36 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0044.outbound.protection.outlook.com [104.47.33.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BCBEB1683 for ; Thu, 19 Jan 2017 01:03:35 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM (10.165.218.133) by YTXPR01MB0192.CANPRD01.PROD.OUTLOOK.COM (10.165.218.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Thu, 19 Jan 2017 01:03:32 +0000 Received: from YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM ([10.165.218.133]) by YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM ([10.165.218.133]) with mapi id 15.01.0845.014; Thu, 19 Jan 2017 01:03:32 +0000 From: Rick Macklem To: Colin Percival , Konstantin Belousov CC: "freebsd-net@freebsd.org" Subject: Re: sosend returning ERESTART Thread-Topic: sosend returning ERESTART Thread-Index: AQHScXbGB6xwqeuR3ky6twdHVMq016E+x0oAgAAzAvQ= Date: Thu, 19 Jan 2017 01:03:31 +0000 Message-ID: References: <01000159aac969e6-b2fc3913-d04e-42d4-befd-402ed0d830bf-000000@email.amazonses.com> <20170117100634.GS2349@kib.kiev.ua> <01000159afddb7ce-064a5d17-4b81-4b2c-a9b4-3ddd2ad2e377-000000@email.amazonses.com> <20170118103650.GE2349@kib.kiev.ua>, <01000159b390c409-5adcb488-67e8-4038-b9b0-5d4f33460205-000000@email.amazonses.com> In-Reply-To: <01000159b390c409-5adcb488-67e8-4038-b9b0-5d4f33460205-000000@email.amazonses.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rmacklem@uoguelph.ca; x-ms-office365-filtering-correlation-id: 54083a3d-0ea0-47f0-cddf-08d44006fcc4 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:YTXPR01MB0192; x-microsoft-exchange-diagnostics: 1; YTXPR01MB0192; 7:iNAjUezZLooMuawfxHZ+CPq95Z5OPBQTG+6+7F4qg6TUvdhhsngrzEltA4eWSaAHDhmFeewlutG33yAE3wf2aDR3nFY5swl2ubCR0Gufn93RJJ2TP76bANdgSrsE58S6+8JufJ/ZllBa1JzOKF77IsW7e/7f2gO9a9NhngwD9z0a2EqkpeoaD1XdWVuH/YqqMRwiQHJtDib9V0+p8/sXNJhCbzRlDtw1Gx2JaOTm1ImeQIQj6r9NsCtDKkK5OlsKHYgD9H5aYDSfFF1akXdyLyjQqGkuL/FZEIvwonQ1HquecT/+dOW9xBDlA8O50BOrsrm/9n+5Pwrc6thJGjeudVadGTOitAmN1mMLyL3J5qYq/oZ8dwdG2e5iGUWKrelXkKhSG09Dn9L8+DGe11xZl2nCpQa15iksecBiyoaguin9vQYjr9JJqSn4N6zz+aSkK4EjIHpLeL+KFjX01Hs9Og== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:YTXPR01MB0192; BCL:0; PCL:0; RULEID:; SRVR:YTXPR01MB0192; x-forefront-prvs: 0192E812EC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(7916002)(39450400003)(199003)(24454002)(189002)(33656002)(101416001)(81156014)(97736004)(93886004)(92566002)(68736007)(54356999)(105586002)(39060400001)(38730400001)(50986999)(102836003)(76176999)(77096006)(9686003)(55016002)(2900100001)(53936002)(6436002)(6506006)(4326007)(2906002)(106116001)(3280700002)(5001770100001)(8676002)(122556002)(81166006)(2950100002)(5660300001)(106356001)(7116003)(3480700004)(74482002)(3660700001)(305945005)(229853002)(74316002)(189998001)(86362001)(8936002)(7696004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR01MB0192; H:YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2017 01:03:31.9058 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR01MB0192 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jan 2017 01:03:36 -0000 Colin Percival wrote: >On 01/18/17 02:36, Konstantin Belousov wrote: >> On Wed, Jan 18, 2017 at 04:37:40AM +0000, Colin Percival wrote: >>> Thanks, looks like that was exactly it -- if the TCP send buffer was fu= ll >>> we would call sbwait, and if a signal arrived it would return ERESTART. >>> It looks like setting the SB_NOINTR flag will prevent this; I'm testing= a >>> patch right now. >> >> Note that passing SB_NOINTR unconditionally or even only for mounts >> with nointr (default) option is wrong. You make the socket operation >> uninterruptible, process terminate-ability becomes depended on the >> external factor, the behaviour of the remote system. I looked and I think forced dismounts are broken when the thread is stuck i= n sosend(). (It assumes that the threads doing RPCs are waiting for replies.) --> I think this can be fixed by posting a signal to the threads, but only = if SB_NOINTR isn't used. --> As such, I think looping on ERESTART when PCATCH isn't set in ct_waitfl= ag is the better way to go. (At a glance, I think sosend_generic() will f= ail with ERESTART before putting any data in the send queue. For NFS, it uses t= he mbuf list "top" and is always "atomic".) Kostik, Colin has already been testing the looping case. >I'm not sure what you're getting at here. The fact that "NFS mounted with= out >the intr flag" + "unresponsive NFS server" =3D "unkillable processes" has = been >a (mis)feature of NFS for decades. As I already mentioned, I'd like to at least get forced dismounts to work, = rick