lkml.org 
[lkml]   [2020]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2020-10-22 18:18    [W:0.112 / U:33.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site