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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 7BEF7C388F7 for ; Thu, 22 Oct 2020 16:17:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DD4B208B6 for ; Thu, 22 Oct 2020 16:17:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=android.com header.i=@android.com header.b="iCpyZf3v" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2896713AbgJVQRu (ORCPT ); Thu, 22 Oct 2020 12:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2896698AbgJVQRt (ORCPT ); Thu, 22 Oct 2020 12:17:49 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69823C0613CF for ; Thu, 22 Oct 2020 09:17:49 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id c77so2743221wmd.4 for ; Thu, 22 Oct 2020 09:17:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=an4HM7viF76dg/BBOcet2kiSOHM3LCjyzxKusN4Cnjw=; b=iCpyZf3v2xE9KHsfzUXVGtoriEuj7sXoIkHaAXOraSZIN2rY9cfiHSmSg7CoZtrn+P 9nFFLzFZlRx81Z6UnMlmBMyZyaqgsY34PthTnZYTWfuoZSOGZ0GQ6ulipbK4JDi/hfZr REAHdX0+4+sPPh3iZRFpEm6RETOAqGop2Gq1aqAd2/5Q8KBsp2iyTgf1D7U44s0jaZwQ zAWHVvyW9U+UW/58Uosnlt1mnxWM8CTBdo+s8M4lA3zwJvd/6+eyMWcpqRstUT2++IVP DIdJQUg1tUkOIiDaY0ztAr/vt5j2k5UFsFTNmigIB3IbSFm+2JoYp2W1SLuoqJ4WNHjR GlSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=an4HM7viF76dg/BBOcet2kiSOHM3LCjyzxKusN4Cnjw=; b=aHxr5YUyiWtZxT+Z2F37Y4IqbL+IXRMjgwqTsyODlBgwgzDGva6EQv4GRAq9qu65pv UWZBFEwW3wLJhaF5rqJTVhBUWyUNdHkjF0XBHMMVuWLJDB7HuVoHrt/Yxb6IVEqVIPHx RhyLAKwaNIfRTKsWqC8J/K3FKXkwwajV/vDzdPt6xZuj5sOgBRWQYViAxtsShBWXOnK4 bEfXhaFYgWXZ844M8QYS2R6u0JJnyePvlaXg5wBggwg3m7LjAzcvjqFEZCnws/J0wZWV khpbrvQ+WQcJb3NB0lWXhJIOI16baYWYCHQecePHRCdArUlN+2GPThYsrWbaaH2I0Rze 2Tjg== X-Gm-Message-State: AOAM532iJpR50ZQcSmFGnz5WePc0J4bpMcz1FzLDDCqoffukb/nDTTNj 2Ydl6QZO9h/YpoUFDmJcWHp8Pw== X-Google-Smtp-Source: ABdhPJw8L1B7TdR0f5aXqfG0EAiugB4+Afdb5e50ZlRsr4MLvNkoFdhvzOvRCWDKNky9BAc37nuSIQ== X-Received: by 2002:a7b:c143:: with SMTP id z3mr3456794wmi.17.1603383468056; Thu, 22 Oct 2020 09:17:48 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:7220:84ff:fe09:7d5c]) by smtp.gmail.com with ESMTPSA id s5sm4243186wmc.3.2020.10.22.09.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 09:17:47 -0700 (PDT) Date: Thu, 22 Oct 2020 17:17:45 +0100 From: Alessio Balsini To: Miklos Szeredi Cc: Alessio Balsini , Akilesh Kailash , Amir Goldstein , Antonio SJ Musumeci , David Anderson , Giuseppe Scrivano , Jann Horn , Jens Axboe , Martijn Coenen , Palmer Dabbelt , Paul Lawrence , Stefano Duo , Zimuzo Ezeozue , fuse-devel , kernel-team , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V9 3/4] fuse: Introduce synchronous read and write for passthrough Message-ID: <20201022161745.GC36774@google.com> References: <20200924131318.2654747-1-balsini@android.com> <20200924131318.2654747-4-balsini@android.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 30, 2020 at 08:50:46PM +0200, Miklos Szeredi wrote: > > [...] > > +ssize_t fuse_passthrough_read_iter(struct kiocb *iocb_fuse, > > + struct iov_iter *iter) > > +{ > > + ssize_t ret; > > + const struct cred *old_cred; > > + struct file *fuse_filp = iocb_fuse->ki_filp; > > + struct fuse_file *ff = fuse_filp->private_data; > > + struct file *passthrough_filp = ff->passthrough_filp; > > + > > + if (!iov_iter_count(iter)) > > + return 0; > > + > > + old_cred = fuse_passthrough_override_creds(fuse_filp); > > + if (is_sync_kiocb(iocb_fuse)) { > > + ret = vfs_iter_read(passthrough_filp, iter, &iocb_fuse->ki_pos, > > + iocbflags_to_rwf(iocb_fuse->ki_flags)); > > + } else { > > + ret = -EIO; > > + } > > Just do vfs_iter_read() unconditionally, instead of returning EIO. > It will work fine, except it won't be async. > > Yeah, I know next patch is going to fix this, but still, lets not make > this patch return silly errors. > > > [...] > > +ssize_t fuse_passthrough_write_iter(struct kiocb *iocb_fuse, > > + struct iov_iter *iter) > > +{ > > + ssize_t ret; > > + const struct cred *old_cred; > > + struct file *fuse_filp = iocb_fuse->ki_filp; > > + struct fuse_file *ff = fuse_filp->private_data; > > + struct inode *fuse_inode = file_inode(fuse_filp); > > + struct file *passthrough_filp = ff->passthrough_filp; > > + > > + if (!iov_iter_count(iter)) > > + return 0; > > + > > + inode_lock(fuse_inode); > > + > > + old_cred = fuse_passthrough_override_creds(fuse_filp); > > + if (is_sync_kiocb(iocb_fuse)) { > > + file_start_write(passthrough_filp); > > + ret = vfs_iter_write(passthrough_filp, iter, &iocb_fuse->ki_pos, > > + iocbflags_to_rwf(iocb_fuse->ki_flags)); > > + file_end_write(passthrough_filp); > > + if (ret > 0) > > + fuse_copyattr(fuse_filp, passthrough_filp); > > + } else { > > + ret = -EIO; > > + } > > And the same here. > Ack, adding both to the upcoming patch set. Thanks, Alessio