Skip to contentSkip to conversation

nvdimm read EFAULT vs EIO

DISCUSSION Dan Williams 1 participant 1 message Jan 4, 2017 2 messages not in the archive libnvdimm: non-volatile memory device

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20170104164530.GA10372-lxVrvc10SDRcolVlb+j0YCZi+YwRKgec@public.gmane.org

#2 lore raw
Quoted 9 lines · Stefan Hajnoczi

In drivers/nvdimm/pmem.c:pmem_do_bvec() reads are handled as follows:

  if (unlikely(bad_pmem))
          rc = -EIO;
  else {
          rc = read_pmem(page, off, pmem_addr, len);
          flush_dcache_page(page);
  }
Quoted 5 lines

read_pmem() returns -EFAULT on error so the error return value of pmem_do_bvec() is either -EIO or -EFAULT. EFAULT strikes me as unusual for a function used in the block I/O code path.

Is the distinction between EIO and EFAULT significant for pmem_do_bvec() callers?

It looks like all users except btrfs just check if bi_error is non-zero

Quoted 1 line

If not, should the function return -EIO in both cases?

I'm leaning toward fixing up btrfs to handle all errors as I/O errors. Otherwise, it's not clear to me why fs/btrfs/volumes.c::btrfs_end_bio() would need to parse error codes, but drivers/md/raid5.c::raid5_end_read_request() does not.

Should probably address it both ways, make btrfs more tolerant in what it accepts and make pmem more consistent / conservative in what it sends.