Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2207945pxb; Mon, 11 Jan 2021 04:01:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAGEOJd+ElxdgCR37HR/6V7ZTBbWczu8p+z16IwCfTtjAzqDlru9hmlQ5QD0vwp29TqDZn X-Received: by 2002:a17:907:101c:: with SMTP id ox28mr9800691ejb.201.1610366515730; Mon, 11 Jan 2021 04:01:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610366515; cv=none; d=google.com; s=arc-20160816; b=VF7E533H3kycrMCc5wlagYYh9ZRYxbXb/7SW2hvBGGSBFYddcony5Rx+GcZ2HJEF/N F8+JN/p2emGqwHz/fKX/eXYovaZGgcFGQotu0BRkFbtsu/sWMQpJjj82k8F8kkFYOyhf YYv8scKinaNvJuS54tquZcPCnbJpDRXMEH7BqaSVEvXjE3w46Hc9DMwylxZRYBxY7V5J JA9u5K7ZiGKoHyVFiW+TBAWjiZ/0rZ9ZVLgYIt6/TOQ3IZBh+QqD8i6HIU3gAdLON49R g4mF9aM3vmaGLm1gN2LPe9OkME98pVLMCfUQWYYdUqp65Z5IBf3A/y5XgxL59g7Hh4DH 306A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=HN3SMW8XESVzYmJEjrcclKcCumS0DE8Gpr9T7WqR2Lg=; b=rWjyHskP6CkXX6/DYQs5VMqa5TMmskk54zW58Bso2SL4p+OPvncbb0JtKU8bW07hQ7 bypFYs770E0MvbxlehL1lkgXrzdIqWMOp8hum+FkCcmnQ+Ioo1fzUxkrJj5RRzjod/pN sR71e9AGshdvVM7E0uwla93OIK1xRcF2txAQ3zUt40x14lsK6DcLk2Lp/YIPiVVmme9b jkUie/fT0uvec5vmE36g+3AIdnnxSkOsGJ6ZYXD5cMi34WO4iOlLBmwy/LPeq5DhOSwW JMuZKCJ5pKle3dEgXFWSO31TF/TzR8G+xpnAKm2gUY/T0BPUik8wS3jYkuicVz+BQEQ2 Pm/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si6380659eja.318.2021.01.11.04.01.31; Mon, 11 Jan 2021 04:01:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729616AbhAKL6v convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Jan 2021 06:58:51 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:42454 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726422AbhAKL6v (ORCPT ); Mon, 11 Jan 2021 06:58:51 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-37-qTe83McBMiCWIf7m7BZI6A-1; Mon, 11 Jan 2021 11:57:11 +0000 X-MC-Unique: qTe83McBMiCWIf7m7BZI6A-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 11 Jan 2021 11:57:08 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Mon, 11 Jan 2021 11:57:08 +0000 From: David Laight To: 'Mikulas Patocka' CC: 'Al Viro' , Andrew Morton , Dan Williams , "Vishal Verma" , Dave Jiang , "Ira Weiny" , Matthew Wilcox , Jan Kara , Steven Whitehouse , Eric Sandeen , Dave Chinner , Theodore Ts'o , Wang Jianchao , "Kani, Toshi" , "Norton, Scott J" , "Tadakamadla, Rajesh" , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-nvdimm@lists.01.org" Subject: RE: [RFC v2] nvfs: a filesystem for persistent memory Thread-Topic: [RFC v2] nvfs: a filesystem for persistent memory Thread-Index: AQHW52zcFLyucqAcQUmnqwhwPozPcaoiOfvQgAAVUICAAALF8A== Date: Mon, 11 Jan 2021 11:57:08 +0000 Message-ID: <57dad96341d34822a7943242c9bcad71@AcuMS.aculab.com> References: <20210110162008.GV3579531@ZenIV.linux.org.uk> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka > Sent: 11 January 2021 11:44 > On Mon, 11 Jan 2021, David Laight wrote: > > > From: Al Viro On Behalf Of Al Viro > > > Sent: 10 January 2021 16:20 ... ... > > > while (iov_iter_count(to)) { ... > > > size = copy_to_iter(to, ptr, size); > > > if (unlikely(!size)) { > > > r = -EFAULT; > > > goto ret_r; > > > } > > > > > > pos += size; > > > total += size; > > > } while (iov_iter_count(to)); > > > > That isn't the best formed loop! > > > > David > > I removed the second "while" statement and fixed the arguments to > copy_to_iter - other than that, Al's function works. The extra while is easy to write and can be difficult to spot. I've found them looking as the object code before now! Oh - the error return for copy_to_iter() is wrong. It should (probably) return 'total' if it is nonzero. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)