Skip to contentSkip to conversation

Unable to set log priority for all direct mounts

DISCUSSION Goldwyn Rodrigues 3 participants 6 messages May 14 – May 22 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hello,

Since the work to have a single FIFO file for setting log priority (16ea4156 ("autofs-5.1.8 - switch to application wide command pipe"), to be more precise 16ea4156 (autofs-5.1.8 - switch to application wide command pipe), automount has lost the ability to set the log priority of all direct mounts using the path "/-".

# sudo automount -l info /-
Could not find device id for mount /-

This is because automount attempts to mount and get verifies the real path which is non-existent in case of direct mounts "/-".

In the automount program, the log priority is set pretty early and much before the master map is setup. So we cannot check on the autofs dev either.

What would be the best way to solve this? Should we just document it as a feature loss?

Signature · 1 line
Goldwyn
maintainer
#1 lore raw
Quoted 9 lines · Goldwyn Rodrigues

Hello,

Since the work to have a single FIFO file for setting log priority (16ea4156 ("autofs-5.1.8 - switch to application wide command pipe"), to be more precise 16ea4156 (autofs-5.1.8 - switch to application wide command pipe), automount has lost the ability to set the log priority of all direct mounts using the path "/-".

Quoted 5 lines
# sudo automount -l info /-
Could not find device id for mount /-

This is because automount attempts to mount and get verifies the real path which is non-existent in case of direct mounts "/-".

Of course yes.

Quoted 4 lines

In the automount program, the log priority is set pretty early and much before the master map is setup. So we cannot check on the autofs dev either.

But it should be settable on a per-mount basis.

The command line log setting was always meant to modify an existing

global log priority. Setting it for /- should mean setting it for

all direct mounts, ie. the global setting.

Quoted 3 lines

What would be the best way to solve this? Should we just document it as a feature loss?

It sounds more like a regression, I'd rather try and fix it.

There should be (is/used to be?) a global log priority for both direct

and indirect mounts which shouldn't need this sort of validation and

should be used if the validation fails.

Let me have a look and get back.

Ian

maintainer
#2 lore raw
In reply to Goldwyn Rodrigues
Quoted 15 lines · Goldwyn Rodrigues

Hello,

Since the work to have a single FIFO file for setting log priority (16ea4156 ("autofs-5.1.8 - switch to application wide command pipe"), to be more precise 16ea4156 (autofs-5.1.8 - switch to application wide command pipe), automount has lost the ability to set the log priority of all direct mounts using the path "/-".

# sudo automount -l info /-
Could not find device id for mount /-

This is because automount attempts to mount and get verifies the real path which is non-existent in case of direct mounts "/-".

Quoted 7 lines

In the automount program, the log priority is set pretty early and much before the master map is setup. So we cannot check on the autofs dev either.

What would be the best way to solve this? Should we just document it as a feature loss?

Haven't actually tested this but it should work to fix the log priority

for /-.

Could you give it a try please.

autofs-5.1.9 - fix handling of direct mount path in command handler

From: Ian Kent <[email protected]>

Commit 16ea4156471e ("autofs-5.1.8 - switch to application wide command pipe") broke the ability to set the log priority from the command line for all direct mounts.

As Goldwyn Rodrigues points out the autofs_point structure for direct mounts doesn't have a real mount associated with it so it needs special handling which was ommitted in commit 16ea4156471e.

Fixes 16ea4156471e ("autofs-5.1.8 - switch to application wide command pipe")
---
 CHANGELOG          |    1 +
 daemon/automount.c |   17 +++++++++++++++--
 daemon/master.c    |   11 +++++++++++
 include/master.h   |    3 ++-
 4 files changed, 29 insertions(+), 3 deletions(-)
CHANGELOG +1 -0
index d6d594e9e..0fc529f32 100644
@@ -89,6 +89,7 @@
 - do_reconnect() expiry check of dclist BEFORE lookup using it.
 - fix mailing list subscription address.
 - fix table_lookup_ino() fd reference.
+- fix handling of direct mount path in command handler.
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
daemon/automount.c +15 -2
index 517764119..a01d176ae 100644
@@ -1487,7 +1487,13 @@ static void handle_cmd_pipe_fifo_message(int fd)
 		return;
 	}
 
-	ap = master_find_mapent_by_devid(devid);
+	/* There's no "real" devid for the top level direct mount
+	 * container so we use -1.
+	 */
+	if (devid == -1)
+		ap = master_find_mapent_by_path("/-");
+	else
+		ap = master_find_mapent_by_devid(devid);
 	if (!ap) {
 		error(LOGOPT_ANY, "can't locate autofs_point for device id %ld.", devid);
 		return;
@@ -1548,7 +1554,14 @@ static int set_log_priority(const char *path, int priority)
 	if (!ops) {
 		fprintf(stderr, "Could not get ioctl ops\n");
 		return -1;
-	} else {
+	}
+
+	/* There's no "real" devid for the top level direct mount
+	 * container so we use -1.
+	 */
+	if (!strcmp(path, "/-"))
+		devid = -1;
+	else {
 		ret = ops->mount_device(LOGOPT_ANY, path, 0, &devid);
 		if (ret == -1 || ret == 0) {
 			fprintf(stderr,
daemon/master.c +11 -0
index d85dd8975..8b7450e73 100644
@@ -711,6 +711,17 @@ struct master_mapent *master_find_mapent(const char *path)
 	return NULL;
 }
 
+struct autofs_point *master_find_mapent_by_path(const char *path)
+{
+	struct autofs_point *ap = NULL;
+	struct master_mapent *entry;
+
+	entry = master_find_mapent(path);
+	if (entry)
+		ap = entry->ap;
+	return ap;
+}
+
 struct autofs_point *master_find_mapent_by_devid(dev_t devid)
 {
 	struct master *master = master_list;
include/master.h +2 -1
index 71610611f..3ca7ad8d6 100644
@@ -105,7 +105,8 @@ void master_source_readlock(struct master_mapent *);
 void master_source_unlock(struct master_mapent *);
 void master_source_lock_cleanup(void *);
 struct master_mapent *master_find_mapent(const char *);
-struct autofs_point *master_find_mapent_by_devid(dev_t devid);
+struct autofs_point *master_find_mapent_by_path(const char *);
+struct autofs_point *master_find_mapent_by_devid(dev_t);
 struct master_mapent *master_new_mapent(const char *, time_t);
 void master_add_mapent(struct master_mapent *);
 void master_remove_mapent(struct master_mapent *);
#3 lore raw
Quoted 24 lines · Ian Kent
Quoted 15 lines · Goldwyn Rodrigues

Hello,

Since the work to have a single FIFO file for setting log priority (16ea4156 ("autofs-5.1.8 - switch to application wide command pipe"), to be more precise 16ea4156 (autofs-5.1.8 - switch to application wide command pipe), automount has lost the ability to set the log priority of all direct mounts using the path "/-".

# sudo automount -l info /-
Could not find device id for mount /-

This is because automount attempts to mount and get verifies the real path which is non-existent in case of direct mounts "/-".

Quoted 7 lines

In the automount program, the log priority is set pretty early and much before the master map is setup. So we cannot check on the autofs dev either.

What would be the best way to solve this? Should we just document it as a feature loss?

Quoted 5 lines

Haven't actually tested this but it should work to fix the log priority

for /-.

Could you give it a try please.

Yes, this fixes the log setting and works as expected. Thanks!

Quoted 105 lines

autofs-5.1.9 - fix handling of direct mount path in command handler

From: Ian Kent <[email protected]>

Commit 16ea4156471e ("autofs-5.1.8 - switch to application wide command pipe") broke the ability to set the log priority from the command line for all direct mounts.

As Goldwyn Rodrigues points out the autofs_point structure for direct mounts doesn't have a real mount associated with it so it needs special handling which was ommitted in commit 16ea4156471e.

Fixes 16ea4156471e ("autofs-5.1.8 - switch to application wide command pipe")
---
 CHANGELOG          |    1 +
 daemon/automount.c |   17 +++++++++++++++--
 daemon/master.c    |   11 +++++++++++
 include/master.h   |    3 ++-
 4 files changed, 29 insertions(+), 3 deletions(-)
CHANGELOG +1 -0
index d6d594e9e..0fc529f32 100644
@@ -89,6 +89,7 @@
 - do_reconnect() expiry check of dclist BEFORE lookup using it.
 - fix mailing list subscription address.
 - fix table_lookup_ino() fd reference.
+- fix handling of direct mount path in command handler.
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
daemon/automount.c +15 -2
index 517764119..a01d176ae 100644
@@ -1487,7 +1487,13 @@ static void handle_cmd_pipe_fifo_message(int fd)
 		return;
 	}
-	ap = master_find_mapent_by_devid(devid);
+	/* There's no "real" devid for the top level direct mount
+	 * container so we use -1.
+	 */
+	if (devid == -1)
+		ap = master_find_mapent_by_path("/-");
+	else
+		ap = master_find_mapent_by_devid(devid);
 	if (!ap) {
 		error(LOGOPT_ANY, "can't locate autofs_point for device id %ld.", devid);
 		return;
@@ -1548,7 +1554,14 @@ static int set_log_priority(const char *path, int priority)
 	if (!ops) {
 		fprintf(stderr, "Could not get ioctl ops\n");
 		return -1;
-	} else {
+	}
+
+	/* There's no "real" devid for the top level direct mount
+	 * container so we use -1.
+	 */
+	if (!strcmp(path, "/-"))
+		devid = -1;
+	else {
 		ret = ops->mount_device(LOGOPT_ANY, path, 0, &devid);
 		if (ret == -1 || ret == 0) {
 			fprintf(stderr,
daemon/master.c +11 -0
index d85dd8975..8b7450e73 100644
@@ -711,6 +711,17 @@ struct master_mapent *master_find_mapent(const char *path)
 	return NULL;
 }
+struct autofs_point *master_find_mapent_by_path(const char *path)
+{
+	struct autofs_point *ap = NULL;
+	struct master_mapent *entry;
+
+	entry = master_find_mapent(path);
+	if (entry)
+		ap = entry->ap;
+	return ap;
+}
+
 struct autofs_point *master_find_mapent_by_devid(dev_t devid)
 {
 	struct master *master = master_list;
include/master.h +2 -1
index 71610611f..3ca7ad8d6 100644
@@ -105,7 +105,8 @@ void master_source_readlock(struct master_mapent *);
 void master_source_unlock(struct master_mapent *);
 void master_source_lock_cleanup(void *);
 struct master_mapent *master_find_mapent(const char *);
-struct autofs_point *master_find_mapent_by_devid(dev_t devid);
+struct autofs_point *master_find_mapent_by_path(const char *);
+struct autofs_point *master_find_mapent_by_devid(dev_t);
 struct master_mapent *master_new_mapent(const char *, time_t);
 void master_add_mapent(struct master_mapent *);
 void master_remove_mapent(struct master_mapent *);
Signature · 1 line
Goldwyn
#4 lore raw
In reply to Ian Kent

Hi Ian,

Thanks for fixing this, it was my request originally. It is super useful to be able to change the log level for the whole direct map with one command when that map is tens of thousands of entries long.

Regards,

-Deke

Quoted 146 lines · Ian Kent

WARNING: This email originated from outside of Qualcomm. Please be wary of any links or attachments, and do not enable macros.

Quoted 15 lines · Goldwyn Rodrigues

Hello,

Since the work to have a single FIFO file for setting log priority (16ea4156 ("autofs-5.1.8 - switch to application wide command pipe"), to be more precise 16ea4156 (autofs-5.1.8 - switch to application wide command pipe), automount has lost the ability to set the log priority of all direct mounts using the path "/-".

# sudo automount -l info /-
Could not find device id for mount /-

This is because automount attempts to mount and get verifies the real path which is non-existent in case of direct mounts "/-".

Quoted 7 lines

In the automount program, the log priority is set pretty early and much before the master map is setup. So we cannot check on the autofs dev either.

What would be the best way to solve this? Should we just document it as a feature loss?

Haven't actually tested this but it should work to fix the log priority

for /-.

Could you give it a try please.

autofs-5.1.9 - fix handling of direct mount path in command handler

From: Ian Kent <[email protected]>

Commit 16ea4156471e ("autofs-5.1.8 - switch to application wide command pipe") broke the ability to set the log priority from the command line for all direct mounts.

As Goldwyn Rodrigues points out the autofs_point structure for direct mounts doesn't have a real mount associated with it so it needs special handling which was ommitted in commit 16ea4156471e.

Fixes 16ea4156471e ("autofs-5.1.8 - switch to application wide command pipe")
---
 CHANGELOG          |    1 +
 daemon/automount.c |   17 +++++++++++++++--
 daemon/master.c    |   11 +++++++++++
 include/master.h   |    3 ++-
 4 files changed, 29 insertions(+), 3 deletions(-)
CHANGELOG +1 -0
index d6d594e9e..0fc529f32 100644
@@ -89,6 +89,7 @@
 - do_reconnect() expiry check of dclist BEFORE lookup using it.
 - fix mailing list subscription address.
 - fix table_lookup_ino() fd reference.
+- fix handling of direct mount path in command handler.
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
daemon/automount.c +7 -1
index 517764119..a01d176ae 100644
@@ -1487,7 +1487,13 @@ static void handle_cmd_pipe_fifo_message(int fd)
               return;
       }
 
-       ap = master_find_mapent_by_devid(devid);
+       /* There's no "real" devid for the top level direct mount
+        * container so we use -1.
+        */
+       if (devid == -1)
+               ap = master_find_mapent_by_path("/-");
+       else
+               ap = master_find_mapent_by_devid(devid);
       if (!ap) {
               error(LOGOPT_ANY, "can't locate autofs_point for device id
               %ld.", devid);
               return;
daemon/automount.c +8 -1
@@ -1548,7 +1554,14 @@ static int set_log_priority(const char *path, int
 priority)
       if (!ops) {
               fprintf(stderr, "Could not get ioctl ops\n");
               return -1;
-       } else {
+       }
+
+       /* There's no "real" devid for the top level direct mount
+        * container so we use -1.
+        */
+       if (!strcmp(path, "/-"))
+               devid = -1;
+       else {
               ret = ops->mount_device(LOGOPT_ANY, path, 0, &devid);
               if (ret == -1 || ret == 0) {

fprintf(stderr,

daemon/master.c +11 -0
index d85dd8975..8b7450e73 100644
@@ -711,6 +711,17 @@ struct master_mapent *master_find_mapent(const char
 *path)
       return NULL;
 }
 
+struct autofs_point *master_find_mapent_by_path(const char *path)
+{
+       struct autofs_point *ap = NULL;
+       struct master_mapent *entry;
+
+       entry = master_find_mapent(path);
+       if (entry)
+               ap = entry->ap;
+       return ap;
+}
+
 struct autofs_point *master_find_mapent_by_devid(dev_t devid)
 {
       struct master *master = master_list;
include/master.h +2 -1
index 71610611f..3ca7ad8d6 100644
@@ -105,7 +105,8 @@ void master_source_readlock(struct master_mapent *);
 void master_source_unlock(struct master_mapent *);
 void master_source_lock_cleanup(void *);
 struct master_mapent *master_find_mapent(const char *);
-struct autofs_point *master_find_mapent_by_devid(dev_t devid);
+struct autofs_point *master_find_mapent_by_path(const char *);
+struct autofs_point *master_find_mapent_by_devid(dev_t);
 struct master_mapent *master_new_mapent(const char *, time_t);
 void master_add_mapent(struct master_mapent *);
 void master_remove_mapent(struct master_mapent *);
maintainer
#5 lore raw
Quoted 5 lines · Deke Clinger

Hi Ian,

Thanks for fixing this, it was my request originally. It is super useful to be able to change the log level for the whole direct map with one command when that map is tens of thousands of entries long.

No problem Deke, it was a regression after all.

Goldwyn, I'll push this to the autofs repo. then.

Ian

Quoted 174 lines

Regards,

-Deke

Quoted 167 lines · Ian Kent

WARNING: This email originated from outside of Qualcomm. Please be wary of any
links or attachments, and do not enable macros.

Quoted 26 lines · Goldwyn Rodrigues

Hello,

Since the work to have a single FIFO file for setting log priority
(16ea4156 ("autofs-5.1.8 - switch to application wide command pipe"), to
be more precise 16ea4156 (autofs-5.1.8 - switch to application wide
command pipe), automount has lost the ability to set the log priority of
all direct mounts using the path "/-".

# sudo automount -l info /-
Could not find device id for mount /-

This is because automount attempts to mount and get verifies the real
path which is non-existent in case of direct mounts "/-".

In the automount program, the log priority is set pretty early and much
before the master map is setup. So we cannot check on the autofs dev
either.

Quoted 4 lines

What would be the best way to solve this? Should we just document it
as a feature loss?

Haven't actually tested this but it should work to fix the log priority

for /-.

Could you give it a try please.

autofs-5.1.9 - fix handling of direct mount path in command handler

From: Ian Kent <[email protected]>

Commit 16ea4156471e ("autofs-5.1.8 - switch to application wide command
pipe") broke the ability to set the log priority from the command line
for all direct mounts.

As Goldwyn Rodrigues points out the autofs_point structure for direct
mounts doesn't have a real mount associated with it so it needs special
handling which was ommitted in commit 16ea4156471e.

Fixes 16ea4156471e ("autofs-5.1.8 - switch to application wide

command pipe")

---
 CHANGELOG          |    1 +
 daemon/automount.c |   17 +++++++++++++++--
 daemon/master.c    |   11 +++++++++++
 include/master.h   |    3 ++-

 4 files changed, 29 insertions(+), 3 deletions(-)
CHANGELOG +0 -0
index d6d594e9e..0fc529f32 100644
@@ -89,6 +89,7 @@

 - do_reconnect() expiry check of dclist BEFORE lookup using it.
 - fix mailing list subscription address.
 - fix table_lookup_ino() fd reference.
+- fix handling of direct mount path in command handler.

 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.

daemon/automount.c +7 -1
index 517764119..a01d176ae 100644
@@ -1487,7 +1487,13 @@ static void handle_cmd_pipe_fifo_message(int
 fd)
                return;
        }
 
-       ap = master_find_mapent_by_devid(devid);
+       /* There's no "real" devid for the top level direct mount
+        * container so we use -1.
+        */
+       if (devid == -1)
+               ap = master_find_mapent_by_path("/-");
+       else
+               ap = master_find_mapent_by_devid(devid);
        if (!ap) {

               error(LOGOPT_ANY, "can't locate autofs_point for device id
               %ld.", devid);
               return;

daemon/automount.c +8 -1
@@ -1548,7 +1554,14 @@ static int set_log_priority(const char
 *path, int
 priority)
        if (!ops) {
                fprintf(stderr, "Could not get ioctl ops\n");
                return -1;
-       } else {
+       }
+
+       /* There's no "real" devid for the top level direct mount
+        * container so we use -1.
+        */
+       if (!strcmp(path, "/-"))
+               devid = -1;
+       else {
                ret = ops->mount_device(LOGOPT_ANY, path, 0,

&devid);
               if (ret == -1 || ret == 0) {
                       fprintf(stderr,

daemon/master.c +0 -0
index d85dd8975..8b7450e73 100644
@@ -711,6 +711,17 @@ struct master_mapent *master_find_mapent(const

char
*path)
       return NULL;
 }

daemon/master.c +11 -0
+struct autofs_point *master_find_mapent_by_path(const char *path)
+{
+       struct autofs_point *ap = NULL;
+       struct master_mapent *entry;
+
+       entry = master_find_mapent(path);
+       if (entry)
+               ap = entry->ap;
+       return ap;
+}
+

 struct autofs_point *master_find_mapent_by_devid(dev_t devid) {
       struct master *master = master_list;

include/master.h +2 -1
index 71610611f..3ca7ad8d6 100644
@@ -105,7 +105,8 @@ void master_source_readlock(struct
 master_mapent *);
  void master_source_unlock(struct master_mapent *);
  void master_source_lock_cleanup(void *);
  struct master_mapent *master_find_mapent(const char *);
-struct autofs_point *master_find_mapent_by_devid(dev_t devid);
+struct autofs_point *master_find_mapent_by_path(const char *);
+struct autofs_point *master_find_mapent_by_devid(dev_t);
  struct master_mapent *master_new_mapent(const char *, time_t);
  void master_add_mapent(struct master_mapent *);

 void master_remove_mapent(struct master_mapent *);