Blame SOURCES/autofs-5.1.3-add-function-umount_amd_ext_mount.patch

304803
autofs-5.1.3 - add function umount_amd_ext_mount()
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
Refactor amd external umount code, move the code into its own
304803
function.
304803
304803
Later amd umounting of program mounts with a custom command will
304803
be added.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG           |    1 +
304803
 daemon/automount.c  |   22 ++--------------------
304803
 include/mounts.h    |    1 +
304803
 lib/mounts.c        |   17 +++++++++++++++++
304803
 modules/parse_amd.c |    3 +--
304803
 5 files changed, 22 insertions(+), 22 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -278,6 +278,7 @@
304803
 - fix expandamdent() quote handling.
304803
 - fix possible memory leak during amd parse.
304803
 - remove path restriction of amd external mount.
304803
+- add function umount_amd_ext_mount().
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/daemon/automount.c
304803
+++ autofs-5.0.7/daemon/automount.c
304803
@@ -614,16 +614,7 @@ static int umount_subtree_mounts(struct
304803
 		}
304803
 		list_del(&entry->entries);
304803
 		mounts_mutex_unlock(ap);
304803
-		if (ext_mount_remove(&entry->ext_mount, entry->fs)) {
304803
-			if (umount_ent(ap, entry->fs))
304803
-				debug(ap->logopt,
304803
-				      "failed to umount external mount %s",
304803
-				      entry->fs);
304803
-			else
304803
-				debug(ap->logopt,
304803
-				      "umounted external mount %s",
304803
-				      entry->fs);
304803
-		}
304803
+		umount_amd_ext_mount(ap, entry);
304803
 		free_amd_entry(entry);
304803
 	}
304803
 done:
304803
@@ -670,16 +661,7 @@ int umount_multi(struct autofs_point *ap
304803
 		}
304803
 		list_del(&entry->entries);
304803
 		mounts_mutex_unlock(ap);
304803
-		if (ext_mount_remove(&entry->ext_mount, entry->fs)) {
304803
-			if (umount_ent(ap, entry->fs))
304803
-				debug(ap->logopt,
304803
-				      "failed to umount external mount %s",
304803
-				      entry->fs);
304803
-			else
304803
-				debug(ap->logopt,
304803
-				      "umounted external mount %s",
304803
-				      entry->fs);
304803
-		}
304803
+		umount_amd_ext_mount(ap, entry);
304803
 		free_amd_entry(entry);
304803
 		return 0;
304803
 	}
304803
--- autofs-5.0.7.orig/include/mounts.h
304803
+++ autofs-5.0.7/include/mounts.h
304803
@@ -118,6 +118,7 @@ int try_remount(struct autofs_point *, s
304803
 void set_indirect_mount_tree_catatonic(struct autofs_point *);
304803
 void set_direct_mount_tree_catatonic(struct autofs_point *, struct mapent *);
304803
 int umount_ent(struct autofs_point *, const char *);
304803
+int umount_amd_ext_mount(struct autofs_point *, struct amd_entry *);
304803
 int mount_multi_triggers(struct autofs_point *, struct mapent *, const char *, unsigned int, const char *);
304803
 int umount_multi_triggers(struct autofs_point *, struct mapent *, char *, const char *);
304803
 int clean_stale_multi_triggers(struct autofs_point *, struct mapent *, char *, const char *);
304803
--- autofs-5.0.7.orig/lib/mounts.c
304803
+++ autofs-5.0.7/lib/mounts.c
304803
@@ -2035,6 +2035,23 @@ int umount_ent(struct autofs_point *ap,
304803
 	return rv;
304803
 }
304803
 
304803
+int umount_amd_ext_mount(struct autofs_point *ap, struct amd_entry *entry)
304803
+{
304803
+	int rv = 1;
304803
+
304803
+	if (ext_mount_remove(&entry->ext_mount, entry->fs)) {
304803
+		rv = umount_ent(ap, entry->fs);
304803
+		if (rv)
304803
+			error(ap->logopt,
304803
+			      "failed to umount external mount %s", entry->fs);
304803
+		else
304803
+			debug(ap->logopt,
304803
+			      "umounted external mount %s", entry->fs);
304803
+	}
304803
+
304803
+	return rv;
304803
+}
304803
+
304803
 static int do_mount_autofs_offset(struct autofs_point *ap,
304803
 				  struct mapent *oe, const char *root,
304803
 				  char *offset)
304803
--- autofs-5.0.7.orig/modules/parse_amd.c
304803
+++ autofs-5.0.7/modules/parse_amd.c
304803
@@ -982,8 +982,7 @@ symlink:
304803
 
304803
 	if (entry->sublink) {
304803
 		/* failed to complete sublink mount */
304803
-		if (ext_mount_remove(&entry->ext_mount, entry->fs))
304803
-			umount_ent(ap, entry->fs);
304803
+		umount_amd_ext_mount(ap, entry);
304803
 	}
304803
 out:
304803
 	return ret;