[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH -V3 4/8] hw/9pfs: Implement syncfs
From: |
Aneesh Kumar K. V |
Subject: |
Re: [Qemu-devel] [PATCH -V3 4/8] hw/9pfs: Implement syncfs |
Date: |
Mon, 14 Mar 2011 00:29:56 +0530 |
User-agent: |
Notmuch/0.5-66-g70c5e2c (http://notmuchmail.org) Emacs/23.1.1 (i686-pc-linux-gnu) |
On Sun, 13 Mar 2011 16:24:13 +0000, Stefan Hajnoczi <address@hidden> wrote:
> On Sat, Mar 5, 2011 at 5:52 PM, Aneesh Kumar K.V
> <address@hidden> wrote:
> > +static void v9fs_post_do_syncfs(V9fsState *s, V9fsPDU *pdu, int err)
> > +{
> > + if (err == -1) {
> > + err = -errno;
> > + }
>
> errno may have been clobbered by any standard library function/syscall
> invoked by this thread before v9fs_post_do_syncfs() was called. Why
> not pass the -errno in the function argument?
>
> static void v9fs_post_do_syncfs(V9fsState *s, V9fsPDU *pdu, int err)
> {
> complete_pdu(s, pdu, err);
> }
>
> I strongly suggest doing a separate patch series to clean up of all of
> virtio-9p to stop using errno. It's bad practice and I've caught
> several errno mistakes in the virtio-9p patches I've reviewed - I bet
> there are other instances lurking around.
Agreed. I will look at the error handling more closely
>
> > +static void v9fs_syncfs(V9fsState *s, V9fsPDU *pdu)
> > +{
> > + int err;
> > + int32_t fid;
> > + size_t offset = 7;
> > + V9fsFidState *fidp;
> > +
> > + pdu_unmarshal(pdu, offset, "d", &fid);
> > + fidp = lookup_fid(s, fid);
> > + if (fidp == NULL) {
> > + err = -ENOENT;
> > + v9fs_post_do_syncfs(s, pdu, err);
> > + return;
> > + }
>
> This wasn't setting errno but passed the error in err. It can stay
> like this if you change v9fs_post_do_syncfs().
>
nice catch. Will update.
-aneesh
- [Qemu-devel] [PATCH -V3 3/8] hw/9pfs: Use v9fs_do_close instead of close, (continued)
[Qemu-devel] [PATCH -V3 4/8] hw/9pfs: Implement syncfs, Aneesh Kumar K.V, 2011/03/05
[Qemu-devel] [PATCH -V3 5/8] hw/9pfs: Add open flag to fid, Aneesh Kumar K.V, 2011/03/05
[Qemu-devel] [PATCH -V3 6/8] hw/9pfs: Add directory reclaim support, Aneesh Kumar K.V, 2011/03/05
[Qemu-devel] [PATCH -V3 8/8] hw/9pfs: Skip file system sync if we have specified cache=none option, Aneesh Kumar K.V, 2011/03/05
[Qemu-devel] [PATCH -V3 7/8] hw/9pfs: Add new virtfs option cache=none to skip host page cache, Aneesh Kumar K.V, 2011/03/05