hast: can't restore after disk failure

Mikolaj Golub to.my.trociny at gmail.com
Wed Jun 12 10:03:44 UTC 2013


On Wed, Jun 12, 2013 at 02:36:39AM -0700, Jeremy Chadwick wrote:

> I honestly cannot see how nv->nv_error (which is what nv_error()
> returns) gets set to ENOENT within the function call stack:
> 
> - metadata_read() is what prints the error (line 152 in nv.c)
> - Error printing done by pjdlog_errno(), which uses the global errno
>   to print its errors
> - nv = nv_ntoh(eb)
> - nv_ntoh() sets nv->nv_error to 0 initially, but then calls
>   nv_validate() later on which can modify nv->error
> - nv_validate() explicitly sets error (which later can get assigned
>   to nv->nv_error) to EINVAL in many cases, but not ENOENT.
> 
> Therefore, I am honestly not sure how ENOENT gets returned to the user
> in this case.  It looks like it's a misleading errno and is probably
> meant to be something else.  If it's correct, I would absolutely love
> for someone to show me how/where.

nv_find() (which is used by nv_get_* functions) sets ENOENT when it
fails.

"No such file or directory" really looks confusing in this case. I am
not sure what a code from errno.h would be better here though. ENOATTR?

-- 
Mikolaj Golub


More information about the freebsd-fs mailing list