[PATCH] fs: Check if automount actually mounts something

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux