mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fs: Check if automount actually mounts something
@ 2022-07-14 19:35 Sascha Hauer
  2022-07-14 21:12 ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2022-07-14 19:35 UTC (permalink / raw)
  To: Barebox List; +Cc: Uwe Kleine-König

An automount command that returns successfully but doesn't mount
anything makes barebox hang as can be reproduced with:

automount -d /mnt/foo true
ls /mnt/foo

Check if the current dentry is a mountpoint after running the automount
command, otherwise return with an error from automount_mount().

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 460fc2f7f1..bd6f144742 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -3191,6 +3191,10 @@ static int automount_mount(struct dentry *dentry)
 			printf("running automount command '%s' failed\n",
 					am->cmd);
 			ret = -ENODEV;
+		} else if (!(dentry->d_flags & DCACHE_MOUNTED)) {
+			printf("automount command '%s' didn't mount anything\n",
+					am->cmd);
+			ret = -ENODEV;
 		}
 
 		break;
-- 
2.30.2




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-10  6:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 19:35 [PATCH] fs: Check if automount actually mounts something Sascha Hauer
2022-07-14 21:12 ` Uwe Kleine-König
2022-08-09 10:06   ` Sascha Hauer
2022-08-09 13:05     ` Uwe Kleine-König
2022-08-10  6:44       ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox