On Thu, Apr 27, 2023 at 04:36:58PM -0700, Jane Chu wrote: > > This change results in EHWPOISON leaking to usersapce in the case of > > read(2), that's not a return code that block I/O applications have ever > > had to contend with before. Just as badblocks cause EIO to be returned, > > so should poisoned cachelines for pmem. > > The read(2) man page (https://man.archlinux.org/man/read.2) says > "On error, -1 is returned, and errno is set to indicate the error. In this > case, it is left unspecified whether the file position (if any) changes." > > If read(2) users haven't dealt with EHWPOISON before, they may discover that > with pmem backed dax file, it's possible. I don't think they should. While syscalls are allowed to return errnos other than the ones listed in POSIX, I don't think this is a worthwhile difference. We should be abstracting from the user that this is pmem rather than spinning rust or nand. So we should convert the EHWPOISON to EIO as Dan suggests.