From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBB97C3F2CD for ; Tue, 3 Mar 2020 14:11:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DD5820866 for ; Tue, 3 Mar 2020 14:11:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="OtwE4L35" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728048AbgCCOLD (ORCPT ); Tue, 3 Mar 2020 09:11:03 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:42180 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726890AbgCCOLC (ORCPT ); Tue, 3 Mar 2020 09:11:02 -0500 Received: by mail-io1-f68.google.com with SMTP id q128so3659152iof.9 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=gHHqSwK/eRsjGeMWJn0cUzSJyit0Ie+wRW3ym34dKrUIhs8PWh4Xx5ZPCEIAkHcrHe a3QFhvJmvBvoKrGai/T39PqYEVmWK4qYHKcvraxx84px6B7KV73aKQ/dD8kF6mJq4ry9 k4gX8X36wmg1QApQL3xE9kh40EgTiJ8tMJb9NGVrRbs88zQjU/wTmVA5UBN+938y8O99 oJfSWGuHUzKfwTTKwNNYIQ1UtowBEWtx7Lvw/fVyQUiLRAQTfPT4fnJELNzMFR11HhSV gJJH1xRY6rZRyCQryx4JnYnADtqpS/NIsvEx/vEsnjNBuftvZ6MVffAU0bRXnOG34+Tg fr+g== X-Gm-Message-State: ANhLgQ14J1Unp+/XeqhWAqvTrPpgUZozzhj8MKYS6TISzJxlOCsIRVqu gEBKWYKgAWcusA/SiyenRVTOZVZTMgUqxF/o/uqCtw== X-Google-Smtp-Source: ADFU+vtLRyHBggE8dM0IQenq5myGtycP6n4bf/pwe+192e1gRcnjD3MAj+3seh4Y8IVdPCMKjFwHFg+xWSJq2cSKwCY= 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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