|
|
c3f1f8 |
autofs-5.1.5 - log mount call arguments if mount_verbose is set
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
From: Lars R. Damerow <lars@pixar.com>
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
Override the debug log only setting if mount_verbose is set so that
|
|
|
c3f1f8 |
mount parameter information is logged on mount.
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
Signed-off-by: Lars R. Damerow <lars@pixar.com>
|
|
|
c3f1f8 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
c3f1f8 |
---
|
|
|
c3f1f8 |
CHANGELOG | 1 +
|
|
|
c3f1f8 |
modules/mount_afs.c | 6 +++++-
|
|
|
c3f1f8 |
modules/mount_bind.c | 10 +++++++---
|
|
|
c3f1f8 |
modules/mount_ext2.c | 16 ++++++++++------
|
|
|
c3f1f8 |
modules/mount_generic.c | 14 +++++++++-----
|
|
|
c3f1f8 |
modules/mount_nfs.c | 29 +++++++++++++++++------------
|
|
|
c3f1f8 |
6 files changed, 49 insertions(+), 27 deletions(-)
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
c3f1f8 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
c3f1f8 |
@@ -49,6 +49,7 @@ xx/xx/2018 autofs-5.1.5
|
|
|
c3f1f8 |
- use malloc(3) in spawn.c.
|
|
|
c3f1f8 |
- add mount_verbose configuration option.
|
|
|
c3f1f8 |
- optionally log mount requestor process info.
|
|
|
c3f1f8 |
+- log mount call arguments if mount_verbose is set.
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
19/12/2017 autofs-5.1.4
|
|
|
c3f1f8 |
- fix spec file url.
|
|
|
c3f1f8 |
--- autofs-5.1.4.orig/modules/mount_afs.c
|
|
|
c3f1f8 |
+++ autofs-5.1.4/modules/mount_afs.c
|
|
|
c3f1f8 |
@@ -37,10 +37,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
char dest[PATH_MAX + 1];
|
|
|
c3f1f8 |
size_t r_len = strlen(root);
|
|
|
c3f1f8 |
size_t d_len = r_len + name_len + 2;
|
|
|
c3f1f8 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
c3f1f8 |
return 0;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
+ if (defaults_get_mount_verbose())
|
|
|
c3f1f8 |
+ mountlog = &log_info;
|
|
|
c3f1f8 |
+
|
|
|
c3f1f8 |
if (d_len > PATH_MAX)
|
|
|
c3f1f8 |
return 1;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
@@ -53,7 +57,7 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
if (dest[strlen(dest)-1] == '/')
|
|
|
c3f1f8 |
dest[strlen(dest)-1] = '\0';
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
- debug(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt, MODPREFIX "mounting AFS %s -> %s", dest, what);
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
return symlink(what, dest); /* Try it. If it fails, return the error. */
|
|
|
c3f1f8 |
}
|
|
|
c3f1f8 |
--- autofs-5.1.4.orig/modules/mount_bind.c
|
|
|
c3f1f8 |
+++ autofs-5.1.4/modules/mount_bind.c
|
|
|
c3f1f8 |
@@ -81,10 +81,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
int err;
|
|
|
c3f1f8 |
int i, len;
|
|
|
c3f1f8 |
int symlnk = (*name != '/' && (ap->flags & MOUNT_FLAG_SYMLINK));
|
|
|
c3f1f8 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
c3f1f8 |
return 0;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
+ if (defaults_get_mount_verbose())
|
|
|
c3f1f8 |
+ mountlog = &log_info;
|
|
|
c3f1f8 |
+
|
|
|
c3f1f8 |
/* Extract "symlink" pseudo-option which forces local filesystems
|
|
|
c3f1f8 |
* to be symlinked instead of bound.
|
|
|
c3f1f8 |
*/
|
|
|
c3f1f8 |
@@ -164,9 +168,9 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
if (!status)
|
|
|
c3f1f8 |
existed = 0;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
- debug(ap->logopt, MODPREFIX
|
|
|
c3f1f8 |
- "calling mount --bind -o %s %s %s",
|
|
|
c3f1f8 |
- options, what, fullpath);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt, MODPREFIX
|
|
|
c3f1f8 |
+ "calling mount --bind -o %s %s %s",
|
|
|
c3f1f8 |
+ options, what, fullpath);
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
err = spawn_bind_mount(ap->logopt, "-o",
|
|
|
c3f1f8 |
options, what, fullpath, NULL);
|
|
|
c3f1f8 |
--- autofs-5.1.4.orig/modules/mount_ext2.c
|
|
|
c3f1f8 |
+++ autofs-5.1.4/modules/mount_ext2.c
|
|
|
c3f1f8 |
@@ -47,10 +47,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
int err, ro = 0;
|
|
|
c3f1f8 |
const char *fsck_prog;
|
|
|
c3f1f8 |
int len, status, existed = 1;
|
|
|
c3f1f8 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
c3f1f8 |
return 0;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
+ if (defaults_get_mount_verbose())
|
|
|
c3f1f8 |
+ mountlog = &log_info;
|
|
|
c3f1f8 |
+
|
|
|
c3f1f8 |
/* Root offset of multi-mount */
|
|
|
c3f1f8 |
len = strlen(root);
|
|
|
c3f1f8 |
if (root[len - 1] == '/') {
|
|
|
c3f1f8 |
@@ -121,15 +125,15 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
}
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (options) {
|
|
|
c3f1f8 |
- debug(ap->logopt, MODPREFIX
|
|
|
c3f1f8 |
- "calling mount -t %s -o %s %s %s",
|
|
|
c3f1f8 |
- fstype, options, what, fullpath);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt, MODPREFIX
|
|
|
c3f1f8 |
+ "calling mount -t %s -o %s %s %s",
|
|
|
c3f1f8 |
+ fstype, options, what, fullpath);
|
|
|
c3f1f8 |
err = spawn_mount(ap->logopt, "-t", fstype,
|
|
|
c3f1f8 |
"-o", options, what, fullpath, NULL);
|
|
|
c3f1f8 |
} else {
|
|
|
c3f1f8 |
- debug(ap->logopt,
|
|
|
c3f1f8 |
- MODPREFIX "calling mount -t %s %s %s",
|
|
|
c3f1f8 |
- fstype, what, fullpath);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt,
|
|
|
c3f1f8 |
+ MODPREFIX "calling mount -t %s %s %s",
|
|
|
c3f1f8 |
+ fstype, what, fullpath);
|
|
|
c3f1f8 |
err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
|
|
|
c3f1f8 |
}
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
--- autofs-5.1.4.orig/modules/mount_generic.c
|
|
|
c3f1f8 |
+++ autofs-5.1.4/modules/mount_generic.c
|
|
|
c3f1f8 |
@@ -46,10 +46,14 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
char buf[MAX_ERR_BUF];
|
|
|
c3f1f8 |
int err;
|
|
|
c3f1f8 |
int len, status, existed = 1;
|
|
|
c3f1f8 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
c3f1f8 |
return 0;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
+ if (defaults_get_mount_verbose())
|
|
|
c3f1f8 |
+ mountlog = &log_info;
|
|
|
c3f1f8 |
+
|
|
|
c3f1f8 |
/* Root offset of multi-mount */
|
|
|
c3f1f8 |
len = strlen(root);
|
|
|
c3f1f8 |
if (root[len - 1] == '/') {
|
|
|
c3f1f8 |
@@ -80,15 +84,15 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
existed = 0;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (options && options[0]) {
|
|
|
c3f1f8 |
- debug(ap->logopt,
|
|
|
c3f1f8 |
- MODPREFIX "calling mount -t %s -o %s %s %s",
|
|
|
c3f1f8 |
- fstype, options, what, fullpath);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt,
|
|
|
c3f1f8 |
+ MODPREFIX "calling mount -t %s -o %s %s %s",
|
|
|
c3f1f8 |
+ fstype, options, what, fullpath);
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
err = spawn_mount(ap->logopt, "-t", fstype,
|
|
|
c3f1f8 |
"-o", options, what, fullpath, NULL);
|
|
|
c3f1f8 |
} else {
|
|
|
c3f1f8 |
- debug(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
|
|
|
c3f1f8 |
- fstype, what, fullpath);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt, MODPREFIX "calling mount -t %s %s %s",
|
|
|
c3f1f8 |
+ fstype, what, fullpath);
|
|
|
c3f1f8 |
err = spawn_mount(ap->logopt, "-t", fstype, what, fullpath, NULL);
|
|
|
c3f1f8 |
}
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
--- autofs-5.1.4.orig/modules/mount_nfs.c
|
|
|
c3f1f8 |
+++ autofs-5.1.4/modules/mount_nfs.c
|
|
|
c3f1f8 |
@@ -77,13 +77,17 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
int port = -1;
|
|
|
c3f1f8 |
int ro = 0; /* Set if mount bind should be read-only */
|
|
|
c3f1f8 |
int rdma = 0;
|
|
|
c3f1f8 |
+ void (*mountlog)(unsigned int, const char*, ...) = &log_debug;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
c3f1f8 |
return 0;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
- debug(ap->logopt,
|
|
|
c3f1f8 |
- MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s",
|
|
|
c3f1f8 |
- root, name, what, fstype, options);
|
|
|
c3f1f8 |
+ if (defaults_get_mount_verbose())
|
|
|
c3f1f8 |
+ mountlog = &log_info;
|
|
|
c3f1f8 |
+
|
|
|
c3f1f8 |
+ mountlog(ap->logopt,
|
|
|
c3f1f8 |
+ MODPREFIX "root=%s name=%s what=%s, fstype=%s, options=%s",
|
|
|
c3f1f8 |
+ root, name, what, fstype, options);
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
mount_default_proto = defaults_get_mount_nfs_default_proto();
|
|
|
c3f1f8 |
vers = NFS_VERS_DEFAULT | NFS_PROTO_DEFAULT;
|
|
|
c3f1f8 |
@@ -203,9 +207,9 @@ int mount_mount(struct autofs_point *ap,
|
|
|
c3f1f8 |
if ((vers & NFS_PROTO_MASK) == 0)
|
|
|
c3f1f8 |
vers |= NFS_PROTO_MASK;
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
- debug(ap->logopt, MODPREFIX
|
|
|
c3f1f8 |
- "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
|
|
|
c3f1f8 |
- nfsoptions, nobind, nosymlink, ro);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt, MODPREFIX
|
|
|
c3f1f8 |
+ "nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
|
|
|
c3f1f8 |
+ nfsoptions, nobind, nosymlink, ro);
|
|
|
c3f1f8 |
}
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (!parse_location(ap->logopt, &hosts, what, flags)) {
|
|
|
c3f1f8 |
@@ -379,17 +383,18 @@ dont_probe:
|
|
|
c3f1f8 |
}
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
if (nfsoptions && *nfsoptions) {
|
|
|
c3f1f8 |
- debug(ap->logopt,
|
|
|
c3f1f8 |
- MODPREFIX "calling mount -t %s " SLOPPY
|
|
|
c3f1f8 |
- "-o %s %s %s", fstype, nfsoptions, loc, fullpath);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt,
|
|
|
c3f1f8 |
+ MODPREFIX "calling mount -t %s " SLOPPY
|
|
|
c3f1f8 |
+ "-o %s %s %s", fstype, nfsoptions, loc,
|
|
|
c3f1f8 |
+ fullpath);
|
|
|
c3f1f8 |
|
|
|
c3f1f8 |
err = spawn_mount(ap->logopt,
|
|
|
c3f1f8 |
"-t", fstype, SLOPPYOPT "-o",
|
|
|
c3f1f8 |
nfsoptions, loc, fullpath, NULL);
|
|
|
c3f1f8 |
} else {
|
|
|
c3f1f8 |
- debug(ap->logopt,
|
|
|
c3f1f8 |
- MODPREFIX "calling mount -t %s %s %s",
|
|
|
c3f1f8 |
- fstype, loc, fullpath);
|
|
|
c3f1f8 |
+ mountlog(ap->logopt,
|
|
|
c3f1f8 |
+ MODPREFIX "calling mount -t %s %s %s",
|
|
|
c3f1f8 |
+ fstype, loc, fullpath);
|
|
|
c3f1f8 |
err = spawn_mount(ap->logopt,
|
|
|
c3f1f8 |
"-t", fstype, loc, fullpath, NULL);
|
|
|
c3f1f8 |
}
|