From: Ali Nasrolahi <a.nasrolahi01@gmail.com>
To: Raka Gunarto <rakagunarto@gmail.com>
Cc: Richard <richard_siegfried@systemli.org>,
kernelnewbies@kernelnewbies.org
Subject: Re: Seeking guidance on detecting mount point inactivity
Date: Sun, 5 Jul 2026 08:34:06 +0330 [thread overview]
Message-ID: <aknbW9m52mfTLSXY@zephyr> (raw)
In-Reply-To: <CACUOwmKRgj8Z+JoNRsFRPR5gOAGsLqcDSMtKepBaGOE-q-fWiw@mail.gmail.com>
Thank you for the suggestions.
On 26/07/03 10:54AM, Raka Gunarto wrote:
> Is moving the mount to another path or lazy unmount not an option?
>
> After moving the mount, you can wait until there are no more open
> handles (since all subsequent open calls would be blocked). Then you
> can do your operations and then restore the mount at the original
> location.
>
> Lazy unmounting would work the same way, wait until it properly
> unmounts, and then you remount at your maintenance location.
Lazy unmounting, moving the mount to another location, or even
techniques such as `chmod 000` (for non-root users) would all eventually
drain the mount of references. My concern is slightly different. I don't
want to start draining the mount immediately after observing that it has
no references at a particular instant, because that alone is not strong
evidence that the workload is actually inactive or ,more accurately,
likely to be inactive.
For example, a workload may repeatedly open a file, perform a small
amount of work, close it, sleep for a short time, and then repeat. If I
immediately started draining the mount every time the reference count
reached zero, the system would constantly interrupt some workload.
That is the whole reason behind the grace period. Rather than treating
"reference count reached zero" as sufficient, I only consider the mount
a possible maintenance candidate if it has remained without active
references for some time. The goal is not to prove inactivity, but to
make it much more likely that the workload has genuinely gone idle.
> If you don't want to disrupt currently running operations, you could
> use the fanotify API and keep track of events and determine an
> activity threshold to move the mount / lazy unmount. Or perhaps an
> eBPF program that hooks into the FS tracepoints?
Well, this is actually my direction. I even wrote a small PoC eBPF
program that attaches to LSM hooks to account for opens and reject
new ones during maintenance. However, it has its own challenges,
specifically, some nasty races. For example, if monitoring begins after
some file objects are already open, the accounting is immediately off. As
a result, the design becomes closer to a best-effort mechanism than one
that can guarantee a successful `umount()`.
These kind of challenges are exactly the points I hope to discuss.
Regards,
Ali
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2026-07-05 5:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 14:37 Seeking guidance on detecting mount point inactivity Ali Nasrolahi
2026-06-30 14:21 ` Richard
2026-07-03 9:05 ` Ali Nasrolahi
2026-07-03 9:54 ` Raka Gunarto
2026-07-05 5:04 ` Ali Nasrolahi [this message]
2026-07-05 16:34 ` Raka Gunarto
2026-07-06 6:57 ` Ali Nasrolahi
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=aknbW9m52mfTLSXY@zephyr \
--to=a.nasrolahi01@gmail.com \
--cc=kernelnewbies@kernelnewbies.org \
--cc=rakagunarto@gmail.com \
--cc=richard_siegfried@systemli.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.