Re: [PATCH v4 2/2] fuse: add default_request_timeout and max_request_timeout sysctls

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

 



On Wed, Aug 21, 2024 at 2:31 AM Joanne Koong <joannelkoong@xxxxxxxxx> wrote:
>
> On Mon, Aug 19, 2024 at 11:40 PM Yafang Shao <laoar.shao@xxxxxxxxx> wrote:
> >
> > On Wed, Aug 14, 2024 at 7:24 AM Joanne Koong <joannelkoong@xxxxxxxxx> wrote:
> > >
> > > Introduce two new sysctls, "default_request_timeout" and
> > > "max_request_timeout". These control timeouts on replies by the
> > > server to kernel-issued fuse requests.
> > >
> > > "default_request_timeout" sets a timeout if no timeout is specified by
> > > the fuse server on mount. 0 (default) indicates no timeout should be enforced.
> > >
> > > "max_request_timeout" sets a maximum timeout for fuse requests. If the
> > > fuse server attempts to set a timeout greater than max_request_timeout,
> > > the system will default to max_request_timeout. Similarly, if the max
> > > default timeout is greater than the max request timeout, the system will
> > > default to the max request timeout. 0 (default) indicates no timeout should
> > > be enforced.
> > >
> > > $ sysctl -a | grep fuse
> > > fs.fuse.default_request_timeout = 0
> > > fs.fuse.max_request_timeout = 0
> > >
> > > $ echo 0x100000000 | sudo tee /proc/sys/fs/fuse/default_request_timeout
> > > tee: /proc/sys/fs/fuse/default_request_timeout: Invalid argument
> > >
> > > $ echo 0xFFFFFFFF | sudo tee /proc/sys/fs/fuse/default_request_timeout
> > > 0xFFFFFFFF
> > >
> > > $ sysctl -a | grep fuse
> > > fs.fuse.default_request_timeout = 4294967295
> > > fs.fuse.max_request_timeout = 0
> > >
> > > Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx>
> > > Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
> > > Reviewed-by: Bernd Schubert <bschubert@xxxxxxx>
> > > ---
> > >  Documentation/admin-guide/sysctl/fs.rst | 17 ++++++++++
> > >  fs/fuse/Makefile                        |  2 +-
> > >  fs/fuse/fuse_i.h                        | 16 ++++++++++
> > >  fs/fuse/inode.c                         | 19 ++++++++++-
> > >  fs/fuse/sysctl.c                        | 42 +++++++++++++++++++++++++
> > >  5 files changed, 94 insertions(+), 2 deletions(-)
> > >  create mode 100644 fs/fuse/sysctl.c
> > >
> > > diff --git a/Documentation/admin-guide/sysctl/fs.rst b/Documentation/admin-guide/sysctl/fs.rst
> > > index 47499a1742bd..44fd495f69b4 100644
> > > --- a/Documentation/admin-guide/sysctl/fs.rst
> > > +++ b/Documentation/admin-guide/sysctl/fs.rst
> > > @@ -332,3 +332,20 @@ Each "watch" costs roughly 90 bytes on a 32-bit kernel, and roughly 160 bytes
> > >  on a 64-bit one.
> > >  The current default value for ``max_user_watches`` is 4% of the
> > >  available low memory, divided by the "watch" cost in bytes.
> > > +
> > > +5. /proc/sys/fs/fuse - Configuration options for FUSE filesystems
> > > +=====================================================================
> > > +
> > > +This directory contains the following configuration options for FUSE
> > > +filesystems:
> > > +
> > > +``/proc/sys/fs/fuse/default_request_timeout`` is a read/write file for
> > > +setting/getting the default timeout (in seconds) for a fuse server to
> > > +reply to a kernel-issued request in the event where the server did not
> > > +specify a timeout at mount. 0 indicates no timeout.
> >
> > While testing on my servers, I observed that the timeout value appears
> > to be doubled. For instance, if I set the timeout to 10 seconds, the
> > "Timer expired" message occurs after 20 seconds.
> >
> > Is this an expected behavior, or is the doubling unavoidable? I'm okay
> > with it as long as we have a functioning timeout. However, I recommend
> > documenting this behavior to avoid any potential confusion for users.
>
> Hi Yafang,
>
> Are you testing this by running "cat hello" from the libfuse hello
> example server and seeing the doubled timeout?

right.

>
> This is happening because cat hello sends two FUSE_READ requests. The
> first FUSE_READ is a background request (called from
> fuse_readahead()). I confirmed that this takes 10 seconds to time out
> and then the timeout handler kicks in. Then the second FUSE_READ is a
> regular request (called from fuse_read_folio() -> fuse_do_readpage()).
> This second request also takes 10 seconds to time out. After this
> second request times out is when the "cat hello" returns, which is why
> the overall time is 20 seconds because of the 2 requests each taking
> 10 seconds.
>

Thanks for your detailed explanation.

-- 
Regards
Yafang





[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