[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201022161745.GC36774@google.com>
Date: Thu, 22 Oct 2020 17:17:45 +0100
From: Alessio Balsini <balsini@...roid.com>
To: Miklos Szeredi <miklos@...redi.hu>
Cc: Alessio Balsini <balsini@...roid.com>,
Akilesh Kailash <akailash@...gle.com>,
Amir Goldstein <amir73il@...il.com>,
Antonio SJ Musumeci <trapexit@...wn.link>,
David Anderson <dvander@...gle.com>,
Giuseppe Scrivano <gscrivan@...hat.com>,
Jann Horn <jannh@...gle.com>, Jens Axboe <axboe@...nel.dk>,
Martijn Coenen <maco@...roid.com>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Lawrence <paullawrence@...gle.com>,
Stefano Duo <stefanoduo@...gle.com>,
Zimuzo Ezeozue <zezeozue@...gle.com>,
fuse-devel <fuse-devel@...ts.sourceforge.net>,
kernel-team <kernel-team@...roid.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V9 3/4] fuse: Introduce synchronous read and write for
passthrough
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
Powered by blists - more mailing lists