Displaying 15 results from an estimated 15 matches for "virtio_fs_instances".
2019 Sep 06
2
[PATCH 15/18] virtiofs: Make virtio_fs object refcounted
...io_fs.c
> index 01bbf2c0e144..29ec2f5bbbe2 100644
> --- a/fs/fuse/virtio_fs.c
> +++ b/fs/fuse/virtio_fs.c
> @@ -37,6 +37,7 @@ struct virtio_fs_vq {
>
> /* A virtio-fs device instance */
> struct virtio_fs {
> + struct kref refcount;
> struct list_head list; /* on virtio_fs_instances */
> char *tag;
> struct virtio_fs_vq *vqs;
> @@ -63,6 +64,27 @@ static inline struct fuse_pqueue *vq_to_fpq(struct virtqueue *vq)
> return &vq_to_fsvq(vq)->fud->pq;
> }
>
> +static void release_virtiofs_obj(struct kref *ref)
> +{
> + struct virtio_fs *...
2019 Sep 06
2
[PATCH 15/18] virtiofs: Make virtio_fs object refcounted
...io_fs.c
> index 01bbf2c0e144..29ec2f5bbbe2 100644
> --- a/fs/fuse/virtio_fs.c
> +++ b/fs/fuse/virtio_fs.c
> @@ -37,6 +37,7 @@ struct virtio_fs_vq {
>
> /* A virtio-fs device instance */
> struct virtio_fs {
> + struct kref refcount;
> struct list_head list; /* on virtio_fs_instances */
> char *tag;
> struct virtio_fs_vq *vqs;
> @@ -63,6 +64,27 @@ static inline struct fuse_pqueue *vq_to_fpq(struct virtqueue *vq)
> return &vq_to_fsvq(vq)->fud->pq;
> }
>
> +static void release_virtiofs_obj(struct kref *ref)
> +{
> + struct virtio_fs *...
2019 Sep 06
0
[PATCH 15/18] virtiofs: Make virtio_fs object refcounted
...bbbe2 100644
> > --- a/fs/fuse/virtio_fs.c
> > +++ b/fs/fuse/virtio_fs.c
> > @@ -37,6 +37,7 @@ struct virtio_fs_vq {
> >
> > /* A virtio-fs device instance */
> > struct virtio_fs {
> > + struct kref refcount;
> > struct list_head list; /* on virtio_fs_instances */
> > char *tag;
> > struct virtio_fs_vq *vqs;
> > @@ -63,6 +64,27 @@ static inline struct fuse_pqueue *vq_to_fpq(struct virtqueue *vq)
> > return &vq_to_fsvq(vq)->fud->pq;
> > }
> >
> > +static void release_virtiofs_obj(struct kref *ref...
2019 Sep 05
0
[PATCH 15/18] virtiofs: Make virtio_fs object refcounted
...ff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 01bbf2c0e144..29ec2f5bbbe2 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -37,6 +37,7 @@ struct virtio_fs_vq {
/* A virtio-fs device instance */
struct virtio_fs {
+ struct kref refcount;
struct list_head list; /* on virtio_fs_instances */
char *tag;
struct virtio_fs_vq *vqs;
@@ -63,6 +64,27 @@ static inline struct fuse_pqueue *vq_to_fpq(struct virtqueue *vq)
return &vq_to_fsvq(vq)->fud->pq;
}
+static void release_virtiofs_obj(struct kref *ref)
+{
+ struct virtio_fs *vfs = container_of(ref, struct virtio_fs, ref...
2019 Sep 06
1
[PATCH v4 15/16] virtio-fs: add virtiofs filesystem
...; > > +static int virtio_fs_add_instance(struct virtio_fs *fs)
> > > +{
> > > + struct virtio_fs *fs2;
> > > + bool duplicate = false;
> > > +
> > > + mutex_lock(&virtio_fs_mutex);
> > > +
> > > + list_for_each_entry(fs2, &virtio_fs_instances, list) {
> > > + if (strcmp(fs->tag, fs2->tag) == 0)
> > > + duplicate = true;
> > > + }
> > > +
> > > + if (!duplicate)
> > > + list_add_tail(&fs->list, &virtio_fs_instances);
> >
> >
> > This is O(N^2)...
2019 Sep 03
4
[PATCH v4 15/16] virtio-fs: add virtiofs filesystem
...> +#include <linux/delay.h>
> +#include <linux/fs_context.h>
> +#include <linux/highmem.h>
> +#include "fuse_i.h"
> +
> +/* List of virtio-fs device instances and a lock for the list */
> +static DEFINE_MUTEX(virtio_fs_mutex);
> +static LIST_HEAD(virtio_fs_instances);
> +
> +enum {
> + VQ_HIPRIO,
> + VQ_REQUEST
> +};
> +
> +/* Per-virtqueue state */
> +struct virtio_fs_vq {
> + spinlock_t lock;
> + struct virtqueue *vq; /* protected by ->lock */
> + struct work_struct done_work;
> + struct list_head queued_reqs;
>...
2019 Sep 03
4
[PATCH v4 15/16] virtio-fs: add virtiofs filesystem
...> +#include <linux/delay.h>
> +#include <linux/fs_context.h>
> +#include <linux/highmem.h>
> +#include "fuse_i.h"
> +
> +/* List of virtio-fs device instances and a lock for the list */
> +static DEFINE_MUTEX(virtio_fs_mutex);
> +static LIST_HEAD(virtio_fs_instances);
> +
> +enum {
> + VQ_HIPRIO,
> + VQ_REQUEST
> +};
> +
> +/* Per-virtqueue state */
> +struct virtio_fs_vq {
> + spinlock_t lock;
> + struct virtqueue *vq; /* protected by ->lock */
> + struct work_struct done_work;
> + struct list_head queued_reqs;
>...
2019 Sep 18
0
[PATCH v6] virtio-fs: add virtiofs filesystem
...+#include <linux/highmem.h>
> +#include "fuse_i.h"
> +
> +/* List of virtio-fs device instances and a lock for the list. Also provides
> + * mutual exclusion in device removal and mounting path
> + */
> +static DEFINE_MUTEX(virtio_fs_mutex);
> +static LIST_HEAD(virtio_fs_instances);
> +
> +enum {
> + VQ_HIPRIO,
> + VQ_REQUEST
> +};
> +
> +/* Per-virtqueue state */
> +struct virtio_fs_vq {
> + spinlock_t lock;
> + struct virtqueue *vq; /* protected by ->lock */
> + struct work_struct done_work;
> + struct list_head queued_reqs;
>...
2019 Sep 06
2
[PATCH 16/18] virtiofs: Use virtio_fs_mutex for races w.r.t ->remove and mount path
On Thu, Sep 05, 2019 at 03:48:57PM -0400, Vivek Goyal wrote:
> It is possible that a mount is in progress and device is being removed at
> the same time. Use virtio_fs_mutex to avoid races.
>
> This also takes care of bunch of races and removes some TODO items.
>
> Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
> ---
> fs/fuse/virtio_fs.c | 32
2019 Sep 06
2
[PATCH 16/18] virtiofs: Use virtio_fs_mutex for races w.r.t ->remove and mount path
On Thu, Sep 05, 2019 at 03:48:57PM -0400, Vivek Goyal wrote:
> It is possible that a mount is in progress and device is being removed at
> the same time. Use virtio_fs_mutex to avoid races.
>
> This also takes care of bunch of races and removes some TODO items.
>
> Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
> ---
> fs/fuse/virtio_fs.c | 32
2019 Sep 09
0
[Virtio-fs] [PATCH 15/18] virtiofs: Make virtio_fs object refcounted
...bbbe2 100644
> > --- a/fs/fuse/virtio_fs.c
> > +++ b/fs/fuse/virtio_fs.c
> > @@ -37,6 +37,7 @@ struct virtio_fs_vq {
> >
> > /* A virtio-fs device instance */
> > struct virtio_fs {
> > + struct kref refcount;
> > struct list_head list; /* on virtio_fs_instances */
> > char *tag;
> > struct virtio_fs_vq *vqs;
> > @@ -63,6 +64,27 @@ static inline struct fuse_pqueue *vq_to_fpq(struct virtqueue *vq)
> > return &vq_to_fsvq(vq)->fud->pq;
> > }
> >
> > +static void release_virtiofs_obj(struct kref *ref...
2019 Sep 05
0
[PATCH 16/18] virtiofs: Use virtio_fs_mutex for races w.r.t ->remove and mount path
...gt;
#include "fuse_i.h"
-/* List of virtio-fs device instances and a lock for the list */
+/* List of virtio-fs device instances and a lock for the list. Also provides
+ * mutual exclusion in device removal and mounting path
+ */
static DEFINE_MUTEX(virtio_fs_mutex);
static LIST_HEAD(virtio_fs_instances);
@@ -72,17 +74,19 @@ static void release_virtiofs_obj(struct kref *ref)
kfree(vfs);
}
+/* Make sure virtiofs_mutex is held */
static void virtiofs_put(struct virtio_fs *fs)
{
- mutex_lock(&virtio_fs_mutex);
kref_put(&fs->refcount, release_virtiofs_obj);
- mutex_unlock(&vi...
2019 Sep 05
0
[PATCH v4 15/16] virtio-fs: add virtiofs filesystem
...return -EEXIST if tag name exists*/
> > +static int virtio_fs_add_instance(struct virtio_fs *fs)
> > +{
> > + struct virtio_fs *fs2;
> > + bool duplicate = false;
> > +
> > + mutex_lock(&virtio_fs_mutex);
> > +
> > + list_for_each_entry(fs2, &virtio_fs_instances, list) {
> > + if (strcmp(fs->tag, fs2->tag) == 0)
> > + duplicate = true;
> > + }
> > +
> > + if (!duplicate)
> > + list_add_tail(&fs->list, &virtio_fs_instances);
>
>
> This is O(N^2) as it's presumably called for each istanc...
2019 Sep 06
0
[PATCH 16/18] virtiofs: Use virtio_fs_mutex for races w.r.t ->remove and mount path
...gt;
#include "fuse_i.h"
-/* List of virtio-fs device instances and a lock for the list */
+/* List of virtio-fs device instances and a lock for the list. Also provides
+ * mutual exclusion in device removal and mounting path
+ */
static DEFINE_MUTEX(virtio_fs_mutex);
static LIST_HEAD(virtio_fs_instances);
@@ -72,17 +74,19 @@ static void release_virtio_fs_obj(struct
kfree(vfs);
}
+/* Make sure virtiofs_mutex is held */
static void virtio_fs_put(struct virtio_fs *fs)
{
- mutex_lock(&virtio_fs_mutex);
kref_put(&fs->refcount, release_virtio_fs_obj);
- mutex_unlock(&virtio_fs_...
2019 Sep 05
38
[PATCH 00/18] virtiofs: Fix various races and cleanups round 1
Hi,
Michael Tsirkin pointed out issues w.r.t various locking related TODO
items and races w.r.t device removal.
In this first round of cleanups, I have taken care of most pressing
issues.
These patches apply on top of following.
git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git#virtiofs-v4
I have tested these patches with mount/umount and device removal using
qemu monitor. For