From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42152 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyqWL-0004qX-RK for qemu-devel@nongnu.org; Sun, 13 Mar 2011 15:00:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PyqWK-0000Kg-3Y for qemu-devel@nongnu.org; Sun, 13 Mar 2011 15:00:05 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:56254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PyqWJ-0000IY-HH for qemu-devel@nongnu.org; Sun, 13 Mar 2011 15:00:03 -0400 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp08.au.ibm.com (8.14.4/8.13.1) with ESMTP id p2DIstwx015436 for ; Mon, 14 Mar 2011 05:54:55 +1100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2DJ01UZ2269428 for ; Mon, 14 Mar 2011 06:00:01 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2DJ01Qt015642 for ; Mon, 14 Mar 2011 06:00:01 +1100 From: "Aneesh Kumar K. V" Subject: Re: [Qemu-devel] [PATCH -V3 4/8] hw/9pfs: Implement syncfs In-Reply-To: References: <1299347533-17047-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1299347533-17047-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Date: Mon, 14 Mar 2011 00:29:56 +0530 Message-ID: <877hc2rglv.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: aliguori@us.ibm.com, "Venkateswararao Jujjuri (JV)" , qemu-devel@nongnu.org On Sun, 13 Mar 2011 16:24:13 +0000, Stefan Hajnoczi wr= ote: > On Sat, Mar 5, 2011 at 5:52 PM, Aneesh Kumar K.V > wrote: > > +static void v9fs_post_do_syncfs(V9fsState *s, V9fsPDU *pdu, int err) > > +{ > > + =C2=A0 =C2=A0if (err =3D=3D -1) { > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0err =3D -errno; > > + =C2=A0 =C2=A0} >=20 > 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? >=20 > static void v9fs_post_do_syncfs(V9fsState *s, V9fsPDU *pdu, int err) > { > =C2=A0 =C2=A0complete_pdu(s, pdu, err); > } >=20 > 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 >=20 > > +static void v9fs_syncfs(V9fsState *s, V9fsPDU *pdu) > > +{ > > + =C2=A0 =C2=A0int err; > > + =C2=A0 =C2=A0int32_t fid; > > + =C2=A0 =C2=A0size_t offset =3D 7; > > + =C2=A0 =C2=A0V9fsFidState *fidp; > > + > > + =C2=A0 =C2=A0pdu_unmarshal(pdu, offset, "d", &fid); > > + =C2=A0 =C2=A0fidp =3D lookup_fid(s, fid); > > + =C2=A0 =C2=A0if (fidp =3D=3D NULL) { > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0err =3D -ENOENT; > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0v9fs_post_do_syncfs(s, pdu, err); > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return; > > + =C2=A0 =C2=A0} >=20 > This wasn't setting errno but passed the error in err. It can stay > like this if you change v9fs_post_do_syncfs(). >=20 nice catch. Will update. -aneesh