Looking for infor on executable map format
Hello,
I am looking on the exact format that a executable map has to echo to stadout in order to automount something. The man page of autofs is not quite clear about this. For example, having /etc/auto.master:
/home auto.home -soft,retry=6
and a /etc/auto.home script that should mount the users home directory. What should this script echo to stdout? I found out several alternatives but since I have a strange problem that might result out out confusing autofs I would take the right choice. By the way I want to make a bind mount. So whats correct? Here are several examples of output of the auto.home script when called with foo as a key:
# This seems to work, but is it correct?
--bind -soft,retry=6 / server:/export/user/foo
# This works also
--bind -soft,retry=6 \
/ server:/export/user/foo
# Also adding the key after / works
--bind -soft,retry=6 \
/foo server:/export/user/foo
# According to the manpage, autofs (5), I would have expected this to work
# a simple map, but it does not work: --bind -soft,retry=6 \ foo server:/export/user/foo
# Finally even leaving out the key works:
--bind -soft,retry=6 \
server:/export/user/foo
Which example is correct?
My problem is that after a while on my real server which uses lots of user automounts like described here after shutting down autofs (switching to single user) I am unable to umount the user filesystem with the users on it since it claims to be busy. But there are no more processes (like automount, nfsd, user processes) that could make it busy. So I suspect that a wrong format of the executable map might confuse the kernel.
Thanks a lot
Rainer
Signature · 6 lines
--------------------------------------------------------------------------- Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022 Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312 Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html ---------------------------------------------------------------------------
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Quoted 2 lines · Rainer Krienke
I am looking on the exact format that a executable map has to echo to stadout in order to automount something.
As far as I can tell, it's supposed to send out what would have been in a "file" map, minus the key and following whitespace. For example, I have an executable map that creates an appropriate file map and then emits a line to tell the automounter to create a submount with that map. The script ends with:
echo "-rsize=8192,wsize=8192,retry=1,soft,fstype=autofs file:$rete/$1"
exit 0(where $rete is the directory where the dynamically created map is and $1 is the basename of the map file which happens to be the key as provided when the executable map was called).
As another example, under autofs-4.0.0prewhatever that SuSE uses up to version 9.0, I was not able to get the NIS "home" map working, so I substituted an executable map which simply does
ypmatch $1 auto.home 2> /dev/null
whose output is simply
tupelo:/h1/maint/jimc
(or as appropriate for the particular user). Both of these could have come right out of a "file" map following the key: for the first example you would have had
tupelo -rsize=8192,wsize=8192,retry=1,soft,fstype=autofs file:/maps/tupelo
(except how do we create the map file on the fly? We need the executable map.) For the second the map would have had:
jimc tupelo:/h1/maint/jimc
Quoted 2 lines
# This seems to work, but is it correct?
--bind -soft,retry=6 / server:/export/user/foo
As I read the man page, it isn't. You need 2 or 3 whitespace separated fields. (For the executable map the key has to be omitted, meaning 1 or 2 fields.) This example has 4 fields. The separate operand "--bind" is going to be real hard to make to work, and the isolated slash (converted to an out-of-order key in other examples) is not wanted. If the autofs daemon were to take the last field as the mount referent and the first field (--bind) as the mount options, it might just ignore the middle fields, not bothering to reject the line for illegal format.
Are you actually getting bind mounts? I thought the referent had to already be mounted before you could do a bind mount, and the "olddir" has to be specified as a filename as it would be accessed on the localhost, e.g. /net/server/export/user/foo rather than server:/export/user/foo. Also I suspect (don't know for sure) that the referent has to be an actual filesystem on the local machine, because a NFS filesystem won't have local inode structures to hook up to.
Quoted 6 lines
My problem is that after a while on my real server which uses lots of user automounts like described here after shutting down autofs (switching to single user) I am unable to umount the user filesystem with the users on it since it claims to be busy. But there are no more processes (like automount, nfsd, user processes) that could make it busy. So I suspect that a wrong format of the executable map might confuse the kernel.
I doubt the kernel is confused; more likely there really is a process "cd'd" to that directory. Try this (on the machine that refuses to unmount) -- I'm using my own homedir as the example of what might have to be unmounted.
[root tupelo /tmp/root.jimc 2] fuser -mv /h1/maint/jimc
USER PID ACCESS COMMAND
/h1/maint/jimc root 19250 ..c.. imapd
jimc 19321 ..c.. -tcsh
root 20137 ..c.. su-m to recognize any directory under the mount point where the named file is located (in this case, /h1), and -v to show the user and command name. Without -v you get a 1-line list of just the PIDs and the access code.
Hope this helps!
James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)
Quoted 10 lines · Jim Carter
Quoted 2 lines · Rainer Krienke
I am looking on the exact format that a executable map has to echo to stadout in order to automount something.
As far as I can tell, it's supposed to send out what would have been in a "file" map, minus the key and following whitespace. For example, I have an executable map that creates an appropriate file map and then emits a line to tell the automounter to create a submount with that map. The script ends with:
Where did you find the information that the format should be like a filemap without the key? I searched the manuals but the only information I was able to find, was that an executable map has to echo a "map" to stdout. A map would have been the key, then optinal options as well as the server:/filesystem entry. But exactly this does not work. So you are probably right that one should omit the key but its not documented as far as I can see.
Quoted 12 lines
Quoted 2 lines
# This seems to work, but is it correct?
--bind -soft,retry=6 / server:/export/user/fooAs I read the man page, it isn't. You need 2 or 3 whitespace separated fields. (For the executable map the key has to be omitted, meaning 1 or 2 fields.) This example has 4 fields. The separate operand "--bind" is going to be real hard to make to work, and the isolated slash (converted to an out-of-order key in other examples) is not wanted. If the autofs daemon were to take the last field as the mount referent and the first field (--bind) as the mount options, it might just ignore the middle fields, not bothering to reject the line for illegal format.
Quoted 2 lines
Are you actually getting bind mounts? I thought the referent had to already be mounted before you could do a bind mount, and the "olddir" has
The example I gave was not complete because my focus was on the syntax an executable map has to echo to stdout and less on a complete example. In reality there is another autmount map that mounts the parent directory of all users from the user-server. The map looks like this:
user server:/export/user # Map on /import
So when /import/user is reffered to then the parentdirectory with all users is mouted below /import/user. The auto.home map from above contains enries like
krienke server:/export/user/krienke
Since server:/export/user on the client machine is already mounted under /import/user autofs placed a bind mount. Well because of what you said about the problems specifying --bind as an option in the executable map I guess in between, that my --bind option did not have any effect it was autofs itself that did the right thing.
Quoted 8 lines
Quoted 7 lines
My problem is that after a while on my real server which uses lots of user automounts like described here after shutting down autofs (switching to single user) I am unable to umount the user filesystem with the users on it since it claims to be busy. But there are no more processes (like automount, nfsd, user processes) that could make it busy. So I suspect that a wrong format of the executable map might confuse the kernel.
Quoted 6 lines
I doubt the kernel is confused; more likely there really is a process "cd'd" to that directory. Try this (on the machine that refuses to unmount) -- I'm using my own homedir as the example of what might have to be unmounted.
[root tupelo
/tmp/root.jimc2] fuser -mv /h1/maint/jimc
Yes already did this and the output (in single user mode) is empty. Nevertheless I cannot umount the filesystem. fuser -v /export/user says, that there is a kernel mount:
USER PID ACCESS COMMAND
/export/user root kernel mount /export/user
but there are no user processes left. Even lsof /export/user does not echo anything. Here you can see all processes left:
http://www.uni-koblenz.de/~krienke/tmp/processes.txt
The data lie on an xfs filesystem. Below this there is LVM2 and below LVM2 there is a md software raid and below this a md multipath device and then finally two hardware raids (connected to the host by fibrechannel via two fc-switches).
Thanks
Rainer Krienke
Signature · 6 lines
--------------------------------------------------------------------------- Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022 Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312 Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html ---------------------------------------------------------------------------
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Ian Kent
maintainerQuoted 8 lines · Rainer Krienke
Quoted 1 line
Where did you find the information that the format should be like a filemap without the key? I searched the manuals but the only information I was able to find, was that an executable map has to echo a "map" to stdout. A map would have been the key, then optinal options as well as the server:/filesystem entry. But exactly this does not work. So you are probably right that one should omit the key but its not documented as far as I can see.
Looking at the auto.net script in the distribution you see immediately it receives a single parameter, the key. Using that it is expected to return the map entry corresponding to that key. Excecuting auto.net with a host name that has exports, for example, shows what the autofs lookup module is expecting back.
Ian
Quoted 10 lines · Ian Kent
Quoted 8 lines · Rainer Krienke
Where did you find the information that the format should be like a filemap without the key? I searched the manuals but the only information I was able to find, was that an executable map has to echo a "map" to stdout. A map would have been the key, then optinal options as well as the
server:/filesystem entry. But exactly this does not work. So you are probably right that one should omit the key but its not documented as far as I can see.
Quoted 7 lines
Looking at the auto.net script in the distribution you see immediately it receives a single parameter, the key. Using that it is expected to return the map entry corresponding to that key. Excecuting auto.net with a host name that has exports, for example, shows what the autofs lookup module is expecting back.
Ian
This outputs eg something like
-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192 \
/export/user serverhost:/export/user
.....So there are options, a qouted newline and then the map entry without the key. Fine. Would be nice if this information could be integrated into the man pages as well. However what about my --bind paramter (alltough it turned out that I probably do not need it)? Could it be given in the first line, i.e does autofs treat the first line somwhat different to allow options like
--bind -fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192
or does this lead to problems like Jim Carter supposed?
Thanks
Rainer
Signature · 6 lines
--------------------------------------------------------------------------- Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022 Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312 Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html ---------------------------------------------------------------------------
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Ian Kent
maintainerQuoted 7 lines · Rainer Krienke
This outputs eg something like
-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192 \ /export/user serverhost:/export/user .....
Quoted 5 lines
So there are options, a qouted newline and then the map entry without the key. Fine. Would be nice if this information could be integrated into the man pages as well. However what about my --bind paramter (alltough it turned out that I probably do not need it)? Could it be given in the first line, i.e does autofs treat the first line somwhat different to allow options like
Point taken. Bug me if you don't see anything in the next release please.
The code which handles the option parsing is a bit ugly so I'd have to have a look, as options are generally passed starting with a single "-". However the bind mount is always attempted first. Thinking about it I think the code does check for "--". But does it handle the space....
Ian
Quoted 14 lines · you
Quoted 6 lines · Rainer Krienke
This outputs eg something like
-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192 \ /export/user serverhost:/export/user .....Quoted 6 lines
So there are options, a qouted newline and then the map entry without the key. Fine. Would be nice if this information could be integrated into the man pages as well. However what about my --bind paramter (alltough it turned out that I probably do not need it)? Could it be given in the first line, i.e does autofs treat the first line somwhat different to allow options like
Quoted 7 lines
Point taken. Bug me if you don't see anything in the next release please.
The code which handles the option parsing is a bit ugly so I'd have to have a look, as options are generally passed starting with a single "-". However the bind mount is always attempted first. Thinking about it I think the code does check for "--". But does it handle the space....
Just one more point. I just found that I misinterpreted your description from above one more time in that I thought that an executable map has to issue the exact format that the net-map uses, which is a multiple mount map format. By experimenting I found that it does not have to be exactly such a multiple mount map but any legal one. Just in case you should work through the documentation .....
Thanks
Rainer
Signature · 6 lines
--------------------------------------------------------------------------- Rainer Krienke, Universitaet Koblenz, Rechenzentrum, Raum A022 Universitaetsstrasse 1, 56070 Koblenz, Tel: +49 261287 -1312, Fax: -1001312 Mail: [email protected], Web: http://www.uni-koblenz.de/~krienke Get my public PGP key: http://www.uni-koblenz.de/~krienke/mypgp.html ---------------------------------------------------------------------------
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Quoted 10 lines · Rainer Krienke
Quoted 9 lines
This outputs eg something like
-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192 \ /export/user serverhost:/export/user .....So there are options, a qouted newline and then the map entry without the key.
Hmmm, the daemon code that handles executable maps likes to see
[-mount-options] [mapkey] mapreferent
([] indicating optional), whereas the file map handler wants
mapkey [-mount-options] mapreferent
It's rather surprising that the mapkey is legal in the middle position -- I would expect it to always be in the same place and to never be optioal -- I can understand that it's mandatory in a file map, and if it were forbidden in an executable map, but optional?
I suspect that the ugly parser code never even looks at it; the parser uses the last whitespace-separated field as the referent, and the first or second as the mount options, depending on the type of map and whether the field beings with a hyphen.
In any case, a comment in the man page (even if not representing the parser's complete range of behavior bug for bug :-) would be helpful for people writing executable maps. Answering Reiner's first question, I said, "what's it likely that /sbin/automount needs to know? Either an imitation file map (wrong, rejected), or the same minus the key (acceptable when I tried it)."
That also ties in with the formst which you would get with a NIS map if you could get NIS maps to work on your system. (I haven't worked on that one for a long time; maybe it's fixed in recent updates and I can lose the executable home map.)
James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)
Ian Kent
maintainerQuoted 11 lines · Jim Carter
Quoted 10 lines · Rainer Krienke
Quoted 9 lines
This outputs eg something like
-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192 \ /export/user serverhost:/export/user .....So there are options, a qouted newline and then the map entry without the key.
Quoted 8 lines
Hmmm, the daemon code that handles executable maps likes to see
[-mount-options] [mapkey] mapreferent
([] indicating optional), whereas the file map handler wants
mapkey [-mount-options] mapreferent
It's rather surprising that the mapkey is legal in the middle position -- I would expect it to always be in the same place and to never be optioal -- I can understand that it's mandatory in a file map, and if it were forbidden in an executable map, but optional?
Umm. I'm going to have to check that. Seems to me that an executable map should be expected to emit the same map format as other maps.
Quoted 4 lines
In any case, a comment in the man page (even if not representing the parser's complete range of behavior bug for bug :-) would be helpful for people writing executable maps. Answering Reiner's first question, I said,
Yep.
Ian