From f6e6660362b0bf9b3ec5789faa2d256de71a7595 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Mon, 23 May 2022 22:07:37 +0100 Subject: [PATCH] dll: fuse: gracefully handle ENOSYS from xattr calls --- src/dll/fuse/fuse_intf.c | 4 ++-- src/dll/fuse/fuse_loop.c | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dll/fuse/fuse_intf.c b/src/dll/fuse/fuse_intf.c index 24ae44d7..5ee5d739 100644 --- a/src/dll/fuse/fuse_intf.c +++ b/src/dll/fuse/fuse_intf.c @@ -1028,7 +1028,7 @@ static NTSTATUS fsp_fuse_intf_Create(FSP_FILE_SYSTEM *FileSystem, { Result = FspFileSystemEnumerateEa(FileSystem, fsp_fuse_intf_SetEaEntry, contexthdr->PosixPath, ExtraBuffer, ExtraLength); - if (!NT_SUCCESS(Result)) + if (!NT_SUCCESS(Result) && STATUS_INVALID_DEVICE_REQUEST != Result) goto exit; } else @@ -1256,7 +1256,7 @@ static NTSTATUS fsp_fuse_intf_Overwrite(FSP_FILE_SYSTEM *FileSystem, Result = FspFileSystemEnumerateEa(FileSystem, fsp_fuse_intf_SetEaEntry, filedesc->PosixPath, Ea, EaLength); - if (!NT_SUCCESS(Result)) + if (!NT_SUCCESS(Result) && STATUS_INVALID_DEVICE_REQUEST != Result) return Result; } diff --git a/src/dll/fuse/fuse_loop.c b/src/dll/fuse/fuse_loop.c index 7da22a8a..7cb78186 100644 --- a/src/dll/fuse/fuse_loop.c +++ b/src/dll/fuse/fuse_loop.c @@ -188,7 +188,15 @@ static NTSTATUS fsp_fuse_loop_start(struct fuse *f) f->VolumeParams.PostDispositionWhenNecessaryOnly = 1; if (0 != f->ops.listxattr && 0 != f->ops.getxattr && 0 != f->ops.setxattr && 0 != f->ops.removexattr) - f->VolumeParams.ExtendedAttributes = 1; + { + char buf[1024]; + int err; + + /* if this fails with ENOSYS, then no EA support */ + err = f->ops.getxattr("/", + "non-existant-a11ec902d22f4ec49003af15282d3b00", buf, sizeof buf); + f->VolumeParams.ExtendedAttributes = -ENOSYS_(f->env) != err; + } /* the FSD does not currently limit these VolumeParams fields; do so here! */ if (f->VolumeParams.SectorSize < FSP_FUSE_SECTORSIZE_MIN ||