It seems mount_setattr() is supported on Linux < 5.14, but it's without
MOUNT_ATTR_NOSYMFOLLOW. That's problem for remount where we reset all
VFS flags.
The most simple (but not elegant) is to check for kernel version and
fallback to mount(2) on remount.
Addresses: https://github.com/util-linux/util-linux/issues/2283
Signed-off-by: Karel Zak <kzak@redhat.com>
#include "mountP.h"
#include "fileutils.h" /* statx() fallback */
#include "mount-api-utils.h"
+#include "linux_version.h"
#include <inttypes.h>
if (!rc
&& cxt->helper == NULL
&& (set != 0 || clr != 0 || (flags & MS_REMOUNT))) {
+ /*
+ * mount_setattr() supported, but not usable for remount
+ * https://github.com/torvalds/linux/commit/dd8b477f9a3d8edb136207acb3652e1a34a661b7
+ */
+ if (get_linux_version() < KERNEL_VERSION(5, 14, 0))
+ goto enosys;
+
if (!mount_setattr_is_supported())
goto enosys;