All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/4] 9p: add locking to V9fsDir
Date: Thu, 2 Jun 2016 14:46:51 -0600	[thread overview]
Message-ID: <57509B3B.7030200@redhat.com> (raw)
In-Reply-To: <146485754195.31047.4810439708860123650.stgit@bahia.huguette.org>

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

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.
> 
> We must thus serialize accesses to the dirent structure.
> 
> This may be achieved with a mutex like below:
> 
> lock_mutex();
> 
> readdir();
> 
> // work with the dirent
> 
> unlock_mutex();
> 
> This patch adds all the locking, to prepare the switch to readdir().
> 
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>  hw/9pfs/9p.c |   21 +++++++++++++++++++++
>  hw/9pfs/9p.h |   16 ++++++++++++++++
>  2 files changed, 37 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-06-02 20:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  8:51 [Qemu-devel] [PATCH 0/4] 9p: get rid of readdir_r() Greg Kurz
2016-06-02  8:52 ` [Qemu-devel] [PATCH 1/4] 9p: drop useless out: label Greg Kurz
2016-06-02 19:57   ` Eric Blake
2016-06-02  8:52 ` [Qemu-devel] [PATCH 2/4] 9p: introduce the V9fsDir type Greg Kurz
2016-06-02 20:05   ` Eric Blake
2016-06-02  8:52 ` [Qemu-devel] [PATCH 3/4] 9p: add locking to V9fsDir Greg Kurz
2016-06-02 20:46   ` Eric Blake [this message]
2016-06-02  8:52 ` [Qemu-devel] [PATCH 4/4] 9p: switch back to readdir() Greg Kurz
2016-06-02 21:00   ` Eric Blake
2016-06-03  6:29     ` Greg Kurz
2016-06-02  9:33 ` [Qemu-devel] [PATCH 0/4] 9p: get rid of readdir_r() Peter Maydell
2016-06-02  9:42   ` Greg Kurz
2016-06-02 12:05     ` Peter Maydell
2016-06-02 13:59     ` Michael Fritscher
2016-06-02 15:47       ` Greg Kurz

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=57509B3B.7030200@redhat.com \
    --to=eblake@redhat.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=gkurz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.