linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: lepton <ytht.net@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: miklos@szeredi.hu
Subject: Re: [PATCH] fuse: Add filesystem attribute in sysfs control dir.
Date: Mon, 15 Aug 2022 15:54:53 -0700	[thread overview]
Message-ID: <CALqoU4xbA5GbLxZOtGJO5Vv6z_XL9jhjWMTPbqEzS8-4mb8z+Q@mail.gmail.com> (raw)
In-Reply-To: <20200728234513.1956039-1-ytht.net@gmail.com>

On Tue, Jul 28, 2020 at 4:45 PM Lepton Wu <ytht.net@gmail.com> wrote:
>
> With this, user space can have more control to just abort some kind of
> fuse connections. Currently, in Android, it will write to abort file
> to abort all fuse connections while in some cases, we'd like to keep
> some fuse connections. This can help that.
>
> Signed-off-by: Lepton Wu <ytht.net@gmail.com>
> ---
>  fs/fuse/control.c | 31 ++++++++++++++++++++++++++++++-
>  fs/fuse/fuse_i.h  |  2 +-
>  2 files changed, 31 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/control.c b/fs/fuse/control.c
> index c23f6f243ad42..85a56d2de50d5 100644
> --- a/fs/fuse/control.c
> +++ b/fs/fuse/control.c
> @@ -64,6 +64,27 @@ static ssize_t fuse_conn_waiting_read(struct file *file, char __user *buf,
>         return simple_read_from_buffer(buf, len, ppos, tmp, size);
>  }
>
> +static ssize_t fuse_conn_file_system_read(struct file *file, char __user *buf,
> +                                         size_t len, loff_t *ppos)
> +{
> +       char tmp[32];
> +       size_t size;
> +
> +       if (!*ppos) {
> +               struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
> +
> +               if (!fc)
> +                       return 0;
> +               if (fc->sb && fc->sb->s_type)
> +                       file->private_data = (void *)fc->sb->s_type->name;
> +               else
> +                       file->private_data = "(NULL)";
> +               fuse_conn_put(fc);
> +       }
> +       size = sprintf(tmp, "%.30s\n", (char *)file->private_data);
> +       return simple_read_from_buffer(buf, len, ppos, tmp, size);
> +}
> +
>  static ssize_t fuse_conn_limit_read(struct file *file, char __user *buf,
>                                     size_t len, loff_t *ppos, unsigned val)
>  {
> @@ -217,6 +238,12 @@ static const struct file_operations fuse_conn_congestion_threshold_ops = {
>         .llseek = no_llseek,
>  };
>
> +static const struct file_operations fuse_conn_file_system_ops = {
> +       .open = nonseekable_open,
> +       .read = fuse_conn_file_system_read,
> +       .llseek = no_llseek,
> +};
> +
>  static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
>                                           struct fuse_conn *fc,
>                                           const char *name,
> @@ -285,7 +312,9 @@ int fuse_ctl_add_conn(struct fuse_conn *fc)
>                                  1, NULL, &fuse_conn_max_background_ops) ||
>             !fuse_ctl_add_dentry(parent, fc, "congestion_threshold",
>                                  S_IFREG | 0600, 1, NULL,
> -                                &fuse_conn_congestion_threshold_ops))
> +                                &fuse_conn_congestion_threshold_ops) ||
> +           !fuse_ctl_add_dentry(parent, fc, "filesystem", S_IFREG | 0400, 1,
> +                                NULL, &fuse_conn_file_system_ops))
>                 goto err;
>
>         return 0;
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index 740a8a7d7ae6f..59390ed37bbad 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -45,7 +45,7 @@
>  #define FUSE_NAME_MAX 1024
>
>  /** Number of dentries for each connection in the control filesystem */
> -#define FUSE_CTL_NUM_DENTRIES 5
> +#define FUSE_CTL_NUM_DENTRIES 6
>
>  /** List of active connections */
>  extern struct list_head fuse_conn_list;
> --
> 2.28.0.163.g6104cc2f0b6-goog
>

Ping this old patch. I just checked and it still applies cleanly to HEAD.
Can we have this merged?

Thanks!

  reply	other threads:[~2022-08-16  2:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 23:45 [PATCH] fuse: Add filesystem attribute in sysfs control dir Lepton Wu
2022-08-15 22:54 ` lepton [this message]
2022-08-22 13:36 ` Miklos Szeredi
2022-08-24 19:00   ` lepton
2022-08-31 13:12     ` Miklos Szeredi

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=CALqoU4xbA5GbLxZOtGJO5Vv6z_XL9jhjWMTPbqEzS8-4mb8z+Q@mail.gmail.com \
    --to=ytht.net@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).