[PATCH] libmount: don't fail do_mount_by_pattern() on EBUSY

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

 



Filesystems with subvolumes still take exclusive ownership of the block
device when mounted. If the mount command is later called for another
subvolume, it's possible that the do_mount_by_pattern() loop will
attempt a different filesystem first, which will fail immediately with
EBUSY.

I ran into this while working with an APFS driver, using util-linux
2.32.1. The problem is gone in more recent releases because mount can
now recognize APFS by the superblock, but allow EBUSY anyway in case
that fails.

Signed-off-by: Ernesto A. Fernández <ernesto@xxxxxxxxxxxxx>
---
 libmount/src/context_mount.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index 55ebf7945..69dc97465 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -957,7 +957,8 @@ static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern)
 		if (is_success_status(cxt))
 			break;
 		if (mnt_context_get_syscall_errno(cxt) != EINVAL &&
-		    mnt_context_get_syscall_errno(cxt) != ENODEV)
+		    mnt_context_get_syscall_errno(cxt) != ENODEV &&
+		    mnt_context_get_syscall_errno(cxt) != EBUSY)
 			break;
 	}
 	mnt_free_filesystems(filesystems);
-- 
2.27.0




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux