From: Vivek Goyal <vgoyal@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: miklos@szeredi.hu, mst@redhat.com, linux-kernel@vger.kernel.org,
virtio-fs@redhat.com, linux-fsdevel@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [Virtio-fs] [PATCH 14/18] virtiofs: Add a fuse_iqueue operation to put() reference
Date: Fri, 6 Sep 2019 09:35:55 -0400 [thread overview]
Message-ID: <20190906133555.GC22083@redhat.com> (raw)
In-Reply-To: <20190906120009.GV5900@stefanha-x1.localdomain>
On Fri, Sep 06, 2019 at 01:00:09PM +0100, Stefan Hajnoczi wrote:
> On Thu, Sep 05, 2019 at 03:48:55PM -0400, Vivek Goyal wrote:
> > diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> > index 85e2dcad68c1..04e2c000d63f 100644
> > --- a/fs/fuse/fuse_i.h
> > +++ b/fs/fuse/fuse_i.h
> > @@ -479,6 +479,11 @@ struct fuse_iqueue_ops {
> > */
> > void (*wake_pending_and_unlock)(struct fuse_iqueue *fiq)
> > __releases(fiq->waitq.lock);
> > +
> > + /**
> > + * Put a reference on fiq_priv.
>
> I'm a bit confused about fiq->priv's role in this. The callback takes
> struct fuse_iqueue *fiq as the argument, not void *priv, so it could
> theoretically do more than just release priv.
>
> I think one of the following would be clearer:
>
> /**
> * Drop a reference to fiq->priv.
> */
> void (*put_priv)(void *priv);
>
> Or:
>
> /**
> * Clean up when fuse_iqueue is destroyed.
> */
> void (*release)(struct fuse_iqueue *fiq);
>
> In the second case fuse_conn_put() shouldn't check fiq->priv.
Hi Stefan,
I like using ->release() method sounds better. Here is the updated patch.
This also changes the next patch, so will post that as well.
Thanks
Vivek
Subject: virtiofs: Add a fuse_iqueue operation to put() reference
Soon I will make virtio_fs object reference counted, where reference will
be taken by device as well as by fuse_conn (fuse_conn->fuse_iqueue->fiq_priv).
When fuse_connection is going away, it should put its reference on virtio_fs
object.
So add a fuse_iqueue method which can be used to call into virtio_fs to
put the reference on the object (fiq_priv).
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
fs/fuse/fuse_i.h | 5 +++++
fs/fuse/inode.c | 4 ++++
2 files changed, 9 insertions(+)
Index: rhvgoyal-linux-fuse/fs/fuse/fuse_i.h
===================================================================
--- rhvgoyal-linux-fuse.orig/fs/fuse/fuse_i.h 2019-09-06 08:46:41.846086544 -0400
+++ rhvgoyal-linux-fuse/fs/fuse/fuse_i.h 2019-09-06 09:24:32.752245246 -0400
@@ -479,6 +479,11 @@ struct fuse_iqueue_ops {
*/
void (*wake_pending_and_unlock)(struct fuse_iqueue *fiq)
__releases(fiq->waitq.lock);
+
+ /**
+ * Cleanup up when fuse_iqueue is destroyed
+ */
+ void (*release)(struct fuse_iqueue *fiq);
};
/** /dev/fuse input queue operations */
Index: rhvgoyal-linux-fuse/fs/fuse/inode.c
===================================================================
--- rhvgoyal-linux-fuse.orig/fs/fuse/inode.c 2019-09-06 08:46:41.847086544 -0400
+++ rhvgoyal-linux-fuse/fs/fuse/inode.c 2019-09-06 09:24:32.754245246 -0400
@@ -631,8 +631,12 @@ EXPORT_SYMBOL_GPL(fuse_conn_init);
void fuse_conn_put(struct fuse_conn *fc)
{
if (refcount_dec_and_test(&fc->count)) {
+ struct fuse_iqueue *fiq = &fc->iq;
+
if (fc->destroy_req)
fuse_request_free(fc->destroy_req);
+ if (fiq->ops->release)
+ fiq->ops->release(fiq);
put_pid_ns(fc->pid_ns);
put_user_ns(fc->user_ns);
fc->release(fc);
WARNING: multiple messages have this Message-ID (diff)
From: Vivek Goyal <vgoyal@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: linux-fsdevel@vger.kernel.org,
virtualization@lists.linux-foundation.org, miklos@szeredi.hu,
linux-kernel@vger.kernel.org, virtio-fs@redhat.com,
dgilbert@redhat.com, mst@redhat.com
Subject: Re: [PATCH 14/18] virtiofs: Add a fuse_iqueue operation to put() reference
Date: Fri, 6 Sep 2019 09:35:55 -0400 [thread overview]
Message-ID: <20190906133555.GC22083@redhat.com> (raw)
In-Reply-To: <20190906120009.GV5900@stefanha-x1.localdomain>
On Fri, Sep 06, 2019 at 01:00:09PM +0100, Stefan Hajnoczi wrote:
> On Thu, Sep 05, 2019 at 03:48:55PM -0400, Vivek Goyal wrote:
> > diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> > index 85e2dcad68c1..04e2c000d63f 100644
> > --- a/fs/fuse/fuse_i.h
> > +++ b/fs/fuse/fuse_i.h
> > @@ -479,6 +479,11 @@ struct fuse_iqueue_ops {
> > */
> > void (*wake_pending_and_unlock)(struct fuse_iqueue *fiq)
> > __releases(fiq->waitq.lock);
> > +
> > + /**
> > + * Put a reference on fiq_priv.
>
> I'm a bit confused about fiq->priv's role in this. The callback takes
> struct fuse_iqueue *fiq as the argument, not void *priv, so it could
> theoretically do more than just release priv.
>
> I think one of the following would be clearer:
>
> /**
> * Drop a reference to fiq->priv.
> */
> void (*put_priv)(void *priv);
>
> Or:
>
> /**
> * Clean up when fuse_iqueue is destroyed.
> */
> void (*release)(struct fuse_iqueue *fiq);
>
> In the second case fuse_conn_put() shouldn't check fiq->priv.
Hi Stefan,
I like using ->release() method sounds better. Here is the updated patch.
This also changes the next patch, so will post that as well.
Thanks
Vivek
Subject: virtiofs: Add a fuse_iqueue operation to put() reference
Soon I will make virtio_fs object reference counted, where reference will
be taken by device as well as by fuse_conn (fuse_conn->fuse_iqueue->fiq_priv).
When fuse_connection is going away, it should put its reference on virtio_fs
object.
So add a fuse_iqueue method which can be used to call into virtio_fs to
put the reference on the object (fiq_priv).
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
fs/fuse/fuse_i.h | 5 +++++
fs/fuse/inode.c | 4 ++++
2 files changed, 9 insertions(+)
Index: rhvgoyal-linux-fuse/fs/fuse/fuse_i.h
===================================================================
--- rhvgoyal-linux-fuse.orig/fs/fuse/fuse_i.h 2019-09-06 08:46:41.846086544 -0400
+++ rhvgoyal-linux-fuse/fs/fuse/fuse_i.h 2019-09-06 09:24:32.752245246 -0400
@@ -479,6 +479,11 @@ struct fuse_iqueue_ops {
*/
void (*wake_pending_and_unlock)(struct fuse_iqueue *fiq)
__releases(fiq->waitq.lock);
+
+ /**
+ * Cleanup up when fuse_iqueue is destroyed
+ */
+ void (*release)(struct fuse_iqueue *fiq);
};
/** /dev/fuse input queue operations */
Index: rhvgoyal-linux-fuse/fs/fuse/inode.c
===================================================================
--- rhvgoyal-linux-fuse.orig/fs/fuse/inode.c 2019-09-06 08:46:41.847086544 -0400
+++ rhvgoyal-linux-fuse/fs/fuse/inode.c 2019-09-06 09:24:32.754245246 -0400
@@ -631,8 +631,12 @@ EXPORT_SYMBOL_GPL(fuse_conn_init);
void fuse_conn_put(struct fuse_conn *fc)
{
if (refcount_dec_and_test(&fc->count)) {
+ struct fuse_iqueue *fiq = &fc->iq;
+
if (fc->destroy_req)
fuse_request_free(fc->destroy_req);
+ if (fiq->ops->release)
+ fiq->ops->release(fiq);
put_pid_ns(fc->pid_ns);
put_user_ns(fc->user_ns);
fc->release(fc);
next prev parent reply other threads:[~2019-09-06 13:35 UTC|newest]
Thread overview: 176+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 19:48 [Virtio-fs] [PATCH 00/18] virtiofs: Fix various races and cleanups round 1 Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] [PATCH 01/18] virtiofs: Remove request from processing list before calling end Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:40 ` Stefan Hajnoczi
2019-09-06 10:40 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:40 ` Stefan Hajnoczi
2019-09-05 19:48 ` [Virtio-fs] [PATCH 02/18] virtiofs: Check whether hiprio queue is connected at submission time Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:43 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:43 ` Stefan Hajnoczi
2019-09-06 10:43 ` Stefan Hajnoczi
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] [PATCH 03/18] virtiofs: Pass fsvq instead of vq as parameter to virtio_fs_enqueue_req Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:44 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:44 ` Stefan Hajnoczi
2019-09-06 10:44 ` Stefan Hajnoczi
2019-09-05 19:48 ` [PATCH 04/18] virtiofs: Check connected state for VQ_REQUEST queue as well Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:45 ` Stefan Hajnoczi
2019-09-06 10:45 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:45 ` Stefan Hajnoczi
2019-09-05 19:48 ` [Virtio-fs] [PATCH 05/18] Maintain count of in flight requests for VQ_REQUEST queue Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:46 ` Stefan Hajnoczi
2019-09-06 10:46 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:46 ` Stefan Hajnoczi
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` [PATCH 06/18] virtiofs: ->remove should not clean virtiofs fuse devices Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:47 ` Stefan Hajnoczi
2019-09-06 10:47 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:47 ` Stefan Hajnoczi
2019-09-05 19:48 ` [Virtio-fs] [PATCH 07/18] virtiofs: Stop virtiofs queues when device is being removed Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:47 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:47 ` Stefan Hajnoczi
2019-09-06 10:47 ` Stefan Hajnoczi
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] [PATCH 08/18] virtiofs: Drain all pending requests during ->remove time Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:52 ` Stefan Hajnoczi
2019-09-06 10:52 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:52 ` Stefan Hajnoczi
2019-09-06 14:17 ` Vivek Goyal
2019-09-06 14:17 ` [Virtio-fs] " Vivek Goyal
2019-09-06 14:17 ` Vivek Goyal
2019-09-06 14:18 ` Michael S. Tsirkin
2019-09-06 14:18 ` [Virtio-fs] " Michael S. Tsirkin
2019-09-06 14:18 ` Michael S. Tsirkin
2019-09-09 16:10 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-09 16:10 ` Stefan Hajnoczi
2019-09-09 16:10 ` Stefan Hajnoczi
2019-09-08 10:11 ` [Virtio-fs] " piaojun
2019-09-08 10:11 ` piaojun
2019-09-05 19:48 ` [PATCH 09/18] virtiofs: Add an helper to start all the queues Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:54 ` Stefan Hajnoczi
2019-09-06 10:54 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:54 ` Stefan Hajnoczi
2019-09-05 19:48 ` [Virtio-fs] [PATCH 10/18] virtiofs: Do not use device managed mem for virtio_fs and virtio_fs_vq Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 10:56 ` Stefan Hajnoczi
2019-09-06 10:56 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:56 ` Stefan Hajnoczi
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` [PATCH 11/18] virtiofs: stop and drain queues after sending DESTROY Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 11:50 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 11:50 ` Stefan Hajnoczi
2019-09-06 11:50 ` Stefan Hajnoczi
2019-09-05 19:48 ` [PATCH 12/18] virtiofs: Use virtio_fs_free_devs() in error path Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 11:51 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 11:51 ` Stefan Hajnoczi
2019-09-06 11:51 ` Stefan Hajnoczi
2019-09-05 19:48 ` [PATCH 13/18] virtiofs: Do not access virtqueue in request submission path Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 11:52 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 11:52 ` Stefan Hajnoczi
2019-09-06 11:52 ` Stefan Hajnoczi
2019-09-05 19:48 ` [PATCH 14/18] virtiofs: Add a fuse_iqueue operation to put() reference Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 12:00 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 12:00 ` Stefan Hajnoczi
2019-09-06 13:35 ` Vivek Goyal [this message]
2019-09-06 13:35 ` Vivek Goyal
2019-09-06 13:35 ` Vivek Goyal
2019-09-06 12:00 ` Stefan Hajnoczi
2019-09-05 19:48 ` [Virtio-fs] [PATCH 15/18] virtiofs: Make virtio_fs object refcounted Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 12:03 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 12:03 ` Stefan Hajnoczi
2019-09-06 13:50 ` Vivek Goyal
2019-09-06 13:50 ` [Virtio-fs] " Vivek Goyal
2019-09-06 13:50 ` Vivek Goyal
2019-09-09 16:12 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-09 16:12 ` Stefan Hajnoczi
2019-09-09 16:12 ` Stefan Hajnoczi
2019-09-06 12:03 ` Stefan Hajnoczi
2019-09-08 11:10 ` [Virtio-fs] " piaojun
2019-09-08 11:10 ` piaojun
2019-09-09 15:35 ` Vivek Goyal
2019-09-09 15:35 ` Vivek Goyal
2019-09-09 15:35 ` Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] [PATCH 16/18] virtiofs: Use virtio_fs_mutex for races w.r.t ->remove and mount path Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 12:05 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 12:05 ` Stefan Hajnoczi
2019-09-06 13:51 ` Vivek Goyal
2019-09-06 13:51 ` [Virtio-fs] " Vivek Goyal
2019-09-06 13:51 ` Vivek Goyal
2019-09-09 16:13 ` Stefan Hajnoczi
2019-09-09 16:13 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-09 16:13 ` Stefan Hajnoczi
2019-09-06 12:05 ` Stefan Hajnoczi
2019-09-08 11:19 ` [Virtio-fs] " piaojun
2019-09-08 11:19 ` piaojun
2019-09-05 19:48 ` Vivek Goyal
2019-09-05 19:48 ` [PATCH 17/18] virtiofs: Remove TODO to quiesce/end_requests Vivek Goyal
2019-09-05 19:48 ` [Virtio-fs] " Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 12:06 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 12:06 ` Stefan Hajnoczi
2019-09-06 12:06 ` Stefan Hajnoczi
2019-09-05 19:48 ` [Virtio-fs] [PATCH 18/18] virtiofs: Remove TODO item from virtio_fs_free_devs() Vivek Goyal
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 12:06 ` Stefan Hajnoczi
2019-09-06 12:06 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 12:06 ` Stefan Hajnoczi
2019-09-05 19:48 ` Vivek Goyal
2019-09-06 8:15 ` [Virtio-fs] [PATCH 00/18] virtiofs: Fix various races and cleanups round 1 Miklos Szeredi
2019-09-06 8:15 ` Miklos Szeredi
2019-09-06 10:36 ` [Virtio-fs] " Stefan Hajnoczi
2019-09-06 10:36 ` Stefan Hajnoczi
2019-09-06 11:52 ` [Virtio-fs] " Miklos Szeredi
2019-09-06 11:52 ` Miklos Szeredi
2019-09-06 12:08 ` Vivek Goyal
2019-09-06 12:08 ` [Virtio-fs] " Vivek Goyal
2019-09-06 12:08 ` Vivek Goyal
2019-09-06 13:55 ` [Virtio-fs] " Miklos Szeredi
2019-09-06 13:55 ` Miklos Szeredi
2019-09-06 13:57 ` [Virtio-fs] " Michael S. Tsirkin
2019-09-06 13:57 ` Michael S. Tsirkin
2019-09-06 13:57 ` Michael S. Tsirkin
2019-09-06 14:11 ` [Virtio-fs] " Miklos Szeredi
2019-09-06 14:11 ` Miklos Szeredi
2019-09-06 14:17 ` Michael S. Tsirkin
2019-09-06 14:17 ` [Virtio-fs] " Michael S. Tsirkin
2019-09-06 14:17 ` Michael S. Tsirkin
2019-09-08 11:53 ` [Virtio-fs] " piaojun
2019-09-08 11:53 ` piaojun
2019-09-09 16:14 ` Stefan Hajnoczi
2019-09-09 16:14 ` Stefan Hajnoczi
2019-09-09 16:18 ` Michael S. Tsirkin
2019-09-09 16:18 ` Michael S. Tsirkin
2019-09-09 16:18 ` Michael S. Tsirkin
2019-09-09 23:52 ` piaojun
2019-09-09 23:52 ` piaojun
2019-09-09 16:14 ` Stefan Hajnoczi
2019-09-06 10:36 ` Stefan Hajnoczi
2019-09-06 13:37 ` [Virtio-fs] " Michael S. Tsirkin
2019-09-06 13:37 ` Michael S. Tsirkin
2019-09-06 13:37 ` Michael S. Tsirkin
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=20190906133555.GC22083@redhat.com \
--to=vgoyal@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mst@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtio-fs@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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.