On Thu, 2008-02-28 at 13:51 -0600, Serge E. Hallyn wrote:Yep, that's precisely the way this is used, by autofs anyway. I guess the problem we face is that since this is a public interface other applications could use this in a different way and we can't control that. I think I need more information so I can document the defined usage in my revised patch set. In version 5 I set $UID, $GID, $USER, $GROUP and $HOME in addition to the standard autofs macros, $ARCH, $CPU, $HOST, $OSNAME, $OSREL and $OSVERS, and then expand the map entry. The question that Jeff is asking himself is, why do we need this information when we re-connect at startup, since the mounts are already present. The answer isn't easy to explain and will be lengthy, sorry, but let me try anyway. There are two types on maps, direct (in the module source you will see a third type called an offset, which is just a direct mount in disguise) and indirect. For example, here is master map with direct and indirect map entries: /- /etc/auto.direct /test /etc/auto.indirect /etc/auto.direct: /automount/dparse/g6 budgie:/autofs/export1 /automount/dparse/g1 shark:/autofs/export1 and so on. /etc/auto.indirect: g1 shark:/autofs/export1 g6 budgie:/autofs/export1 and so on. For the above indirect map an autofs file system is mounted on /test and mounts are triggered by the inode lookup operation. So we see a mount of shark:/autofs/export1 on /test/g1, for example. The way that direct mounts are handled is by makeing an autofs mount on each full path, such as /automount/dparse/g1, and using it as a mount trigger. So when we walk on the path we mount shark:/autofs/export1 on top of this mount point, for example. Since these are always a directories we can use the follow_link inode operation to trigger the mount. But, each entry in direct and indirect maps can have offsets (often called multi-mount map entries). For example, a direct mount map entry could also be: /automount/dparse/g1 \ / shark:/autofs/export5/testing/test \ /s1 shark:/autofs/export/testing/test/s1 \ /s2 shark:/autofs/export5/testing/test/s2 \ /s1/ss1 shark:/autofs/export2 \ /s2/ss2 shark:/autofs/export2 and a similar indirect mount: g1 \ / shark:/autofs/export5/testing/test \ /s1 shark:/autofs/export/testing/test/s1 \ /s2 shark:/autofs/export5/testing/test/s2 \ /s1/ss1 shark:/autofs/export1 \ /s2/ss2 shark:/autofs/export2 One of the issues with version 4 of autofs was that, when mounting an entry with a large number of offsets, possibly with nesting, we needed to mount and umount all of them as a single unit. Not really a problem, except for people with a large number of offsets in map entries. This mechanism is used for the well known "hosts" map and we have seen cases (in 2.4) where the available number of mounts are exhausted or where the number of privileged ports available is exhausted. In version 5 we mount only as we go down the tree of offsets and similarly for expiring them which resolves the above problem. There is somewhat more detail to the implementation but it isn't needed for the sake of the explanation. The one important detail is that these offsets are implemented using the same mechanism as the direct mounts above and so can also be covered by another mount. To be able to do this I need to maintain context. In the daemon I use a list to represent these offsets and use it to manage the mounting and expiration of the mount tree, something which can only be discovered from the original map entry. So, to rebuild this context at startup for existing mounts I need to do the lookup to get the map entry as part of the process of re-connecting to the mounts. Hence the need to get the uid and gid of the original requester. Few, that was hard work, just for those last couple of sentences. Please, lets not go into the issue that the maps can change during a restart, that's an issue for another time and isn't a kernel issue anyway. Me too, but now I've change it so much even I'm confused most of the time, ;) Hopefully the above explanation is useful in some small way. Ian -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| David Miller | [GIT]: Networking |
| Chuck Ebbert | Why do so many machines need "noapic"? |
| Joerg Roedel | [PATCH 4/8] x86: add alloc_coherent dma_ops callback to NOMMU driver |
| Nicholas A. Bellinger | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| Petr Baudis | [ANNOUNCE] TopGit - A different patch queue manager |
| Mike | I don't want the .git directory next to my code. |
| Linus Torvalds | Be more careful about updating refs |
| Jonathan del Strother | blame vs annotate? |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| Corey Minyard | Re: Seagate ST-01/02 info/experiences |
| Dave `geek' Gymer | WARNING (was Re: New afio release) |
| Cary Sandvig | Re: possible bug in gcc2.3.3 with C++ function templates |
| Linux Kernel Mailing List | powerpc/mpc5121: Update device tree for MPC5121ADS evaluation board |
| Linux Kernel Mailing List | KVM: Free apic access page on vm destruction |
| Linux Kernel Mailing List | KVM: hlt emulation should take in-kernel APIC/PIT timers into account |
| Linux Kernel Mailing List | lxfb: rename kernel arg fbsize to vram |
