summaryrefslogtreecommitdiff
path: root/libmount/src
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2023-04-24 17:29:05 +0200
committerKarel Zak <kzak@redhat.com>2023-04-24 17:29:05 +0200
commite828630a16c7c31bfbce228d6993c1cff7088152 (patch)
tree561476959792d68dd427e5d093f6edbd35be57a2 /libmount/src
parente1da142635acb9f044dfd98a49e15b37559a76d8 (diff)
downloadutil-linux-e828630a16c7c31bfbce228d6993c1cff7088152.tar.gz
libmount: recover from ENOSYS for the new API
Addresses: https://github.com/util-linux/util-linux/pull/2188 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
-rw-r--r--libmount/src/hook_mount.c11
-rw-r--r--libmount/src/mountP.h6
2 files changed, 16 insertions, 1 deletions
diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c
index 7fcf3f3f8..2dbe5217c 100644
--- a/libmount/src/hook_mount.c
+++ b/libmount/src/hook_mount.c
@@ -571,6 +571,8 @@ fake:
*
* Note that this function interprets classic MS_* flags by new Linux mount FD
* based API.
+ *
+ * Returns: 0 on success, <0 on error, >0 on recover-able error
*/
static int hook_prepare(struct libmnt_context *cxt,
const struct libmnt_hookset *hs,
@@ -614,8 +616,15 @@ static int hook_prepare(struct libmnt_context *cxt,
rc = mnt_optlist_get_attrs(ol, &set, &clr, 0);
/* open_tree() or fsopen() */
- if (!rc)
+ if (!rc) {
rc = init_sysapi(cxt, hs, flags);
+ if (rc && cxt->syscall_status == -ENOSYS) {
+ /* we need to recover from this error, so hook_mount_legacy.c
+ * can try to continue */
+ reset_syscall_status(cxt);
+ return 1;
+ }
+ }
/* check mutually exclusive operations */
if (!rc && (flags & MS_BIND) && (flags & MS_MOVE))
diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h
index d7ae6b7d2..a2ab4a814 100644
--- a/libmount/src/mountP.h
+++ b/libmount/src/mountP.h
@@ -490,6 +490,12 @@ struct libmnt_context
} \
})
+#define reset_syscall_status(_cxt) __extension__ ({ \
+ DBG(CXT, ul_debug("reset sycall status")); \
+ (_cxt)->syscall_status = 0; \
+ (_cxt)->syscall_name = NULL; \
+ })
+
/* optmap.c */
extern const struct libmnt_optmap *mnt_optmap_get_entry(
struct libmnt_optmap const **maps,