sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget4/translations/zh_CN/filesystems/autofs-mount-controlmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/zh_TW/filesystems/autofs-mount-controlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/it_IT/filesystems/autofs-mount-controlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/ja_JP/filesystems/autofs-mount-controlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/ko_KR/filesystems/autofs-mount-controlmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/sp_SP/filesystems/autofs-mount-controlmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhN/var/lib/git/docbuild/linux/Documentation/filesystems/autofs-mount-control.rsthKubhsection)}(hhh](htitle)}(hDMiscellaneous Device control operations for the autofs kernel moduleh]hDMiscellaneous Device control operations for the autofs kernel module}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h The problemh]h The problem}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hpThere is a problem with active restarts in autofs (that is to say restarting autofs when there are busy mounts).h]hpThere is a problem with active restarts in autofs (that is to say restarting autofs when there are busy mounts).}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXmDuring normal operation autofs uses a file descriptor opened on the directory that is being managed in order to be able to issue control operations. Using a file descriptor gives ioctl operations access to autofs specific information stored in the super block. The operations are things such as setting an autofs mount catatonic, setting the expire timeout and requesting expire checks. As is explained below, certain types of autofs triggered mounts can end up covering an autofs mount itself which prevents us being able to use open(2) to obtain a file descriptor for these operations if we don't already have one open.h]hXoDuring normal operation autofs uses a file descriptor opened on the directory that is being managed in order to be able to issue control operations. Using a file descriptor gives ioctl operations access to autofs specific information stored in the super block. The operations are things such as setting an autofs mount catatonic, setting the expire timeout and requesting expire checks. As is explained below, certain types of autofs triggered mounts can end up covering an autofs mount itself which prevents us being able to use open(2) to obtain a file descriptor for these operations if we don’t already have one open.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXpCurrently autofs uses "umount -l" (lazy umount) to clear active mounts at restart. While using lazy umount works for most cases, anything that needs to walk back up the mount tree to construct a path, such as getcwd(2) and the proc file system /proc//cwd, no longer works because the point from which the path is constructed has been detached from the mount tree.h]hXtCurrently autofs uses “umount -l” (lazy umount) to clear active mounts at restart. While using lazy umount works for most cases, anything that needs to walk back up the mount tree to construct a path, such as getcwd(2) and the proc file system /proc//cwd, no longer works because the point from which the path is constructed has been detached from the mount tree.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXThe actual problem with autofs is that it can't reconnect to existing mounts. Immediately one thinks of just adding the ability to remount autofs file systems would solve it, but alas, that can't work. This is because autofs direct mounts and the implementation of "on demand mount and expire" of nested mount trees have the file system mounted directly on top of the mount trigger directory dentry.h]hXThe actual problem with autofs is that it can’t reconnect to existing mounts. Immediately one thinks of just adding the ability to remount autofs file systems would solve it, but alas, that can’t work. This is because autofs direct mounts and the implementation of “on demand mount and expire” of nested mount trees have the file system mounted directly on top of the mount trigger directory dentry.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hFor example, there are two types of automount maps, direct (in the kernel module source you will see a third type called an offset, which is just a direct mount in disguise) and indirect.h]hFor example, there are two types of automount maps, direct (in the kernel module source you will see a third type called an offset, which is just a direct mount in disguise) and indirect.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hhhhubh)}(h;Here is a master map with direct and indirect map entries::h]h:Here is a master map with direct and indirect map entries:}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hhhhubh literal_block)}(h3/- /etc/auto.direct /test /etc/auto.indirecth]h3/- /etc/auto.direct /test /etc/auto.indirect}hj2sbah}(h]h ]h"]h$]h&]hhuh1j0hhhK+hhhhubh)}(h!and the corresponding map files::h]h and the corresponding map files:}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hhhhubj1)}(hv/etc/auto.direct: /automount/dparse/g6 budgie:/autofs/export1 /automount/dparse/g1 shark:/autofs/export1 and so on.h]hv/etc/auto.direct: /automount/dparse/g6 budgie:/autofs/export1 /automount/dparse/g1 shark:/autofs/export1 and so on.}hjNsbah}(h]h ]h"]h$]h&]hhuh1j0hhhK0hhhhubh)}(h/etc/auto.indirect::h]h/etc/auto.indirect:}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK6hhhhubj1)}(hCg1 shark:/autofs/export1 g6 budgie:/autofs/export1 and so on.h]hCg1 shark:/autofs/export1 g6 budgie:/autofs/export1 and so on.}hjjsbah}(h]h ]h"]h$]h&]hhuh1j0hhhK8hhhhubh)}(hFor the above indirect map an autofs file system is mounted on /test and mounts are triggered for each sub-directory key by the inode lookup operation. So we see a mount of shark:/autofs/export1 on /test/g1, for example.h]hFor the above indirect map an autofs file system is mounted on /test and mounts are triggered for each sub-directory key by the inode lookup operation. So we see a mount of shark:/autofs/export1 on /test/g1, for example.}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhj-hhubh)}(hThe call requires an initialized struct autofs_dev_ioctl with the ioctlfd field set to the descriptor obtained from the open call.h]hThe call requires an initialized struct autofs_dev_ioctl with the ioctlfd field set to the descriptor obtained from the open call.}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMIhj-hhubeh}(h]autofs-dev-ioctl-timeout-cmdah ]h"]autofs_dev_ioctl_timeout_cmdah$]h&]uh1hhjhhhhhMEubh)}(hhh](h)}(hAUTOFS_DEV_IOCTL_REQUESTER_CMDh]hAUTOFS_DEV_IOCTL_REQUESTER_CMD}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhjbhhhhhMNubh)}(hhReturn the uid and gid of the last process to successfully trigger a the mount on the given path dentry.h]hhReturn the uid and gid of the last process to successfully trigger a the mount on the given path dentry.}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhjbhhubh)}(hThe call requires an initialized struct autofs_dev_ioctl with the path field set to the mount point in question and the size field adjusted appropriately. Upon return the uid field of struct args_requester contains the uid and gid field the gid.h]hThe call requires an initialized struct autofs_dev_ioctl with the path field set to the mount point in question and the size field adjusted appropriately. Upon return the uid field of struct args_requester contains the uid and gid field the gid.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMShjbhhubh)}(hXMWhen reconstructing an autofs mount tree with active mounts we need to re-connect to mounts that may have used the original process uid and gid (or string variations of them) for mount lookups within the map entry. This call provides the ability to obtain this uid and gid so they may be used by user space for the mount map lookups.h]hXMWhen reconstructing an autofs mount tree with active mounts we need to re-connect to mounts that may have used the original process uid and gid (or string variations of them) for mount lookups within the map entry. This call provides the ability to obtain this uid and gid so they may be used by user space for the mount map lookups.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMXhjbhhubeh}(h]autofs-dev-ioctl-requester-cmdah ]h"]autofs_dev_ioctl_requester_cmdah$]h&]uh1hhjhhhhhMNubh)}(hhh](h)}(hAUTOFS_DEV_IOCTL_EXPIRE_CMDh]hAUTOFS_DEV_IOCTL_EXPIRE_CMD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM`ubh)}(hIssue an expire request to the kernel for an autofs mount. Typically this ioctl is called until no further expire candidates are found.h]hIssue an expire request to the kernel for an autofs mount. Typically this ioctl is called until no further expire candidates are found.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMbhjhhubh)}(hXThe call requires an initialized struct autofs_dev_ioctl with the ioctlfd field set to the descriptor obtained from the open call. In addition an immediate expire that's independent of the mount timeout, and a forced expire that's independent of whether the mount is busy, can be requested by setting the how field of struct args_expire to AUTOFS_EXP_IMMEDIATE or AUTOFS_EXP_FORCED, respectively . If no expire candidates can be found the ioctl returns -1 with errno set to EAGAIN.h]hXThe call requires an initialized struct autofs_dev_ioctl with the ioctlfd field set to the descriptor obtained from the open call. In addition an immediate expire that’s independent of the mount timeout, and a forced expire that’s independent of whether the mount is busy, can be requested by setting the how field of struct args_expire to AUTOFS_EXP_IMMEDIATE or AUTOFS_EXP_FORCED, respectively . If no expire candidates can be found the ioctl returns -1 with errno set to EAGAIN.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMehjhhubh)}(hThis call causes the kernel module to check the mount corresponding to the given ioctlfd for mounts that can be expired, issues an expire request back to the daemon and waits for completion.h]hThis call causes the kernel module to check the mount corresponding to the given ioctlfd for mounts that can be expired, issues an expire request back to the daemon and waits for completion.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMnhjhhubeh}(h]autofs-dev-ioctl-expire-cmdah ]h"]autofs_dev_ioctl_expire_cmdah$]h&]uh1hhjhhhhhM`ubh)}(hhh](h)}(hAUTOFS_DEV_IOCTL_ASKUMOUNT_CMDh]hAUTOFS_DEV_IOCTL_ASKUMOUNT_CMD}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMsubh)}(h*Checks if an autofs mount point is in use.h]h*Checks if an autofs mount point is in use.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMuhjhhubh)}(hThe call requires an initialized struct autofs_dev_ioctl with the ioctlfd field set to the descriptor obtained from the open call and it returns the result in the may_umount field of struct args_askumount, 1 for busy and 0 otherwise.h]hThe call requires an initialized struct autofs_dev_ioctl with the ioctlfd field set to the descriptor obtained from the open call and it returns the result in the may_umount field of struct args_askumount, 1 for busy and 0 otherwise.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMwhjhhubeh}(h]autofs-dev-ioctl-askumount-cmdah ]h"]autofs_dev_ioctl_askumount_cmdah$]h&]uh1hhjhhhhhMsubh)}(hhh](h)}(h!AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMDh]h!AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM~ubh)}(h(Check if the given path is a mountpoint.h]h(Check if the given path is a mountpoint.}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXThe call requires an initialized struct autofs_dev_ioctl. There are two possible variations. Both use the path field set to the path of the mount point to check and the size field adjusted appropriately. One uses the ioctlfd field to identify a specific mount point to check while the other variation uses the path and optionally in.type field of struct args_ismountpoint set to an autofs mount type. The call returns 1 if this is a mount point and sets out.devid field to the device number of the mount and out.magic field to the relevant super block magic number (described below) or 0 if it isn't a mountpoint. In both cases the device number (as returned by new_encode_dev()) is returned in out.devid field.h]hXThe call requires an initialized struct autofs_dev_ioctl. There are two possible variations. Both use the path field set to the path of the mount point to check and the size field adjusted appropriately. One uses the ioctlfd field to identify a specific mount point to check while the other variation uses the path and optionally in.type field of struct args_ismountpoint set to an autofs mount type. The call returns 1 if this is a mount point and sets out.devid field to the device number of the mount and out.magic field to the relevant super block magic number (described below) or 0 if it isn’t a mountpoint. In both cases the device number (as returned by new_encode_dev()) is returned in out.devid field.}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXIf supplied with a file descriptor we're looking for a specific mount, not necessarily at the top of the mounted stack. In this case the path the descriptor corresponds to is considered a mountpoint if it is itself a mountpoint or contains a mount, such as a multi-mount without a root mount. In this case we return 1 if the descriptor corresponds to a mount point and also returns the super magic of the covering mount if there is one or 0 if it isn't a mountpoint.h]hXIf supplied with a file descriptor we’re looking for a specific mount, not necessarily at the top of the mounted stack. In this case the path the descriptor corresponds to is considered a mountpoint if it is itself a mountpoint or contains a mount, such as a multi-mount without a root mount. In this case we return 1 if the descriptor corresponds to a mount point and also returns the super magic of the covering mount if there is one or 0 if it isn’t a mountpoint.}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXnIf a path is supplied (and the ioctlfd field is set to -1) then the path is looked up and is checked to see if it is the root of a mount. If a type is also given we are looking for a particular autofs mount and if a match isn't found a fail is returned. If the located path is the root of a mount 1 is returned along with the super magic of the mount or 0 otherwise.h]hXpIf a path is supplied (and the ioctlfd field is set to -1) then the path is looked up and is checked to see if it is the root of a mount. If a type is also given we are looking for a particular autofs mount and if a match isn’t found a fail is returned. If the located path is the root of a mount 1 is returned along with the super magic of the mount or 0 otherwise.}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]!autofs-dev-ioctl-ismountpoint-cmdah ]h"]!autofs_dev_ioctl_ismountpoint_cmdah$]h&]uh1hhjhhhhhM~ubeh}(h] the-ioctlsah ]h"] the ioctlsah$]h&]uh1hhhhhhhhKubeh}(h]Dmiscellaneous-device-control-operations-for-the-autofs-kernel-moduleah ]h"]Dmiscellaneous device control operations for the autofs kernel moduleah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j{jxj jjZjWjjjsjpjKjHjrjojjjjjjj*j'j_j\jjjjjjjkjhu nametypes}(j{j jZjjsjKjrjjjj*j_jjjjkuh}(jxhjhjWj jj]jpjjHj'jojNjjujjjjj'jj\j-jjbjjjjjhju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.