Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3446343ybf; Tue, 3 Mar 2020 06:13:59 -0800 (PST) X-Google-Smtp-Source: ADFU+vtSPhgAVj/vO998RcozmpswukShkwfBmE2RxWFo+rGCzCf5puZjvz2zKBguzri5CYfn0tlS X-Received: by 2002:aca:4fd5:: with SMTP id d204mr2506907oib.76.1583244839558; Tue, 03 Mar 2020 06:13:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583244839; cv=none; d=google.com; s=arc-20160816; b=z/fROnQ3GvfibOhmvqJXHuSFpig0wXH2NmGNUAAjqRJV3C+Q/3KgrQjeUsVFi53EKJ FPmVt1NUJvrAEGOuC0Yjh4Ju2XWWA0v3jYqfWf7aBvLGX4W7PlsYXhe97FyrqNNGzQO1 zGxv1LpKuxxxLM5S5SQ4ckdXNbkk30quqIZNypguQ8gcJpP3cB+QTTpUgGQUt6p22FWm 7+bXAyj43t4l5MOhVC0uwWQab1j1L4Zy0rRtz97Z6BF8W2d4CFRZ2JcysnScr6jYrHSk zKwZtmgBgFa2ZTFsBWjFsvNhxsqHN3ikzC3hYgpnNWbt+/LFPim9hYVHJNJlCuRY78Fb LLyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=mTx2plxg9Df6IflSHbJKT5bYL5iIl+THZm0QXJzfcTo=; b=CsRnQ0upBj43xC0Gq62KpnHXaX50Jbck/hwoyNH+Cmk/0UugufMfWqn8O4t1GKhEif EQnlxWPRqcp+sMNSMna0LCBjTbPO2zugmAdjWONTZ0phsk4hEeyLnpDuXdDApLpGeVzY B3Mbp6UvbKgGLRAOtNDW9LGyeL0WbsPoXoHumwlsMELUHl+jVLR9ubvz+roWJ7T3kmof MsiRLig7Lh3Ac00jVCAT1nJfNQq5WfF1mm/63Hj5tCYdHU1NZDc+SOI3iMP9yoBDJClU 5Hg+Wn4MEYM6O5XefTPFuDmlUhyj0cADNom+cSZCc3geR9n2FAcvgp05qW3mkmiVbwjl lPFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=OtwE4L35; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a185si6513713oii.252.2020.03.03.06.13.42; Tue, 03 Mar 2020 06:13:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=OtwE4L35; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728368AbgCCOLE (ORCPT + 99 others); Tue, 3 Mar 2020 09:11:04 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:37648 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727604AbgCCOLD (ORCPT ); Tue, 3 Mar 2020 09:11:03 -0500 Received: by mail-io1-f68.google.com with SMTP id c17so3709879ioc.4 for ; Tue, 03 Mar 2020 06:11:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mTx2plxg9Df6IflSHbJKT5bYL5iIl+THZm0QXJzfcTo=; b=OtwE4L35EOBWYLiqou7S0JQAG1/jjvkjvAnIQCw4HxRHQWuqRBJNy7eTtdd1KFu4gY ynNB7Dm+GKQK5xP0ltYldY9reVYrX99cEQjv5EP8Q77AlruXFxhAM01FlqxVUJHbNfpj 57B4N00jJ4X+t4XZ8dFG62Jfh9BDAa3By5KO0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mTx2plxg9Df6IflSHbJKT5bYL5iIl+THZm0QXJzfcTo=; b=sJEcupZ0E6VVhZ5Lih1rLjbMKXrKpMYdWV9PbbLDawOLX+2DPDWGNFqtO/5Pl5AMev 2mpNTIZHzifGQZp4r1NxabqBxyZi0IL0TSNJCnvGZqtOO29TJPC/99EXyHEfM41fYAJJ 7RIszq+KVpK9lOblhRFIZolaA9KGyI08+YwpxhCwQshpfFuIpg/uz2HOnA8w3ADd4LdZ nzBLZcys0hpzDis0goWa5momuMYcQxZH87X+5jZOj2yiAjilnhk/yN2Xra3MjjQt73HP W4f+Ik6Y7+Isv7xhmiFlh1jhJk88mXwoFV87hv4UEI00/pkVMm7EFSQSDKVEyHX2zfYm IBGg== X-Gm-Message-State: ANhLgQ0Bw+xomLqmqm5g9dfGkkbGyLEy3QBjwNa+3wVhhUzmkDsnE30e phbir/ttqzGjTfHMVLI/haYp9KhpenxhBbXeP4hEiQ== X-Received: by 2002:a02:9f04:: with SMTP id z4mr1393539jal.35.1583244662034; Tue, 03 Mar 2020 06:11:02 -0800 (PST) MIME-Version: 1.0 References: <107666.1582907766@warthog.procyon.org.uk> <0403cda7345e34c800eec8e2870a1917a8c07e5c.camel@themaw.net> <1509948.1583226773@warthog.procyon.org.uk> <20200303113814.rsqhljkch6tgorpu@ws.net.home> <20200303130347.GA2302029@kroah.com> <20200303131434.GA2373427@kroah.com> <20200303134316.GA2509660@kroah.com> In-Reply-To: <20200303134316.GA2509660@kroah.com> From: Miklos Szeredi Date: Tue, 3 Mar 2020 15:10:50 +0100 Message-ID: Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] To: Greg Kroah-Hartman Cc: Karel Zak , David Howells , Ian Kent , Christian Brauner , James Bottomley , Steven Whitehouse , Miklos Szeredi , viro , Christian Brauner , Jann Horn , "Darrick J. Wong" , Linux API , linux-fsdevel , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 3, 2020 at 2:43 PM Greg Kroah-Hartman wrote: > > On Tue, Mar 03, 2020 at 02:34:42PM +0100, Miklos Szeredi wrote: > > If buffer is too small to fit the whole file, return error. > > Why? What's wrong with just returning the bytes asked for? If someone > only wants 5 bytes from the front of a file, it should be fine to give > that to them, right? I think we need to signal in some way to the caller that the result was truncated (see readlink(2), getxattr(2), getcwd(2)), otherwise the caller might be surprised. > > > Verify that the number of bytes read matches the file size, otherwise > > return error (may need to loop?). > > No, we can't "match file size" as sysfs files do not really have a sane > "size". So I don't want to loop at all here, one-shot, that's all you > get :) Hmm. I understand the no-size thing. But looping until EOF (i.e. until read return zero) might be a good idea regardless, because short reads are allowed. Thanks, Miklos