openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.46k stars 1.73k forks source link

Error Message for Asynchronous IO #663

Closed pyavdr closed 12 years ago

pyavdr commented 12 years ago

Hi Brian,

while testing with the "aiostress" procedure stressing a zfs filestystem on a zpool, aiostress returned an error in io_submit (..), saying "invalid arguments". This function is part of libaio witch runs with no problems against an ext4 filesystem. As written in issue #223 asynchronous IO is not yet implemented in ZOL, which most likely caused that error.

It maybe that some of the newer issues like #626 is caused by #223. Rsync and Samba (there is an aio read/write size parameter) may try to use asynchronous IO, and other programms may try that too. It is depending on the programms if there is a check proving asynchronous I/O availiblity.

Just to be sure, is it possible to implement an error message from the kernel ( saying ... asynchronous IO not implemented...), to clearly identify such a case? Without that, there is a chance to fail over that issue, without knowing it.

There should be a warning on the ZOL FAQ ( Asychnronous IO not implemented) and a hint like "don´t use asynchronous IO with rsync and others .... "

Besides that warning, it may be fine to implement asynchronous IO in ZOL.

ryao commented 12 years ago

The error that you received from aiostress should be the error that you expected. In Linux, if a VFS operation is not defined, it is treated as being unimplemented.

For reference, the vfs implementations appear to be in ./module/zfs/zpl_file.c. You can find documentation on how this works in /usr/src/linux/Documentation/filesystems/vfs.txt.

pyavdr commented 12 years ago

io_submit has some defined return values:

EINVAL The aio_context specified by ctx_id is invalid. nr is less than 0. The iocb at *iocbpp[0] is not properly initial- ized, or the operation specified is invalid for the file descriptor in the iocb.

ENOSYS io_submit() is not implemented on this architecture. .. and more ...

Return value from io_submit is EINVAL (called by/from aiostress), which is at least misleading. I would expect ENOSYS for this situation, where there is no asynchronous interface to zfs.

This issue could be closed, when this return value EINVAL is ok .

rlaager commented 12 years ago

I would conclude: the operation is invalid for the file descriptor in the iocb, as it's on ZFS, which doesn't support aio. ENOSYS means your kernel doesn't have io_submit() at all.

ryao commented 12 years ago

The unintuitiveness of the error message is probably something that should be discussed with people the Linux Kernel Mailing list. The only thing we can do about it is to implement this functionality, but as you pointed out, issue #223 already exists for that.

behlendorf commented 12 years ago

I'm going to close this as a duplicate of #223.