autofs-5.0.4 - fix dont umount existing direct mount on reread From: Ian Kent A recent problem where we incorrectly umounted direct mounts on map re-read, when the map name in the master map has changed, checks for the stale entry in an old map source and updates the new entry from information in the the stale entry. But this check can also match an entry that has been removed from a direct map whose name hasn't changed which leads to a deadlock when we try and take the cache write lock on the (alleged) stale cache to update the new entry. This is because, in this case, the cache we want to lock is in fact the one we are reading and we already hold a read lock on it. --- CHANGELOG | 1 + daemon/state.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 82ebc83..929a21f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -61,6 +61,7 @@ - fix pthread push order in expire_proc_direct(). - fix libxml2 non-thread-safe calls. - fix direct map cache locking. +- fix dont umount existing direct mount on reread. 4/11/2008 autofs-5.0.4 ----------------------- diff --git a/daemon/state.c b/daemon/state.c index 84ccba3..71af46a 100644 --- a/daemon/state.c +++ b/daemon/state.c @@ -389,6 +389,16 @@ static void do_readmap_mount(struct autofs_point *ap, struct mnt_list *mnts, * an empty cache awaiting a map re-load. */ valid = lookup_source_valid_mapent(ap, me->key, LKP_DISTINCT); + if (valid && valid->mc == me->mc) { + /* + * We've found a map entry that has been removed from + * the current cache so there is no need to update it. + * The stale entry will be dealt with when we prune the + * cache later. + */ + cache_unlock(valid->mc); + valid = NULL; + } if (valid) { struct mapent_cache *vmc = valid->mc; cache_unlock(vmc);