On Sat, Mar 5, 2011 at 5:52 PM, Aneesh Kumar K.V <aneesh.ku...@linux.vnet.ibm.com> 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