Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | From a35e79002d36cca3c272ba5625aec86d6b7a38a8 Mon Sep 17 00:00:00 2001 |
| 2 | From: Saul Wold <sgw@linux.intel.com> |
| 3 | Date: Tue, 9 Apr 2013 23:25:54 -0700 |
| 4 | Subject: [PATCH] busybox: fail on no media |
| 5 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 6 | Upstream-Status: Denied |
| 7 | [https://www.mail-archive.com/busybox@busybox.net/msg22354.html] |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 | |
| 9 | The current behaviour of busybox is to try all fstype when automounting |
| 10 | even when no media exists. The util-linux mount command bails when no |
| 11 | media exists, so change the behaviour of busybox to do the same. |
| 12 | |
| 13 | It could also be argued that the KERN_INFO message from btrfs could be |
| 14 | removed, but that would be harder to accomplish. |
| 15 | |
| 16 | Signed-off-by: Saul Wold <sgw@linux.intel.com> |
| 17 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 18 | --- |
| 19 | util-linux/mount.c | 8 ++++++++ |
| 20 | 1 file changed, 8 insertions(+) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 21 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 22 | diff --git a/util-linux/mount.c b/util-linux/mount.c |
| 23 | index 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | errno = errno_save; |
| 28 | } |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 29 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | + } |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 37 | + |
| 38 | // Should we retry read-only mount? |
| 39 | if (vfsflags & MS_RDONLY) |
| 40 | break; // no, already was tried |