From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8ZW5-00079X-CP for qemu-devel@nongnu.org; Thu, 02 Jun 2016 16:46:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8ZW1-0005MO-C6 for qemu-devel@nongnu.org; Thu, 02 Jun 2016 16:46:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8ZW1-0005MI-5w for qemu-devel@nongnu.org; Thu, 02 Jun 2016 16:46:53 -0400 References: <146485751812.31047.11608773464731615044.stgit@bahia.huguette.org> <146485754195.31047.4810439708860123650.stgit@bahia.huguette.org> From: Eric Blake Message-ID: <57509B3B.7030200@redhat.com> Date: Thu, 2 Jun 2016 14:46:51 -0600 MIME-Version: 1.0 In-Reply-To: <146485754195.31047.4810439708860123650.stgit@bahia.huguette.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FuDKmUU0LwaXjVfRWTAuxv0iNvTgiRsM7" Subject: Re: [Qemu-devel] [PATCH 3/4] 9p: add locking to V9fsDir List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: "Aneesh Kumar K.V" , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FuDKmUU0LwaXjVfRWTAuxv0iNvTgiRsM7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/02/2016 02:52 AM, Greg Kurz wrote: > If several threads call concurrently readdir() with the same directory s/call concurrently/concurrently call/ > stream pointer, it is possible that they all get a pointer to the same > dirent structure, whose content is overwritten each time readdir() is > called. >=20 > We must thus serialize accesses to the dirent structure. >=20 > This may be achieved with a mutex like below: >=20 > lock_mutex(); >=20 > readdir(); >=20 > // work with the dirent >=20 > unlock_mutex(); >=20 > This patch adds all the locking, to prepare the switch to readdir(). >=20 > Signed-off-by: Greg Kurz > --- > hw/9pfs/9p.c | 21 +++++++++++++++++++++ > hw/9pfs/9p.h | 16 ++++++++++++++++ > 2 files changed, 37 insertions(+) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FuDKmUU0LwaXjVfRWTAuxv0iNvTgiRsM7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXUJs7AAoJEKeha0olJ0NqbF0H/2nNIjIC466nnbFJFFfZvsJc lcJH6Uq5rdpKU0dPbf2n/fzrgUSRyyAE8hPhMGQw4GPK1lVgl7zLajQ9voXQTse7 Z5tJf4C50jsSjmSbGcQ1ZwXuTZ+iA1OVWzcBtKp4QkNUSZZ9Op0oXmKda63rV2sd 0dIEm9LfsZX5aqLu2eu5+2HNcATcaQnbfKKUllUKNc04QoZzPZPCbJg2YFl5DEk0 nYNMz2izNjK/R8Bexwhvk5knpWxzsi9QYbW14SosZMjDafBtj5cuHrWu5PYIjdVq DL1GqUBqs4WGhXgnos5w/Zrb4+50NbiQeUOWKSGOljIXDVVoWhUppaDdidND3U4= =EJa5 -----END PGP SIGNATURE----- --FuDKmUU0LwaXjVfRWTAuxv0iNvTgiRsM7--