Page MenuHomeFreeBSD

autofs: add AT_NO_AUTOMOUNT flag for fstatat(2)
AcceptedPublic

Authored by kib on Fri, Sep 20, 6:29 AM.
Tags
None
Referenced Files
F95570768: D46710.diff
Sat, Sep 21, 2:39 PM
F95457386: D46710.diff
Fri, Sep 20, 11:28 PM
F95455209: D46710.diff
Fri, Sep 20, 11:06 PM
F95444981: D46710.diff
Fri, Sep 20, 9:34 PM
F95440718: D46710.diff
Fri, Sep 20, 8:58 PM
Unknown Object (File)
Fri, Sep 20, 12:49 PM
Unknown Object (File)
Fri, Sep 20, 6:37 AM

Details

Reviewers
emaste
markj
olce

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Fri, Sep 20, 6:29 AM

When is it useful? Is there something in the base system which needs this?

sys/fs/autofs/autofs_vnops.c
92
kib marked an inline comment as done.Fri, Sep 20, 8:41 AM

When is it useful? Is there something in the base system which needs this?

It was prompted by the need of linuxolator. From the Linux man page, it always assume AT_NO_AUTOMOUNT since some version.

I believe it is useful for gui fs browsers.

When is it useful?

Prompted by PR281526 - linuxulator failure. @dchagin ignored LINUX_AT_NO_AUTOMOUNT for statx in ff39d74aa99a49749d1de26dc1f6b1e1bfebceb0 with the comment

Specific to Linux AT_NO_AUTOMOUNT flag tells the kernel to not automount the terminal component of pathname if it is a directory that is an automount point. As it is the default for FreeBSD silencly ignore this flag.

but other stat variants still reject AT_NO_AUTOMOUNT as an unsupported flag.

I've got a patch in progress to move the supported flag test and conversion to a common function to be shared by linux_fstatat64, linux_newfstatat, and linux_statx.

I've got a patch in progress to move the supported flag test and conversion to a common function

D46711

olce accepted this revision.EditedFri, Sep 20, 1:12 PM

My original comment here:

Just wanted to point out that a side-effect of this patch is that now, using stat()will actually lead to auto-mounting the target.

was wrong.

This revision is now accepted and ready to land.Fri, Sep 20, 1:12 PM

Just wanted to point out that a side-effect of this patch is that now, using stat()will actually lead to auto-mounting the target.

Do we need to look at changes to base system utilities to set AT_NO_AUTOMOUNT (under some option perhaps)?

Just wanted to point out that a side-effect of this patch is that now, using stat()will actually lead to auto-mounting the target.

Isn't stat() causes auto-mount without my patch? Lets formulate the question differently: doesn't the patch only adds a way to disable automount in some cases?

Just wanted to point out that a side-effect of this patch is that now, using stat()will actually lead to auto-mounting the target.

Do we need to look at changes to base system utilities to set AT_NO_AUTOMOUNT (under some option perhaps)?

I think this would indeed make sense for fts(3) and some of it consumers.

In D46710#1065117, @kib wrote:

Isn't stat() causes auto-mount without my patch? Lets formulate the question differently: doesn't the patch only adds a way to disable automount in some cases?

Yes, this is the question I was answering. Checking the code again, I was wrong, the patch only disables automount in some cases.

This dchagin@'s statement:

As it is the default for FreeBSD silencly ignore this flag.

is true only if vfs.autofs.mount_on_stat is 0 (its default value). So I think we should pass the native AT_NO_AUTOMOUNT internally if passed to Linuxulator's system calls.

I’m not sure I follow, but FreeBSD doesn’t mount on stat anyway, so why introduce the native flag instead of making the code consistently ignore the Linux one? Linux autofs semantics is broken in some interesting ways; we don’t need to port functionality that only exists to work around that brokenness.

making the code consistently ignore the Linux one

We should handle Linux AT_NO_AUTOMOUNT in a consistent way across the stat variants, independent of this change. I have D46711 open for that.

I’m not sure I follow, but FreeBSD doesn’t mount on stat anyway, so why introduce the native flag instead of making the code consistently ignore the Linux one? Linux autofs semantics is broken in some interesting ways; we don’t need to port functionality that only exists to work around that brokenness.

Could you please explain how do we avoid triggering automount on stat? The autofs_mount_on_stat knob is mostly nop because the trigger happen during lookup preceeding the call to VOP_GETATTR().