From: Vivek Goyal <vgoyal@redhat.com>
To: Liu Bo <bo.liu@linux.alibaba.com>
Cc: virtio-fs@redhat.com
Subject: Re: [Virtio-fs] [PATCH 2/9] virtio-fs: clean up dax mapping before aborting connection
Date: Tue, 16 Apr 2019 14:18:28 -0400 [thread overview]
Message-ID: <20190416181828.GC2222@redhat.com> (raw)
In-Reply-To: <20190416180322.65113-3-bo.liu@linux.alibaba.com>
On Wed, Apr 17, 2019 at 02:03:15AM +0800, Liu Bo wrote:
> fstests generic/127 reported that we failed to remove dax mapping during
> umount,
Is it still a problem with 0.2? I have fixed it by calling
fuse_removemapping_one() only if connection is still there
(fc->connected).
Had talked to miklos in the past and he preferred that virtiofs
daemon should have the capability to clean this up. It might
happen that guest does hard reboot and never cleans up ranges.
I think now David Gilbert has taken care of doing cleanup
on ->init and I think ->destroy as well. Have not looked
at the code closely.
Vivek
>
> -----
> run fstests generic/127 at 2019-03-20 04:54:35
> fuse_removemapping_one request failed -107
> Failed to removemapping. offset=0x200000 len=0x200000
> -----
>
> The root cause:
> virtio_kill_sb
> -> fuse_kill_sb_anon
> -> fuse_sb_destroy
> -> fuse_abort_conn #fiq->connect = 0
> -> kill_anon_super
> -> fuse_evict_inode
> -> fuse_removemapping
> -> fuse_removemapping_one
> # get -ENOTCONN, bail out
>
> Unfortunately we have to make sure that all dax mappings linked in
> per-inode interval tree are moved back to fc->busy_ranges in order to
> avoid mapping leakage.
>
> As we've tracked all dax mappings in fc->busy_ranges, this forces to free
> dax mappings before aborting connection.
>
> Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
> fs/fuse/fuse_i.h | 2 ++
> fs/fuse/inode.c | 9 +++++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index 25e1e50..2c32846 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -1202,4 +1202,6 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value,
> void fuse_dax_free_mem_worker(struct work_struct *work);
> void fuse_removemapping(struct inode *inode);
>
> +int fuse_dax_free_memory(struct fuse_conn *fc, unsigned long nr_to_free);
> +
> #endif /* _FS_FUSE_I_H */
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 6e96613..22d5f6a 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -1378,6 +1378,15 @@ static void fuse_sb_destroy(struct super_block *sb)
> if (fc) {
> fuse_send_destroy(fc);
>
> + /* cleanup dax mapping ranges before aborting connection. */
> + spin_lock(&fc->lock);
> + if (fc->nr_busy_ranges) {
> + spin_unlock(&fc->lock);
> + fuse_dax_free_memory(fc, -1UL);
> + } else {
> + spin_unlock(&fc->lock);
> + }
> +
> fuse_abort_conn(fc, false);
> fuse_wait_aborted(fc);
>
> --
> 1.8.3.1
>
> _______________________________________________
> Virtio-fs mailing list
> Virtio-fs@redhat.com
> https://www.redhat.com/mailman/listinfo/virtio-fs
next prev parent reply other threads:[~2019-04-16 18:18 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 18:03 [Virtio-fs] [PATCH 0/9] virtio-fs fixes Liu Bo
2019-04-16 18:03 ` [Virtio-fs] [PATCH 1/9] virtio-fs: fix multiple tag support Liu Bo
2019-04-16 18:09 ` Vivek Goyal
2019-04-16 18:03 ` [Virtio-fs] [PATCH 2/9] virtio-fs: clean up dax mapping before aborting connection Liu Bo
2019-04-16 18:18 ` Vivek Goyal [this message]
2019-04-16 18:40 ` Liu Bo
2019-04-16 18:03 ` [Virtio-fs] [PATCH 3/9] fuse: export fuse_drop_waiting() Liu Bo
2019-04-16 18:28 ` Vivek Goyal
2019-04-16 18:43 ` Liu Bo
2019-04-16 18:03 ` [Virtio-fs] [PATCH 4/9] virtio-fs: fix use-after-free against virtio_fs_vq's fuse_dev info Liu Bo
2019-04-23 19:51 ` Vivek Goyal
2019-04-25 0:16 ` Liu Bo
2019-04-16 18:03 ` [Virtio-fs] [PATCH 5/9] fuse: do not write whole page while page straddles i_size Liu Bo
2019-04-16 20:16 ` Vivek Goyal
2019-04-17 0:12 ` Liu Bo
2019-04-16 18:03 ` [Virtio-fs] [PATCH 6/9] virtio-fs: let dax style override directIO style when dax+cache=none Liu Bo
2019-04-16 19:38 ` Vivek Goyal
2019-04-17 8:25 ` Miklos Szeredi
2019-04-17 19:35 ` Liu Bo
2019-04-25 18:35 ` Vivek Goyal
2019-04-17 20:56 ` Vivek Goyal
2019-04-22 18:55 ` Liu Bo
2019-04-22 18:14 ` Vivek Goyal
2019-04-16 18:03 ` [Virtio-fs] [PATCH 7/9] fuse: return early if punch_hole fails Liu Bo
2019-04-16 19:51 ` Vivek Goyal
2019-04-16 18:03 ` [Virtio-fs] [PATCH 8/9] virtio-fs: honor RLIMIT_FSIZE in fuse_file_fallocate Liu Bo
2019-04-16 19:57 ` Vivek Goyal
2019-04-16 18:03 ` [Virtio-fs] [PATCH 9/9] fuse: fix deadlock in __fuse_file_fallocate() Liu Bo
2019-04-16 18:07 ` Vivek Goyal
2019-05-02 22:10 ` Liu Bo
2019-05-03 15:22 ` Vivek Goyal
2019-04-24 18:41 ` [Virtio-fs] [PATCH 0/9] virtio-fs fixes Vivek Goyal
2019-04-24 23:12 ` Liu Bo
2019-04-25 14:59 ` Vivek Goyal
2019-04-25 18:10 ` Liu Bo
2019-04-27 0:58 ` Liu Bo
2019-04-29 13:18 ` Vivek Goyal
2019-04-30 1:38 ` Liu Bo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190416181828.GC2222@redhat.com \
--to=vgoyal@redhat.com \
--cc=bo.liu@linux.alibaba.com \
--cc=virtio-fs@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.