tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: genfs ignoring VOP_STRATEGY() buf's returned error



On Thu, Mar 26, 2009 at 06:12:23PM +0100, Reinoud Zandijk wrote:
> Dear folks,
> 
> i've noticed that if a FS returns an error in its VOP_STRATEGY() its bluntly
> ignored by genfs resulting in a cp(1) action just continuing as if nothing
> happend. With the accompanied patch the cp(1) action returns the error as it
> should be. gop_write() calls genfs_do_io() but returns the error it gets from
> genfs_do_io(). That error is allways zero if its done async so the cp(1)
> action never gets the signal that something is wrong.
> 
> The patch fixes this by returning the error from the mbp buffer. If the
> transaction can be done in one buffer this is correct, if it needs to be done
> in multiple transactions then it will have the result till now as a
> prediction.

Chances are low you will get async errors here as the write requests are
still in transit.  If you are looking for errors from VOP_STRATEGY() you
mean something like:

        int error, allerror;

        allerror = 0;

        error = VOP_STRATEGY(devvp, bp);
        if (error && allerror == 0)
                allerror = error;
        
As we are writing devvp, allerror will catch only fscow errors.
spec_strategy() calls bdev_strategy() and returns 0.

> OK to commit? It is not altering the semantics.
> 
> With regards,
> Reinoud
> 
> Index: genfs_io.c
> ===================================================================
> RCS file: /cvsroot/src/sys/miscfs/genfs/genfs_io.c,v
> retrieving revision 1.19
> diff -u -p -r1.19 genfs_io.c
> --- genfs_io.c        23 Feb 2009 21:27:51 -0000      1.19
> +++ genfs_io.c        26 Mar 2009 17:04:51 -0000
> @@ -1379,8 +1379,8 @@ genfs_do_io(struct vnode *vp, off_t off,
>       }
>       nestiobuf_done(mbp, skipbytes, error);
>       if (async) {
> -             UVMHIST_LOG(ubchist, "returning 0 (async)", 0,0,0,0);
> -             return (0);
> +             UVMHIST_LOG(ubchist, "returning mbp->b_error (async)",
> 0,0,0,0);
> +             return mbp->b_error;
>       }
>       UVMHIST_LOG(ubchist, "waiting for mbp %p", mbp,0,0,0);
>       error = biowait(mbp);

-- 
Juergen Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)


Home | Main Index | Thread Index | Old Index