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

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