Disable statx if using glibc emulation
diff mbox series

Message ID 20191205102736.24314-1-nazard@nazar.ca
State New
Headers show
Series
  • Disable statx if using glibc emulation
Related show

Commit Message

Doug Nazar Dec. 5, 2019, 10:27 a.m. UTC
On older kernels without statx, glibc with statx support will attempt
to emulate the call. However it doesn't support AT_STATX_DONT_SYNC and
will return EINVAL. This causes all xstat/xlstat calls to fail.

Signed-off-by: Doug Nazar <nazard@nazar.ca>
---
 support/misc/xstat.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Steve Dickson Dec. 9, 2019, 3:56 p.m. UTC | #1
On 12/5/19 5:27 AM, Doug Nazar wrote:
> On older kernels without statx, glibc with statx support will attempt
> to emulate the call. However it doesn't support AT_STATX_DONT_SYNC and
> will return EINVAL. This causes all xstat/xlstat calls to fail.
> 
> Signed-off-by: Doug Nazar <nazard@nazar.ca>
Committed... (tag: nfs-utils-2-4-3-rc3)

steved.

> ---
>  support/misc/xstat.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/support/misc/xstat.c b/support/misc/xstat.c
> index 661e29e4..a438fbcc 100644
> --- a/support/misc/xstat.c
> +++ b/support/misc/xstat.c
> @@ -51,6 +51,9 @@ statx_do_stat(int fd, const char *pathname, struct stat *statbuf, int flags)
>  			statx_copy(statbuf, &stxbuf);
>  			return 0;
>  		}
> +		/* glibc emulation doesn't support AT_STATX_DONT_SYNC */
> +		if (errno == EINVAL)
> +			errno = ENOSYS;
>  		if (errno == ENOSYS)
>  			statx_supported = 0;
>  	} else
>

Patch
diff mbox series

diff --git a/support/misc/xstat.c b/support/misc/xstat.c
index 661e29e4..a438fbcc 100644
--- a/support/misc/xstat.c
+++ b/support/misc/xstat.c
@@ -51,6 +51,9 @@  statx_do_stat(int fd, const char *pathname, struct stat *statbuf, int flags)
 			statx_copy(statbuf, &stxbuf);
 			return 0;
 		}
+		/* glibc emulation doesn't support AT_STATX_DONT_SYNC */
+		if (errno == EINVAL)
+			errno = ENOSYS;
 		if (errno == ENOSYS)
 			statx_supported = 0;
 	} else