[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: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH -V3 4/8] hw/9pfs: Implement syncfs |
Date: |
Sun, 13 Mar 2011 16:24:13 +0000 |
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.
> +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().
Stefan
[Qemu-devel] [PATCH -V3 4/8] hw/9pfs: Implement syncfs, Aneesh Kumar K.V, 2011/03/05
- Re: [Qemu-devel] [PATCH -V3 4/8] hw/9pfs: Implement syncfs,
Stefan Hajnoczi <=
[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