1From 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 6Upstream-Status: Denied 7[https://www.mail-archive.com/busybox@busybox.net/msg22354.html] 8 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 18--- 19 util-linux/mount.c | 8 ++++++++ 20 1 file changed, 8 insertions(+) 21 22diff --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 27 errno = errno_save; 28 } 29 30+ /* 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+ } 37+ 38 // Should we retry read-only mount? 39 if (vfsflags & MS_RDONLY) 40 break; // no, already was tried 41