Re: [External] [PATCH v13 08/10] fuse: update inode size/mtime after passthrough write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 25, 2023 at 9:41 AM Zhang Tianci
<zhangtianci.1997@xxxxxxxxxxxxx> wrote:
>
> On Fri, May 19, 2023 at 8:59 PM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> >
> > Similar to update size/mtime at the end of fuse_perform_write(),
> > we need to bump the attr version when we update the inode size.
> >
> > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
> > ---
> >  fs/fuse/passthrough.c | 53 ++++++++++++++++++++++++++++++++++---------
> >  1 file changed, 42 insertions(+), 11 deletions(-)
> >
> > diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c
> > index 10b370bcc423..8352d6b91e0e 100644
> > --- a/fs/fuse/passthrough.c
> > +++ b/fs/fuse/passthrough.c
> > @@ -14,15 +14,42 @@ struct fuse_aio_req {
> >         struct kiocb *iocb_fuse;
> >  };
> >
> > -static void fuse_aio_cleanup_handler(struct fuse_aio_req *aio_req)
> > +static void fuse_file_start_write(struct file *fuse_file,
> > +                                 struct file *backing_file,
> > +                                 loff_t pos, size_t count)
> > +{
> > +       struct inode *inode = file_inode(fuse_file);
> > +       struct fuse_inode *fi = get_fuse_inode(inode);
> > +
> > +       if (inode->i_size < pos + count)
> > +               set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
> > +
> > +       file_start_write(backing_file);
> > +}
> > +
> > +static void fuse_file_end_write(struct file *fuse_file,
> > +                               struct file *backing_file,
> > +                               loff_t pos, ssize_t res)
> > +{
> > +       struct inode *inode = file_inode(fuse_file);
> > +       struct fuse_inode *fi = get_fuse_inode(inode);
> > +
> > +       file_end_write(backing_file);
> > +
> > +       fuse_write_update_attr(inode, pos, res);
>
> Hi Amir,
> This function(fuse_file_end_write) will execute in interrupt context, but
> fuse_write_update_attr() uses fuse_inode->lock, this will cause soft lockup.
>
> So we may have to change all the fuse_inode->lock usage to fixup this bug, but
> I think this is one ugly resolution.
>
> Or why should we do aio_clearup_handler()? What is the difference between
> fuse_passthrough_write_iter() with ovl_write_iter()?
>

[CC Jens and Christian]

Heh, very good question.
Does this answer your question:

https://lore.kernel.org/linux-unionfs/20230912173653.3317828-2-amir73il@xxxxxxxxx/

I queued this patch to overlayfs for 6.7, because I think overlayfs
has a bug that can manifest with concurrent aio completions.

For people who just joined, this is a patch review of the
FUSE passthrough feature, which is expected to share the
common "kiocb_clone" io passthrough helpers with overlayfs.

Jens,

Are there any IOCB flags that overlayfs (or backing_aio) need
to set or clear, besides IOCB_DIO_CALLER_COMP, that
would prevent calling completion from interrupt context?

Or is the proper way to deal with this is to defer completion
to workqueue in the common backing_aio helpers that
I am re-factoring from overlayfs?

IIUC, that could also help overlayfs support
IOCB_DIO_CALLER_COMP?

Is my understanding correct?

Thanks,
Amir.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux