Skip to contentSkip to conversation

nested mounts -- supported?

DISCUSSION Ian Kent 2 participants 4 messages Apr 28, 2005 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ian Kent

author maintainer
#1 lore raw
Quoted 15 lines · Jeff Moyer

Hi, Ian,

I've got customers running 4.1.3 that complain about long mount times when using nested mounts. Basically, they have maps that look like so:

auto.master:
/foo /etc/auto.foo
/bar /etc/auto.bar

auto.foo
baz localhost:/bar/baz/bat

auto.bar
baz server:/export/baz

Quoted 7 lines

So what ends up happening is /bar/baz is an nfs mountpoint, and /foo/baz/bat is a bind mount inside that nfs mountpoint. Yuck.

The long timeouts are due to the fact that we are doing a wait_for_lock before calling the mount binary. Since this is a nested call, we are essentially deadlocked (though the 4.1.3 code simply declared the lock stale and overwrote it after 10 seconds).

This is an unusual way to do things.

The main thing to remember here is that the only reason that locking is in autofs at all is that mount(8)s' locking is (was) broken. That's easily demonstarted by putting 50 or so entries in a master map and getting rid of the lock calls. Often you will see mtab corruption.

The corruption causes autofs to become very confused.

Quoted 3 lines

Anyway, is this sort of thing supported? It seems to work, though I am uneasy about the whole setup.

I think this probably should be supported and probably will work if the locking in monnt(8) was fixed.

However, if we find that fixed locking mount(8) can't do these mounts either then we're stuck.

Quoted 6 lines

Further, if this is something we strive to support, then we have to consider that this won't work under 4.1.4. The reason is that the revamped locking code will not overwrite the old lock, and so nested mounts will fail. We will not hang, mind you, we will simply time out waiting for the lock.

Right.

But will the work that's been done in autofs translate to a fix for the locking in mount(8). mount(8)s' locking is used only to update mtab so the mount call deadlock we see in autofs shouldn't happen. The locking code I have now was taken from mount in the first place so it might fit in fairly well. But I'm not sure what to propose as, given the locking code in mount(8), I can't actually work out what their requirements were in the first place (eg. exclusive lock, stagered delay, etc.).

I'd like to get rid of the locking code altogether in autofs as it's just unwanted overhead layered on top of not working overhead. I'd be willing carry a patch for mount in the distribution with a big warning. Perhaps we could actually get a response from whoever maintains mount? I've only tried once without success.

Sorry to rant about this but it burned a lot of my time in the past.

Ian

#2 lore raw

==> Regarding Re: nested mounts -- supported?; Ian Kent <[email protected]> adds:

Quoted 11 lines · Jeff Moyer
Quoted 11 lines

Hi, Ian,

I've got customers running 4.1.3 that complain about long mount times when using nested mounts. Basically, they have maps that look like so:

auto.master: /foo /etc/auto.foo /bar /etc/auto.bar

auto.foo baz localhost:/bar/baz/bat

auto.bar baz server:/export/baz

Quoted 7 lines
Quoted 7 lines

So what ends up happening is /bar/baz is an nfs mountpoint, and /foo/baz/bat is a bind mount inside that nfs mountpoint. Yuck.

The long timeouts are due to the fact that we are doing a wait_for_lock before calling the mount binary. Since this is a nested call, we are essentially deadlocked (though the 4.1.3 code simply declared the lock stale and overwrote it after 10 seconds).

raven> This is an unusual way to do things.

raven> The main thing to remember here is that the only reason that locking raven> is in autofs at all is that mount(8)s' locking is (was) raven> broken. That's easily demonstarted by putting 50 or so entries in a raven> master map and getting rid of the lock calls. Often you will see raven> mtab corruption.

raven> The corruption causes autofs to become very confused.

Quoted 2 lines
Quoted 2 lines

Anyway, is this sort of thing supported? It seems to work, though I am uneasy about the whole setup.

raven> I think this probably should be supported and probably will work if raven> the locking in monnt(8) was fixed.

raven> However, if we find that fixed locking mount(8) can't do these raven> mounts either then we're stuck.

Quoted 5 lines
Quoted 5 lines

Further, if this is something we strive to support, then we have to consider that this won't work under 4.1.4. The reason is that the revamped locking code will not overwrite the old lock, and so nested mounts will fail. We will not hang, mind you, we will simply time out waiting for the lock.

raven> Right.

raven> But will the work that's been done in autofs translate to a fix for raven> the locking in mount(8). mount(8)s' locking is used only to update raven> mtab so the mount call deadlock we see in autofs shouldn't raven> happen. The locking code I have now was taken from mount in the raven> first place so it might fit in fairly well. But I'm not sure what to raven> propose as, given the locking code in mount(8), I can't actually raven> work out what their requirements were in the first place raven> (eg. exclusive lock, stagered delay, etc.).

The locking in mount is used to ensure that we don't corrupt /etc/mtab. It is an exclusive lock, and it will timeout (leaving /etc/mtab inconsistent with /proc/mounts).

raven> I'd like to get rid of the locking code altogether in autofs as it's raven> just unwanted overhead layered on top of not working overhead. I'd raven> be willing carry a patch for mount in the distribution with a big raven> warning. Perhaps we could actually get a response from whoever raven> maintains mount? I've only tried once without success.

This is the wrong thing to do. The locking in autofs is used to serialize access to mount. Since autofs can perform many simultaneous mounts, we increase the chance of starving one of the mount programs of the lock. In this case, we end up with an inconsistent mtab.

raven> Sorry to rant about this but it burned a lot of my time in the past.

Mount will work fine with nested mounts. It doesn't take the mtab lock until it needs to update the mtab file. Of course, this discussion is all academic as you point out in your follow-up.

-Jeff

author maintainer
#3 lore raw
In reply to a message not in the archive
Quoted 2 lines · Jeff Moyer

Anyway, is this sort of thing supported? It seems to work, though I am uneasy about the whole setup.

Having said that this should be supported is a bit misleading. Perhaps I should have said that we could probably make this special case nested mount work.

Nested mounts are not supported in autofs maps other than multi-mount maps.

At least that's the case for Solaris automount and should be the case for us as well.

So maybe the discussion in the previous post is academic anyway.

Ian

#4 lore raw

==> Regarding Re: nested mounts -- supported?; Ian Kent <[email protected]> adds:

Quoted 2 lines · Jeff Moyer
Quoted 2 lines

Anyway, is this sort of thing supported? It seems to work, though I am uneasy about the whole setup.

raven> Having said that this should be supported is a bit raven> misleading. Perhaps I should have said that we could probably make raven> this special case nested mount work.

raven> Nested mounts are not supported in autofs maps other than raven> multi-mount maps.

raven> At least that's the case for Solaris automount and should be the raven> case for us as well.

raven> So maybe the discussion in the previous post is academic anyway.

I think this is a perfectly acceptable answer (and indeed what I was looking for).

Thanks,

Jeff