qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] 9pfs-proxy: simplify error handling
Date: Tue, 10 Mar 2015 07:23:30 +0300	[thread overview]
Message-ID: <54FE71C2.2080609@msgid.tls.msk.ru> (raw)
In-Reply-To: <877fur4fq8.fsf@linux.vnet.ibm.com>

08.03.2015 19:27, Aneesh Kumar K.V wrote:
> Michael Tokarev <mjt@tls.msk.ru> writes:
[]
>> Actually, after reading almost whole 9pfs and fsdev code, I can
>> say with great confidence this code is nearly hopeless.
> 
> Is that about the 9pfs-proxy code, or the rest of 9pfs. I understand

Well. the marshal/unmarshal interface is in core code as far as
I can see, and it is very fragile at best, as the below example of
its usage shows.  I haven't dug deeper.  So far, it was only the
9pfs proxy code.

> that the error handling can definitely get some cleanup. I mentioned
> that in my previous mail
> mail. http://mid.gmane.org/87oav7iy5v.fsf@linux.vnet.ibm.com

I've shown probs in the code itself, not the visible behavour.
Visible behavour is much easier to fix here.

Thanks,

/mjt

>> Patch 3 shows just one (huge) example.  There are so many issues
>> with this code, I'm afraid I don't have know the words to express
>> it.
>>
>> Again, patch 3 shows a good example.  Another example:
>>
>> static int v9fs_receive_status(V9fsProxy *proxy,
>>                                struct iovec *reply, int *status)
>> ...
>>     proxy_unmarshal(reply, 0, "dd", &header.type, &header.size);
>>     if (header.size != sizeof(int)) {
>>         *status = -ENOBUFS;
>>     }
>> ...
>>     proxy_unmarshal(reply, PROXY_HDR_SZ, "d", status);
>>
>> proxy_unmarshall(), for "d" element, expects an int32_t
>> pointer.  Here we have int pointer, and compare its
>> size with sizeof(int).  This is a generic problem of whole
>> v9fs_(un)marshall interface, which is in the core of 9pfs...
>> this is a status return, which is int32.
>>
>> Oh well.  I've no idea how this code has been accepted.
>> It is absolute crap.
>>
> 
> -aneesh
> 

  reply	other threads:[~2015-03-10  4:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 21:43 [Qemu-devel] [PATCH v3 0/3] RFC: 9pfs-proxy: simplify/cleanup Michael Tokarev
2015-03-06 21:43 ` [Qemu-devel] [PATCH 1/3] 9pfs-proxy: simplify error handling Michael Tokarev
2015-03-07 20:37   ` Eric Blake
2015-03-07 22:10     ` Michael Tokarev
2015-03-07 22:11       ` Michael Tokarev
2015-03-08 16:27       ` Aneesh Kumar K.V
2015-03-10  4:23         ` Michael Tokarev [this message]
2015-03-10 17:41           ` Aneesh Kumar K.V
2015-03-11  5:58             ` Michael Tokarev
2015-03-11  8:46               ` Aneesh Kumar K.V
2015-03-11 20:05                 ` Michael Tokarev
2015-03-11 20:08                   ` Michael Tokarev
2015-03-08 16:21   ` Aneesh Kumar K.V
2015-03-06 21:43 ` [Qemu-devel] [PATCH 2/3] fsdev: introduce v9fs_vmarshal() and v9fs_vunmarshal() Michael Tokarev
2015-03-06 21:43 ` [Qemu-devel] [PATCH 3/3] 9pfs-proxy: remove one half of redundrand code Michael Tokarev
2015-03-06 21:46   ` Michael Tokarev
2015-03-07 20:39   ` Eric Blake
2015-03-10  4:49 ` [Qemu-devel] [PATCH v3 0/3] RFC: 9pfs-proxy: simplify/cleanup Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54FE71C2.2080609@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).