* [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; 2+ 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] 2+ messages in thread
* Re: [PATCH] fs: Check if automount actually mounts something
2022-07-14 19:35 [PATCH] fs: Check if automount actually mounts something Sascha Hauer
@ 2022-07-14 21:12 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2022-07-14 21:12 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
On Thu, Jul 14, 2022 at 09:35:09PM +0200, Sascha Hauer wrote:
> 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().
While I think the intention of this patch is fine, I have little doubts
if that breaks some workflows, e.g. something like:
automount -d /mnt/tralala 'for p in 0 1 2; do mkdir ${automount_path}/${p} && mount /dev/disk0.${p} ${automount_path}/${p} || break; done'
I admit it's a bit constructed, but maybe that's only because I'm not
creative enough?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-14 21:14 UTC | newest]
Thread overview: 2+ 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox