From owner-freebsd-current@freebsd.org Thu Mar 23 00:55:13 2017 Return-Path: Delivered-To: freebsd-current@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 A2F92D16C5D for ; Thu, 23 Mar 2017 00:55:13 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670075.outbound.protection.outlook.com [40.107.67.75]) (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 57FF01692; Thu, 23 Mar 2017 00:55:12 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM (10.165.218.133) by YTXPR01MB0191.CANPRD01.PROD.OUTLOOK.COM (10.165.218.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Thu, 23 Mar 2017 00:55:09 +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.0977.020; Thu, 23 Mar 2017 00:55:09 +0000 From: Rick Macklem To: Konstantin Belousov CC: Dimitry Andric , Ian Lepore , "Gergely Czuczy" , FreeBSD Current Subject: Re: process killed: text file modification Thread-Topic: process killed: text file modification Thread-Index: AQHSnqPLfXcZwdtVHkecT5jK6Yv9dKGYQJIXgAAZ/baAAFsxgIAAVqF+gAAJQ4CAAFvPgIAAF1PPgABnggCAArMZZIABrxcAgAA8zEOAAQwZgIAAO42ggACmOICAASAVyw== Date: Thu, 23 Mar 2017 00:55:09 +0000 Message-ID: References: <20170317141917.GS16105@kib.kiev.ua> <20170318032150.GW16105@kib.kiev.ua> <20170320221818.GM43712@kib.kiev.ua> <20170321175527.GN43712@kib.kiev.ua> , <20170322072331.GQ43712@kib.kiev.ua> In-Reply-To: <20170322072331.GQ43712@kib.kiev.ua> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: FreeBSD.org; dkim=none (message not signed) header.d=none;FreeBSD.org; dmarc=none action=none header.from=uoguelph.ca; x-microsoft-exchange-diagnostics: 1; YTXPR01MB0191; 7:DwUosu4ujl4p2XGMU8Q2rg9ZAPzzYEO2kvWfomIkaFfWHV5y6PGvSzolr4AtTScbr4z9zPwZUjUZMM9I0VhmerYr/m+vx/b9QPCAnoBTjIH4t7iR0azvLeWFKiWV6rCgoVlqogR2vaWJjMhF/ROKdubNHaj0dNowBNespKPnNBIwHJQpRczzjKNOU105PqwbqcPYw17yusLo8yKXQ5LuaGspnFZtsvFZt0Lwzj+KG6f+mArbsX7/8q68+BBikhBZnkpufme/+XMJbM1A+oPopsQ/TZKIcMYTwPmgde4CorSPp0ZdMA9I1BAQgSYt5xNsb9qNPEyTEQfqAvE40vKo5Q== x-ms-office365-filtering-correlation-id: 578082cd-8ec8-44be-adea-08d471874161 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075); SRVR:YTXPR01MB0191; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(788757137089); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123555025)(20161123558025)(20161123564025)(20161123562025)(20161123560025)(6072148); SRVR:YTXPR01MB0191; BCL:0; PCL:0; RULEID:; SRVR:YTXPR01MB0191; x-forefront-prvs: 0255DF69B9 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39410400002)(39450400003)(39830400002)(24454002)(74482002)(55016002)(7696004)(25786009)(229853002)(2900100001)(3660700001)(77096006)(54906002)(9686003)(3280700002)(6506006)(86362001)(6436002)(6916009)(2950100002)(102836003)(1411001)(189998001)(122556002)(8936002)(81166006)(305945005)(6246003)(2906002)(33656002)(5660300001)(76176999)(39060400002)(54356999)(4326008)(8676002)(50986999)(74316002)(38730400002)(93886004)(110136004)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR01MB0191; H:YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; 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: 23 Mar 2017 00:55:09.6185 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR01MB0191 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Mar 2017 00:55:13 -0000 Konstantin Belousov wrote: [stuff snipped] > Below is something to discuss. This is not finished, but it worked for > the simple tests I performed. Clustering should be somewhat handled by > the ncl_write() as is. As an additional advantage, I removed the now > unneeded phys buffer allocation. > > If you agree with the approach on principle, I want to ask what to do > about the commit stuff there (I simply removed that for now). Wow, this is looking good to me. I had thought that the simple way to make ncl_putpages() go through the buffer cache was to replace ncl_writerpc() wi= th VOP_WRITE(). My concern was all the memory<->memory copying that would go on between the pages being written and the buffers allocated by VOP_WRIT= E(). If there is a way to avoid some (if not all) of this memory<->memory copyin= g, then I think it would be a big improvement.. As far as the commit goes, you don't need to do anything if you are calling= VOP_WRITE(). (The code below VOP_WRITE() takes care of all of that.) --> You might want to implement a function like nfs_write(), but with extra= arguments. If you did that, you could indicate when you want the writes to happe= n synchronously vs. async/delayed and that would decide when FILESYNC would be specif= ied. As far as I know, the unpatched nc_putpages() is badly broken for the UNSTA= BLE/commit case. For UNSTABLE writes, the client is supposed to know how to write the = data again if the server crashes/reboots before a Commit RPC is successfully done for = the data. (The ncl_clearcommit() function is the one called when the server indicates= it has rebooted and needs this. It makes no sense whatsoever and breaks the clien= t to call it in ncl_putpages() when mustcommit is set. All mustcommit being set indi= cates is that the write RPC was done UNSTABLE and the above applies to it. Some ser= vers always do FILESYNC, so it isn't ever necessary to do a Commit PRC or redo the wri= te RPCs.) Summary. If you are calling VOP_WRITE() or a similar call above the buffer = cache, then you don't have to worry about any of this. > Things that needs to be done is to add missed handling of the IO flags to > ncl_write(). > + if (error =3D=3D 0 || !nfs_keep_dirty_on_error) > vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_= resid); If the data isn't copied, will this data still be available to the NFS buff= er cache code, so that it can redo the writes for the UNSTABLE case, if the server reboots= before a Commit RPC has succeeded? > - if (must_commit) > - ncl_clearcommit(vp->v_mount); No matter what else we do, this should go away. As above, it breaks the NFS= client and basically forces all dirty buffer cache blocks to be rewritten when it = shouldn't be necessary. rick=