mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: [PATCH] fs: Check if automount actually mounts something
Date: Thu, 14 Jul 2022 21:35:09 +0200	[thread overview]
Message-ID: <20220714193509.2134503-1-s.hauer@pengutronix.de> (raw)

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




             reply	other threads:[~2022-07-14 19:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 19:35 Sascha Hauer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220714193509.2134503-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox