summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox/busybox/fail_on_no_media.patch
blob: 38db52538e9084caf1acc2c2c303e91932bb64a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From a35e79002d36cca3c272ba5625aec86d6b7a38a8 Mon Sep 17 00:00:00 2001
From: Saul Wold <sgw@linux.intel.com>
Date: Tue, 9 Apr 2013 23:25:54 -0700
Subject: [PATCH] busybox: fail on no media

Upstream-Status: Denied
[https://www.mail-archive.com/busybox@busybox.net/msg22354.html]

The current behaviour of busybox is to try all fstype when automounting
even when no media exists.  The util-linux mount command bails when no
media exists, so change the behaviour of busybox to do the same.

It could also be argued that the KERN_INFO message from btrfs could be
removed, but that would be harder to accomplish.

Signed-off-by: Saul Wold <sgw@linux.intel.com>

---
 util-linux/mount.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/util-linux/mount.c b/util-linux/mount.c
index 4e65b6b..9d7a566 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -746,6 +746,14 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
 			errno = errno_save;
 		}
 
+		/*
+		 * Break if there is no media, no point retrying for all
+		 * fs types since there is no media available
+		 */
+		if (rc == -1 && errno == ENOMEDIUM) {
+			bb_perror_msg_and_die("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
+		}
+
 		// Should we retry read-only mount?
 		if (vfsflags & MS_RDONLY)
 			break;		// no, already was tried