blob: 38db52538e9084caf1acc2c2c303e91932bb64a3 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From a35e79002d36cca3c272ba5625aec86d6b7a38a8 Mon Sep 17 00:00:00 2001
2From: Saul Wold <sgw@linux.intel.com>
3Date: Tue, 9 Apr 2013 23:25:54 -0700
4Subject: [PATCH] busybox: fail on no media
5
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05006Upstream-Status: Denied
7[https://www.mail-archive.com/busybox@busybox.net/msg22354.html]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008
9The current behaviour of busybox is to try all fstype when automounting
10even when no media exists. The util-linux mount command bails when no
11media exists, so change the behaviour of busybox to do the same.
12
13It could also be argued that the KERN_INFO message from btrfs could be
14removed, but that would be harder to accomplish.
15
16Signed-off-by: Saul Wold <sgw@linux.intel.com>
17
Andrew Geissler595f6302022-01-24 19:11:47 +000018---
19 util-linux/mount.c | 8 ++++++++
20 1 file changed, 8 insertions(+)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021
Andrew Geissler595f6302022-01-24 19:11:47 +000022diff --git a/util-linux/mount.c b/util-linux/mount.c
23index 4e65b6b..9d7a566 100644
24--- a/util-linux/mount.c
25+++ b/util-linux/mount.c
26@@ -746,6 +746,14 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027 errno = errno_save;
28 }
Andrew Geissler595f6302022-01-24 19:11:47 +000029
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030+ /*
31+ * Break if there is no media, no point retrying for all
32+ * fs types since there is no media available
33+ */
34+ if (rc == -1 && errno == ENOMEDIUM) {
35+ bb_perror_msg_and_die("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
36+ }
Andrew Geissler595f6302022-01-24 19:11:47 +000037+
38 // Should we retry read-only mount?
39 if (vfsflags & MS_RDONLY)
40 break; // no, already was tried