diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -625,7 +625,7 @@ return (EROFS); if (fsess_not_impl(mp, FUSE_FALLOCATE)) - return (EXTERROR(EINVAL, "This server does not implement " + return (EXTERROR(EOPNOTSUPP, "This server does not implement " "FUSE_FALLOCATE")); io.uio_offset = *offset; @@ -656,7 +656,7 @@ if (err == ENOSYS) { fsess_set_notimpl(mp, FUSE_FALLOCATE); - err = EXTERROR(EINVAL, "This server does not implement " + err = EXTERROR(EOPNOTSUPP, "This server does not implement " "FUSE_ALLOCATE"); } else if (err == EOPNOTSUPP) { /* diff --git a/tests/sys/fs/fusefs/fallocate.cc b/tests/sys/fs/fusefs/fallocate.cc --- a/tests/sys/fs/fusefs/fallocate.cc +++ b/tests/sys/fs/fusefs/fallocate.cc @@ -205,7 +205,7 @@ EXPECT_EQ(0, fspacectl(fd, SPACECTL_DEALLOC, &rqsr, 0, NULL)); /* Neither should posix_fallocate query the daemon */ - EXPECT_EQ(EINVAL, posix_fallocate(fd, off1, len1)); + EXPECT_EQ(EOPNOTSUPP, posix_fallocate(fd, off1, len1)); leak(fd); } @@ -548,7 +548,7 @@ /* * If the server returns ENOSYS, it indicates that the server does not support - * FUSE_FALLOCATE. This and future calls should return EINVAL. + * FUSE_FALLOCATE. This and future calls should return EOPNOTSUPP. */ TEST_F(PosixFallocate, enosys) { @@ -570,10 +570,10 @@ fd = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd) << strerror(errno); - EXPECT_EQ(EINVAL, posix_fallocate(fd, off0, len0)); + EXPECT_EQ(EOPNOTSUPP, posix_fallocate(fd, off0, len0)); /* Subsequent calls shouldn't query the daemon*/ - EXPECT_EQ(EINVAL, posix_fallocate(fd, off0, len0)); + EXPECT_EQ(EOPNOTSUPP, posix_fallocate(fd, off0, len0)); /* Neither should VOP_DEALLOCATE query the daemon */ EXPECT_EQ(0, fspacectl(fd, SPACECTL_DEALLOC, &rqsr, 0, NULL)); @@ -759,7 +759,7 @@ } /* With older servers, no FUSE_FALLOCATE should be attempted */ -TEST_F(PosixFallocate_7_18, einval) +TEST_F(PosixFallocate_7_18, eopnotsupp) { const char FULLPATH[] = "mountpoint/some_file.txt"; const char RELPATH[] = "some_file.txt"; @@ -773,7 +773,7 @@ fd = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd) << strerror(errno); - EXPECT_EQ(EINVAL, posix_fallocate(fd, offset, length)); + EXPECT_EQ(EOPNOTSUPP, posix_fallocate(fd, offset, length)); leak(fd); }