From: "Yang Xu (Fujitsu)" <xuyang2018.jy@fujitsu.com>
To: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>,
Zorro Lang <zlang@redhat.com>
Cc: Gao Xiang <hsiangkao@linux.alibaba.com>,
"fstests@vger.kernel.org" <fstests@vger.kernel.org>,
Christian Brauner <brauner@kernel.org>
Subject: Re: [PATCH v2] src: fix detached_mounts_propagation compile errors
Date: Tue, 25 Apr 2023 02:07:46 +0000 [thread overview]
Message-ID: <580596e9-6bc0-99e9-41e6-5996af1d39a3@fujitsu.com> (raw)
In-Reply-To: <20b80d9e-9ef1-0811-152d-0f0f0eff7615@linux.alibaba.com>
on 2023/04/25 9:59, Ziyang Zhang wrote:
> On 2023/4/25 09:28, Yang Xu (Fujitsu) wrote:
>>
>
> [...]
>
>>>
>>> Looks like not help [1]. The src/feature.c through global.h -> xfs/xfs.h
>>> -> xfs/linux.h -> linux/fs.h to include linux/mount.h, then it include
>>> "vfs/missing.h" manually. As you add "<sys/mount.h>" to vfs/missing.h,
>>> so there's a conflict.
>>
>> Yes, here is a complex problem than ltp because global.h includes
>> <linux/mount.h>. We don't include <sys/mount.h> or <linux/mount.h>
>> together on older glibc(glibc 2.36.6). Newer glibc(glibc-2.37-1)[1]
>> seems has sloved this problem.
>>
>> [1]https://sourceware.org/git/?p=glibc.git;a=commit;h=774058d72942249f71d74e7f2b639f77184160a6
>>
>> I guess we can not use <sys/mount.h> header,
>> then compile info as below:
>> detached_mounts_propagation.c: In function 'main':
>> detached_mounts_propagation.c:129:15: warning: implicit declaration of
>> function 'mount' [-Wimplicit-function-declaration]
>> 129 | ret = mount(NULL, base_dir, NULL, MS_REC | MS_SHARED,
>> NULL);
>> | ^~~~~
>> detached_mounts_propagation.c:176:23: warning: implicit declaration of
>> function 'umount2'; did you mean 'sys_umount2'?
>> [-Wimplicit-function-declaration]
>> 176 | ret = umount2(target, MNT_DETACH);
>> | ^~~~~~~
>> | sys_umount2
>>
>>
>> then we can use syscall wrapper directly instead of glibc wrapper
>> --- a/src/detached_mounts_propagation.c
>> +++ b/src/detached_mounts_propagation.c
>> @@ -20,7 +20,6 @@
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <string.h>
>> -#include <sys/mount.h>
>> #include <sys/stat.h>
>> #include <sys/syscall.h>
>> #include <sys/types.h>
>> @@ -127,7 +126,7 @@ int main(int argc, char *argv[])
>> if (ret < 0)
>> exit_log("%m - Failed to create new mount namespace");
>>
>> - ret = mount(NULL, base_dir, NULL, MS_REC | MS_SHARED, NULL);
>> + ret = sys_mount(NULL, base_dir, NULL, MS_REC | MS_SHARED, NULL);
>> if (ret < 0)
>> exit_log("%m - Failed to make base_dir shared mountpoint");
>>
>> @@ -174,7 +173,7 @@ int main(int argc, char *argv[])
>> }
>> close(fd_tree);
>>
>> - ret = umount2(target, MNT_DETACH);
>> + ret = sys_umount2(target, MNT_DETACH);
>> if (ret < 0) {
>> fprintf(stderr, "%m - Failed to unmount %s",
>> target);
>> exit_code = EXIT_FAILURE;
>>
>>
>> Best Regards
>> Yang Xu
>>
>
> Hi Yang,
>
> You patch works for me(kernel: 5.10.134, glibc:2.36). I think we could just
> modify detached_mounts_propagation.c to solve this problem.
OK, @Gao @Ziyang, so should I send a patch or you send it?
Best Regards
Yang Xu
>
> Regards,
> Zhang
next prev parent reply other threads:[~2023-04-25 2:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-19 3:29 [PATCH] src: fix detached_mounts_propagation compile errors Gao Xiang
2023-04-19 8:45 ` Christian Brauner
2023-04-19 9:04 ` Gao Xiang
2023-04-19 9:08 ` Yang Xu (Fujitsu)
2023-04-20 2:11 ` [PATCH v2] " Gao Xiang
2023-04-20 8:42 ` Christian Brauner
2023-04-22 13:54 ` Zorro Lang
2023-04-24 3:13 ` Gao Xiang
2023-04-24 10:17 ` Ziyang Zhang
2023-04-24 21:06 ` Zorro Lang
2023-04-25 1:28 ` Yang Xu (Fujitsu)
2023-04-25 1:59 ` Ziyang Zhang
2023-04-25 2:07 ` Yang Xu (Fujitsu) [this message]
2023-04-25 3:18 ` Ziyang Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=580596e9-6bc0-99e9-41e6-5996af1d39a3@fujitsu.com \
--to=xuyang2018.jy@fujitsu.com \
--cc=ZiyangZhang@linux.alibaba.com \
--cc=brauner@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hsiangkao@linux.alibaba.com \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox