wayland flock failed with NFS
Hi
The flock() failed in wayland when I use NFS boot. I have a host (X86 Ubuntu) connecting to a target (Arm ubuntu), and share a directory on host (like ~/nfsroot) with NFS. The target is booting from the host's ~/nfsroot directory. Then I run into this issue.
Here is the original log.
[15:59:03.592] libwayland: unable to lock lockfile /tmp/xdg/wayland-0.lock, maybe another compositor is running
[15:59:03.593] libwayland: unable to lock lockfile /tmp/xdg/wayland-1.lock, maybe another compositor is running
[15:59:03.594] libwayland: unable to lock lockfile /tmp/xdg/wayland-2.lock, maybe another compositor is running
[15:59:03.595] libwayland: unable to lock lockfile /tmp/xdg/wayland-3.lock, maybe another compositor is running
[15:59:03.597] libwayland: unable to lock lockfile /tmp/xdg/wayland-4.lock, maybe another compositor is running
[15:59:03.598] libwayland: unable to lock lockfile /tmp/xdg/wayland-5.lock, maybe another compositor is running
[15:59:03.599] libwayland: unable to lock lockfile /tmp/xdg/wayland-6.lock, maybe another compositor is running
[15:59:03.600] libwayland: unable to lock lockfile /tmp/xdg/wayland-7.lock, maybe another compositor is running
[15:59:03.601] libwayland: unable to lock lockfile /tmp/xdg/wayland-8.lock, maybe another compositor is running
[15:59:03.602] libwayland: unable to lock lockfile /tmp/xdg/wayland-9.lock, maybe another compositor is running
[15:59:03.604] libwayland: unable to lock lockfile /tmp/xdg/wayland-10.lock, maybe another compositor is running
[15:59:03.605] libwayland: unable to lock lockfile /tmp/xdg/wayland-11.lock, maybe another compositor is running
[15:59:03.606] libwayland: unable to lock lockfile /tmp/xdg/wayland-12.lock, maybe another compositor is running
[15:59:03.607] libwayland: unable to lock lockfile /tmp/xdg/wayland-13.lock, maybe another compositor is running
[15:59:03.608] libwayland: unable to lock lockfile /tmp/xdg/wayland-14.lock, maybe another compositor is running
[15:59:03.610] libwayland: unable to lock lockfile /tmp/xdg/wayland-15.lock, maybe another compositor is running
[15:59:03.611] libwayland: unable to lock lockfile /tmp/xdg/wayland-16.lock, maybe another compositor is running
[15:59:03.612] libwayland: unable to lock lockfile /tmp/xdg/wayland-17.lock, maybe another compositor is running
[15:59:03.613] libwayland: unable to lock lockfile /tmp/xdg/wayland-18.lock, maybe another compositor is running
[15:59:03.614] libwayland: unable to lock lockfile /tmp/xdg/wayland-19.lock, maybe another compositor is running
[15:59:03.615] libwayland: unable to lock lockfile /tmp/xdg/wayland-20.lock, maybe another compositor is running
[15:59:03.617] libwayland: unable to lock lockfile /tmp/xdg/wayland-21.lock, maybe another compositor is running
[15:59:03.618] libwayland: unable to lock lockfile /tmp/xdg/wayland-22.lock, maybe another compositor is running
[15:59:03.619] libwayland: unable to lock lockfile /tmp/xdg/wayland-23.lock, maybe another compositor is running
[15:59:03.620] libwayland: unable to lock lockfile /tmp/xdg/wayland-24.lock, maybe another compositor is running
[15:59:03.621] libwayland: unable to lock lockfile /tmp/xdg/wayland-25.lock, maybe another compositor is running
[15:59:03.622] libwayland: unable to lock lockfile /tmp/xdg/wayland-26.lock, maybe another compositor is running
[15:59:03.623] libwayland: unable to lock lockfile /tmp/xdg/wayland-27.lock, maybe another compositor is running
[15:59:03.624] libwayland: unable to lock lockfile /tmp/xdg/wayland-28.lock, maybe another compositor is running
[15:59:03.626] libwayland: unable to lock lockfile /tmp/xdg/wayland-29.lock, maybe another compositor is running
[15:59:03.627] libwayland: unable to lock lockfile /tmp/xdg/wayland-30.lock, maybe another compositor is running
[15:59:03.628] libwayland: unable to lock lockfile /tmp/xdg/wayland-31.lock, maybe another compositor is running
[15:59:03.629] libwayland: unable to lock lockfile /tmp/xdg/wayland-32.lock, maybe another compositor is running
[15:59:03.677] fatal: failed to add socket: No such file or directory
After I add more log, the errno of flock() is 9, which is EBADF=Bad file number.
unable to lock lockfile /tmp/xdg/wayland-0.lock, maybe another compositor is running, errno=9
I checked the man, looks like we need to add O_RDWR in the open() function. http://man7.org/linux/man-pages/man2/open.2.html
The argument flags must include one of the following access modes: O_RDONLY, O_WRONLY, or O_RDWR. These request opening the file read- only, write-only, or read/write, respectively.
This is my first-time upstream change and it seems there is a build failure. Can anyone review this change and let me know what to do next? renjiayuan1314/wayland@db525080
Thanks in advance. (modified several times to adjust the text format)