qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL] VirtFS update
@ 2011-09-13 13:27 Aneesh Kumar K.V
  2011-09-15 19:10 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2011-09-13 13:27 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers


Hi Anthony,

This series contain few fixes to VirtFS server. The patch set also add
two new 9p operations. Please pull.

The following changes since commit 07ff2c4475df77e38a31d50ee7f3932631806c15:

  Merge remote-tracking branch 'origin/master' into staging (2011-09-08 09:25:36 -0500)

are available in the git repository at:

  git://repo.or.cz/qemu/v9fs.git for-upstream-4

Aneesh Kumar K.V (5):
      hw/9pfs: Update the fidp path before opendir
      hw/9pfs: Initialize rest of qid field to zero.
      hw/9pfs: Fix memleaks in some 9p operation
      hw/9pfs: add 9P2000.L renameat operation
      hw/9pfs: add 9P2000.L unlinkat operation

 hw/9pfs/virtio-9p.c |  126 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/9pfs/virtio-9p.h |    4 ++
 2 files changed, 130 insertions(+), 0 deletions(-)


-aneesh

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2011-09-13 13:27 Aneesh Kumar K.V
@ 2011-09-15 19:10 ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2011-09-15 19:10 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers

On 09/13/2011 08:27 AM, Aneesh Kumar K.V wrote:
>
> Hi Anthony,
>
> This series contain few fixes to VirtFS server. The patch set also add
> two new 9p operations. Please pull.
>
> The following changes since commit 07ff2c4475df77e38a31d50ee7f3932631806c15:
>
>    Merge remote-tracking branch 'origin/master' into staging (2011-09-08 09:25:36 -0500)


Pulled.  Thanks.

Regards,

Anthony Liguori


> are available in the git repository at:
>
>    git://repo.or.cz/qemu/v9fs.git for-upstream-4
>
> Aneesh Kumar K.V (5):
>        hw/9pfs: Update the fidp path before opendir
>        hw/9pfs: Initialize rest of qid field to zero.
>        hw/9pfs: Fix memleaks in some 9p operation
>        hw/9pfs: add 9P2000.L renameat operation
>        hw/9pfs: add 9P2000.L unlinkat operation
>
>   hw/9pfs/virtio-9p.c |  126 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   hw/9pfs/virtio-9p.h |    4 ++
>   2 files changed, 130 insertions(+), 0 deletions(-)
>
>
> -aneesh
>
>
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2011-09-27  9:11 Aneesh Kumar K.V
  2011-09-29 20:05 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2011-09-27  9:11 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers


The following changes since commit d85a1302a91912c52cdc3fe459b313848a8a0792:

  Merge remote-tracking branch 'kwolf/for-anthony' into staging (2011-09-22 10:31:26 -0500)

are available in the git repository at:

  git://repo.or.cz/qemu/v9fs.git for-upstream-5

Aneesh Kumar K.V (8):
      hw/9pfs: Make v9fs_string* functions non-static
      hw/9pfs: Use read-write lock for protecting fid path.
      hw/9pfs: Move fid pathname tracking to seperate data type.
      hw/9pfs: Add init callback to fs driver
      hw/9pfs: Add fs driver specific details to fscontext
      hw/9pfs: Avoid unnecessary get_fid in v9fs_clunk
      hw/9pfs: Implement TFLUSH operation
      hw/9pfs: Add handle based fs driver

 Makefile.objs              |    8 +-
 fsdev/file-op-9p.h         |   54 ++-
 fsdev/qemu-fsdev.c         |    1 +
 fsdev/qemu-fsdev.h         |    1 +
 hw/9pfs/codir.c            |   64 +++-
 hw/9pfs/cofile.c           |  110 +++++--
 hw/9pfs/cofs.c             |  195 ++++++++++--
 hw/9pfs/coxattr.c          |   41 ++-
 hw/9pfs/virtio-9p-coth.h   |   72 +++--
 hw/9pfs/virtio-9p-device.c |   10 +-
 hw/9pfs/virtio-9p-handle.c |  611 +++++++++++++++++++++++++++++++++
 hw/9pfs/virtio-9p-local.c  |  213 +++++++++---
 hw/9pfs/virtio-9p.c        |  820 ++++++++++++++++++++++++--------------------
 hw/9pfs/virtio-9p.h        |   50 +++-
 14 files changed, 1712 insertions(+), 538 deletions(-)
 create mode 100644 hw/9pfs/virtio-9p-handle.c

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2011-09-27  9:11 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
@ 2011-09-29 20:05 ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2011-09-29 20:05 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers

On 09/27/2011 04:11 AM, Aneesh Kumar K.V wrote:
>
> The following changes since commit d85a1302a91912c52cdc3fe459b313848a8a0792:
>
>    Merge remote-tracking branch 'kwolf/for-anthony' into staging (2011-09-22 10:31:26 -0500)
>
> are available in the git repository at:
>
>    git://repo.or.cz/qemu/v9fs.git for-upstream-5

Pulled.  Thanks.

Regards,

Anthony Liguori

>
> Aneesh Kumar K.V (8):
>        hw/9pfs: Make v9fs_string* functions non-static
>        hw/9pfs: Use read-write lock for protecting fid path.
>        hw/9pfs: Move fid pathname tracking to seperate data type.
>        hw/9pfs: Add init callback to fs driver
>        hw/9pfs: Add fs driver specific details to fscontext
>        hw/9pfs: Avoid unnecessary get_fid in v9fs_clunk
>        hw/9pfs: Implement TFLUSH operation
>        hw/9pfs: Add handle based fs driver
>
>   Makefile.objs              |    8 +-
>   fsdev/file-op-9p.h         |   54 ++-
>   fsdev/qemu-fsdev.c         |    1 +
>   fsdev/qemu-fsdev.h         |    1 +
>   hw/9pfs/codir.c            |   64 +++-
>   hw/9pfs/cofile.c           |  110 +++++--
>   hw/9pfs/cofs.c             |  195 ++++++++++--
>   hw/9pfs/coxattr.c          |   41 ++-
>   hw/9pfs/virtio-9p-coth.h   |   72 +++--
>   hw/9pfs/virtio-9p-device.c |   10 +-
>   hw/9pfs/virtio-9p-handle.c |  611 +++++++++++++++++++++++++++++++++
>   hw/9pfs/virtio-9p-local.c  |  213 +++++++++---
>   hw/9pfs/virtio-9p.c        |  820 ++++++++++++++++++++++++--------------------
>   hw/9pfs/virtio-9p.h        |   50 +++-
>   14 files changed, 1712 insertions(+), 538 deletions(-)
>   create mode 100644 hw/9pfs/virtio-9p-handle.c
>
>
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] Virtfs update
@ 2011-11-02 10:22 Aneesh Kumar K.V
  2011-11-02 12:42 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2011-11-02 10:22 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers


The following changes since commit e072ea2fd8fdceef64159b9596d3c15ce01bea91:

  Bump version to 1.0-rc0 (2011-11-01 19:37:01 -0500)

are available in the git repository at:
  git://repo.or.cz/qemu/v9fs.git for-upstream-8

Aneesh Kumar K.V (1):
      hw/9pfs: Move opt validation to FsDriver callback

Stefan Hajnoczi (1):
      hw/9pfs: use g_vasprintf() instead of rolling our own

 fsdev/file-op-9p.h         |   15 ++++++-
 fsdev/qemu-fsdev.c         |   44 +++----------------
 fsdev/qemu-fsdev.h         |   10 ----
 hw/9pfs/virtio-9p-device.c |   13 +++--
 hw/9pfs/virtio-9p-handle.c |   20 +++++++++
 hw/9pfs/virtio-9p-local.c  |   34 ++++++++++++++
 hw/9pfs/virtio-9p.c        |  103 ++------------------------------------------
 vl.c                       |    8 +---
 8 files changed, 87 insertions(+), 160 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] Virtfs update
  2011-11-02 10:22 [Qemu-devel] [PULL] Virtfs update Aneesh Kumar K.V
@ 2011-11-02 12:42 ` Anthony Liguori
  2011-11-02 14:09   ` Aneesh Kumar K.V
  2011-11-02 15:55   ` Markus Armbruster
  0 siblings, 2 replies; 56+ messages in thread
From: Anthony Liguori @ 2011-11-02 12:42 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers

On 11/02/2011 05:22 AM, Aneesh Kumar K.V wrote:
>
> The following changes since commit e072ea2fd8fdceef64159b9596d3c15ce01bea91:
>
>    Bump version to 1.0-rc0 (2011-11-01 19:37:01 -0500)
>
> are available in the git repository at:
>    git://repo.or.cz/qemu/v9fs.git for-upstream-8
>
> Aneesh Kumar K.V (1):
>        hw/9pfs: Move opt validation to FsDriver callback
>
> Stefan Hajnoczi (1):
>        hw/9pfs: use g_vasprintf() instead of rolling our own

Neither of these look like bug fixes to me.

Regards,

Anthony Liguori

>
>   fsdev/file-op-9p.h         |   15 ++++++-
>   fsdev/qemu-fsdev.c         |   44 +++----------------
>   fsdev/qemu-fsdev.h         |   10 ----
>   hw/9pfs/virtio-9p-device.c |   13 +++--
>   hw/9pfs/virtio-9p-handle.c |   20 +++++++++
>   hw/9pfs/virtio-9p-local.c  |   34 ++++++++++++++
>   hw/9pfs/virtio-9p.c        |  103 ++------------------------------------------
>   vl.c                       |    8 +---
>   8 files changed, 87 insertions(+), 160 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] Virtfs update
  2011-11-02 12:42 ` Anthony Liguori
@ 2011-11-02 14:09   ` Aneesh Kumar K.V
  2011-11-03 13:09     ` Anthony Liguori
  2011-11-02 15:55   ` Markus Armbruster
  1 sibling, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2011-11-02 14:09 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers

On Wed, 02 Nov 2011 07:42:16 -0500, Anthony Liguori <aliguori@us.ibm.com> wrote:
> On 11/02/2011 05:22 AM, Aneesh Kumar K.V wrote:
> >
> > The following changes since commit e072ea2fd8fdceef64159b9596d3c15ce01bea91:
> >
> >    Bump version to 1.0-rc0 (2011-11-01 19:37:01 -0500)
> >
> > are available in the git repository at:
> >    git://repo.or.cz/qemu/v9fs.git for-upstream-8
> >
> > Aneesh Kumar K.V (1):
> >        hw/9pfs: Move opt validation to FsDriver callback
> >
> > Stefan Hajnoczi (1):
> >        hw/9pfs: use g_vasprintf() instead of rolling our own
> 
> Neither of these look like bug fixes to me.
> 
> Regards,
> 

The related discussion for the first commit can be found at

http://article.gmane.org/gmane.comp.emulators.qemu/122891

I dropped the second commit. updated details below.


The following changes since commit e072ea2fd8fdceef64159b9596d3c15ce01bea91:

  Bump version to 1.0-rc0 (2011-11-01 19:37:01 -0500)

are available in the git repository at:
  git://repo.or.cz/qemu/v9fs.git for-upstream-8

Stefan Hajnoczi (1):
      hw/9pfs: use g_vasprintf() instead of rolling our own

 hw/9pfs/virtio-9p.c |  103 ++-------------------------------------------------
 1 files changed, 4 insertions(+), 99 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] Virtfs update
  2011-11-02 12:42 ` Anthony Liguori
  2011-11-02 14:09   ` Aneesh Kumar K.V
@ 2011-11-02 15:55   ` Markus Armbruster
  1 sibling, 0 replies; 56+ messages in thread
From: Markus Armbruster @ 2011-11-02 15:55 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Aneesh Kumar K.V, QEMU Developers

Anthony Liguori <aliguori@us.ibm.com> writes:

> On 11/02/2011 05:22 AM, Aneesh Kumar K.V wrote:
>>
>> The following changes since commit e072ea2fd8fdceef64159b9596d3c15ce01bea91:
>>
>>    Bump version to 1.0-rc0 (2011-11-01 19:37:01 -0500)
>>
>> are available in the git repository at:
>>    git://repo.or.cz/qemu/v9fs.git for-upstream-8
>>
>> Aneesh Kumar K.V (1):
>>        hw/9pfs: Move opt validation to FsDriver callback
>>
>> Stefan Hajnoczi (1):
>>        hw/9pfs: use g_vasprintf() instead of rolling our own
>
> Neither of these look like bug fixes to me.

The second one is actually a minor portability fix: one of the replaced
functions uses va_copy() without a matching va_end().  I posted the
obvious fix "Subject: [PATCH 2/2] hw/9pfs: Supply missing va_end()", but
Stefan's fix is better.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] Virtfs update
  2011-11-02 14:09   ` Aneesh Kumar K.V
@ 2011-11-03 13:09     ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2011-11-03 13:09 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers

On 11/02/2011 09:09 AM, Aneesh Kumar K.V wrote:
> On Wed, 02 Nov 2011 07:42:16 -0500, Anthony Liguori<aliguori@us.ibm.com>  wrote:
>> On 11/02/2011 05:22 AM, Aneesh Kumar K.V wrote:
>>>
>>> The following changes since commit e072ea2fd8fdceef64159b9596d3c15ce01bea91:
>>>
>>>     Bump version to 1.0-rc0 (2011-11-01 19:37:01 -0500)
>>>
>>> are available in the git repository at:
>>>     git://repo.or.cz/qemu/v9fs.git for-upstream-8
>>>
>>> Aneesh Kumar K.V (1):
>>>         hw/9pfs: Move opt validation to FsDriver callback
>>>
>>> Stefan Hajnoczi (1):
>>>         hw/9pfs: use g_vasprintf() instead of rolling our own
>>
>> Neither of these look like bug fixes to me.
>>
>> Regards,
>>
>
> The related discussion for the first commit can be found at
>
> http://article.gmane.org/gmane.comp.emulators.qemu/122891
>
> I dropped the second commit. updated details below.

Pulled.  Thanks.

Regards,

Anthony Liguori

>
>
> The following changes since commit e072ea2fd8fdceef64159b9596d3c15ce01bea91:
>
>    Bump version to 1.0-rc0 (2011-11-01 19:37:01 -0500)
>
> are available in the git repository at:
>    git://repo.or.cz/qemu/v9fs.git for-upstream-8
>
> Stefan Hajnoczi (1):
>        hw/9pfs: use g_vasprintf() instead of rolling our own
>
>   hw/9pfs/virtio-9p.c |  103 ++-------------------------------------------------
>   1 files changed, 4 insertions(+), 99 deletions(-)
>
>
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2011-12-05  9:04 Aneesh Kumar K.V
  0 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2011-12-05  9:04 UTC (permalink / raw)
  To: qemu-devel, jmforbes; +Cc: aliguori, qemu-stable

Hi,

I guess all these patches can be applied to 1.0 stable series.

The following changes since commit 1c8a881daaca6fe0646a425b0970fb3ad25f6732:

  Update version for 1.0 release (2011-12-01 14:04:21 -0600)

are available in the git repository at:
  git://repo.or.cz/qemu/v9fs.git 1.0-fixes

Aneesh Kumar K.V (4):
      hw/9pfs: Improve portability to older systems
      hw/9pfs: use migration blockers to prevent live migration when virtfs export path is mounted
      hw/9pfs: Add qdev.reset callback for virtio-9p-pci device
      hw/9pfs: Use the correct file descriptor in Fsdriver Callback

Deepak C Shetty (1):
      hw/9pfs: Reset server state during TVERSION

 Makefile.objs              |    4 +-
 fsdev/file-op-9p.h         |    4 +-
 fsdev/qemu-fsdev.c         |    2 +
 hw/9pfs/cofile.c           |    4 +-
 hw/9pfs/virtio-9p-device.c |   25 +++++++++--------
 hw/9pfs/virtio-9p-handle.c |   61 ++++++++++++++++----------------------------
 hw/9pfs/virtio-9p-local.c  |   36 ++++++++++++++++++-------
 hw/9pfs/virtio-9p-synth.c  |    5 ++-
 hw/9pfs/virtio-9p.c        |   45 ++++++++++++++++++++++++++++++++
 hw/9pfs/virtio-9p.h        |    5 ++-
 hw/virtio-pci.c            |    2 +-
 hw/virtio-pci.h            |    1 +
 qerror.c                   |    5 +++
 qerror.h                   |    3 ++
 14 files changed, 130 insertions(+), 72 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2011-12-17 13:31 Aneesh Kumar K.V
  0 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2011-12-17 13:31 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers, qemu-stable


Hi Anthony,

This include a signed pull request. I guess you would require a recent
git to use the gpg info.

The following changes since commit 774d5c5b1604b8443a8e42048b370b6c95dbfc40:

  cris: Handle conditional stores on CRISv10 (2011-12-12 11:38:31 +0100)

are available in the git repository at:

  git://repo.or.cz/qemu/v9fs.git tag for-anthony

for you to fetch changes up to db6e84e6cbe728ea5dcecc62d40e4835ef2b1a4b:

  hw/9pfs: Use the correct signed type for different variables (2011-12-13 18:59:17 +0530)

----------------------------------------------------------------
Bug fix series. This should also be merged to 1.0 stable.

----------------------------------------------------------------
Aneesh Kumar K.V (1):
      hw/9pfs: Use the correct signed type for different variables

Stefan Hajnoczi (1):
      hw/9pfs: replace iovec manipulation with QEMUIOVector

 fsdev/file-op-9p.h  |    2 +-
 hw/9pfs/virtio-9p.c |  183 ++++++++++++++++++++-------------------------------
 hw/9pfs/virtio-9p.h |    2 +-
 trace-events        |    8 +-
 4 files changed, 77 insertions(+), 118 deletions(-)

-aneesh

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2011-12-21  7:57 Aneesh Kumar K.V
  2011-12-27 16:36 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2011-12-21  7:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

Hi Anthony,

This is the updated pull request after moving the repo to github. I added two
patches to the series. The signed tag for-anthony is updated with updated info

The following changes since commit 3799ce4ab64f578eb818689a276e4f0c73d01fb5:

  sd: Remember to reset .expecting_acmd on reset. (2011-12-21 05:04:21 +0100)

are available in the git repository at:

  git://github.com/kvaneesh/QEMU.git for-upstream

for you to fetch changes up to 058a96ed506d77714bcce3d69b351e364078c080:

  scripts/analyse-9p-simpletrace.py:	Add symbolic names for 9p operations. (2011-12-21 12:37:23 +0530)

----------------------------------------------------------------
(from the branch description for for-upstream local branch)

branch for landing changes for upstream merge

----------------------------------------------------------------
Aneesh Kumar K.V (2):
      hw/9pfs: Use the correct signed type for different variables
      hw/9pfs: iattr_valid flags are kernel internal flags map them to 9p values.

Harsh Prateek Bora (1):
      scripts/analyse-9p-simpletrace.py:	Add symbolic names for 9p operations.

Stefan Hajnoczi (1):
      hw/9pfs: replace iovec manipulation with QEMUIOVector

 fsdev/file-op-9p.h                |    2 +-
 hw/9pfs/virtio-9p.c               |  230 +++++++++++++++----------------------
 hw/9pfs/virtio-9p.h               |    2 +-
 scripts/analyse-9p-simpletrace.py |   75 ++++++++++++-
 trace-events                      |    8 +-
 5 files changed, 174 insertions(+), 143 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2011-12-21  7:57 Aneesh Kumar K.V
@ 2011-12-27 16:36 ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2011-12-27 16:36 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: qemu-devel

On 12/21/2011 01:57 AM, Aneesh Kumar K.V wrote:
> Hi Anthony,
>
> This is the updated pull request after moving the repo to github. I added two
> patches to the series. The signed tag for-anthony is updated with updated info
>
> The following changes since commit 3799ce4ab64f578eb818689a276e4f0c73d01fb5:
>
>    sd: Remember to reset .expecting_acmd on reset. (2011-12-21 05:04:21 +0100)
>
> are available in the git repository at:
>
>    git://github.com/kvaneesh/QEMU.git for-upstream
>
> for you to fetch changes up to 058a96ed506d77714bcce3d69b351e364078c080:
>
>    scripts/analyse-9p-simpletrace.py:	Add symbolic names for 9p operations. (2011-12-21 12:37:23 +0530)

Pulled.  Thanks.

Regards,

Anthony Liguori

>
> ----------------------------------------------------------------
> (from the branch description for for-upstream local branch)
>
> branch for landing changes for upstream merge
>
> ----------------------------------------------------------------
> Aneesh Kumar K.V (2):
>        hw/9pfs: Use the correct signed type for different variables
>        hw/9pfs: iattr_valid flags are kernel internal flags map them to 9p values.
>
> Harsh Prateek Bora (1):
>        scripts/analyse-9p-simpletrace.py:	Add symbolic names for 9p operations.
>
> Stefan Hajnoczi (1):
>        hw/9pfs: replace iovec manipulation with QEMUIOVector
>
>   fsdev/file-op-9p.h                |    2 +-
>   hw/9pfs/virtio-9p.c               |  230 +++++++++++++++----------------------
>   hw/9pfs/virtio-9p.h               |    2 +-
>   scripts/analyse-9p-simpletrace.py |   75 ++++++++++++-
>   trace-events                      |    8 +-
>   5 files changed, 174 insertions(+), 143 deletions(-)
>
>
>
>
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2012-01-23 13:02 Aneesh Kumar K.V
  2012-01-23 17:05 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2012-01-23 13:02 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers



The following changes since commit 8c4ec5c0269bda18bb777a64b2008088d1c632dc:

  pxa2xx_keypad: fix unbalanced parenthesis. (2012-01-17 02:14:42 +0100)

are available in the git repository at:

  git://github.com/kvaneesh/QEMU.git for-upstream

for you to fetch changes up to 0700a73cfe166100cb59e28aad2c1fc5e4e952cb:

  hw/9pfs: Update MAINTAINERS file (2012-01-23 12:26:54 +0530)

----------------------------------------------------------------
(from the branch description for for-upstream local branch)

branch for landing changes for upstream merge

----------------------------------------------------------------
Aneesh Kumar K.V (3):
      hw/9pfs: Add new security model mapped-file.
      hw/9pfs: Fix crash when mounting with synthfs
      hw/9pfs: Update MAINTAINERS file

M. Mohan Kumar (2):
      hw/9pfs: Preserve S_ISGID
      fsdev: Fix parameter parsing for proxy helper

 MAINTAINERS                 |    6 +-
 fsdev/file-op-9p.h          |   12 +-
 fsdev/virtfs-proxy-helper.c |   10 +-
 hw/9pfs/cofile.c            |   14 ++
 hw/9pfs/virtio-9p-device.c  |    9 -
 hw/9pfs/virtio-9p-handle.c  |    4 +-
 hw/9pfs/virtio-9p-local.c   |  348 ++++++++++++++++++++++++++++++++++++++++++-
 hw/9pfs/virtio-9p.c         |    2 +-
 qemu-options.hx             |   18 ++-
 9 files changed, 388 insertions(+), 35 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2012-01-23 13:02 Aneesh Kumar K.V
@ 2012-01-23 17:05 ` Anthony Liguori
  2012-01-23 18:25   ` Aneesh Kumar K.V
  0 siblings, 1 reply; 56+ messages in thread
From: Anthony Liguori @ 2012-01-23 17:05 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers

On 01/23/2012 07:02 AM, Aneesh Kumar K.V wrote:
>
>
> The following changes since commit 8c4ec5c0269bda18bb777a64b2008088d1c632dc:
>
>    pxa2xx_keypad: fix unbalanced parenthesis. (2012-01-17 02:14:42 +0100)
>
> are available in the git repository at:
>
>    git://github.com/kvaneesh/QEMU.git for-upstream
>
> for you to fetch changes up to 0700a73cfe166100cb59e28aad2c1fc5e4e952cb:
>
>    hw/9pfs: Update MAINTAINERS file (2012-01-23 12:26:54 +0530)

   CC    libhw64/9pfs/virtio-9p-local.o
cc1: warnings being treated as errors
/home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c: In function 
‘local_set_mapped_file_attr’:
/home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:9: error: ‘uid’ may be used 
uninitialized in this function
/home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:14: error: ‘gid’ may be 
used uninitialized in this function
/home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:19: error: ‘mode’ may be 
used uninitialized in this function
/home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:25: error: ‘rdev’ may be 
used uninitialized in this function
make[1]: *** [9pfs/virtio-9p-local.o] Error 1
make: *** [subdir-libhw64] Error 2

I see a lot of build breakages come into through this tree.  I understand that 
GCC can be fickle with -Werror but there's an easy way to solve this.

Please get your tree added to buildbot and make sure there's a successful 
buildbot run before you do a pull request.

Alternatively, setup multiple VMs to build test yourself.  But please do 
something to check the build a bit more rigorously before sending future PULL 
requests.

Regards,

Anthony Liguori

>
> ----------------------------------------------------------------
> (from the branch description for for-upstream local branch)
>
> branch for landing changes for upstream merge
>
> ----------------------------------------------------------------
> Aneesh Kumar K.V (3):
>        hw/9pfs: Add new security model mapped-file.
>        hw/9pfs: Fix crash when mounting with synthfs
>        hw/9pfs: Update MAINTAINERS file
>
> M. Mohan Kumar (2):
>        hw/9pfs: Preserve S_ISGID
>        fsdev: Fix parameter parsing for proxy helper
>
>   MAINTAINERS                 |    6 +-
>   fsdev/file-op-9p.h          |   12 +-
>   fsdev/virtfs-proxy-helper.c |   10 +-
>   hw/9pfs/cofile.c            |   14 ++
>   hw/9pfs/virtio-9p-device.c  |    9 -
>   hw/9pfs/virtio-9p-handle.c  |    4 +-
>   hw/9pfs/virtio-9p-local.c   |  348 ++++++++++++++++++++++++++++++++++++++++++-
>   hw/9pfs/virtio-9p.c         |    2 +-
>   qemu-options.hx             |   18 ++-
>   9 files changed, 388 insertions(+), 35 deletions(-)
>
>
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2012-01-23 17:05 ` Anthony Liguori
@ 2012-01-23 18:25   ` Aneesh Kumar K.V
  0 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2012-01-23 18:25 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers

On Mon, 23 Jan 2012 11:05:25 -0600, Anthony Liguori <aliguori@us.ibm.com> wrote:
> On 01/23/2012 07:02 AM, Aneesh Kumar K.V wrote:
> >
> >
> > The following changes since commit 8c4ec5c0269bda18bb777a64b2008088d1c632dc:
> >
> >    pxa2xx_keypad: fix unbalanced parenthesis. (2012-01-17 02:14:42 +0100)
> >
> > are available in the git repository at:
> >
> >    git://github.com/kvaneesh/QEMU.git for-upstream
> >
> > for you to fetch changes up to 0700a73cfe166100cb59e28aad2c1fc5e4e952cb:
> >
> >    hw/9pfs: Update MAINTAINERS file (2012-01-23 12:26:54 +0530)
> 
>    CC    libhw64/9pfs/virtio-9p-local.o
> cc1: warnings being treated as errors
> /home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c: In function 
> ‘local_set_mapped_file_attr’:
> /home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:9: error: ‘uid’ may be used 
> uninitialized in this function
> /home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:14: error: ‘gid’ may be 
> used uninitialized in this function
> /home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:19: error: ‘mode’ may be 
> used uninitialized in this function
> /home/anthony/git/qemu/hw/9pfs/virtio-9p-local.c:153:25: error: ‘rdev’ may be 
> used uninitialized in this function
> make[1]: *** [9pfs/virtio-9p-local.o] Error 1
> make: *** [subdir-libhw64] Error 2
> 
> I see a lot of build breakages come into through this tree.  I understand that 
> GCC can be fickle with -Werror but there's an easy way to solve this.
> 
> Please get your tree added to buildbot and make sure there's a successful 
> buildbot run before you do a pull request.

I will do this

> 
> Alternatively, setup multiple VMs to build test yourself.  But please do 
> something to check the build a bit more rigorously before sending future PULL 
> requests.
> 

I actually do build test on ubuntu 11.10, fedora 15, rhel5.7 before pull
request. That usually catch most of the errors like above. 

-aneesh

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2012-01-30 16:14 Aneesh Kumar K.V
  2012-02-07 12:36 ` Aneesh Kumar K.V
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2012-01-30 16:14 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers


Hi Anthony,

I now have a successful build at build bot. So hopefully build breakage
is gone. I also added "remove O_NOATIME" patch which Mohan acked.

-anees

The following changes since commit 8c4ec5c0269bda18bb777a64b2008088d1c632dc:

  pxa2xx_keypad: fix unbalanced parenthesis. (2012-01-17 02:14:42 +0100)

are available in the git repository at:

  git://github.com/kvaneesh/QEMU.git for-upstream

for you to fetch changes up to eed968607d656a218712df47a5e0432c21fd6994:

  hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode (2012-01-30 10:54:17 +0530)

----------------------------------------------------------------
(from the branch description for for-upstream local branch)

branch for landing changes for upstream merge

----------------------------------------------------------------
Aneesh Kumar K.V (3):
      hw/9pfs: Add new security model mapped-file.
      hw/9pfs: Fix crash when mounting with synthfs
      hw/9pfs: Update MAINTAINERS file

Daniel P. Berrange (1):
      hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode

M. Mohan Kumar (2):
      hw/9pfs: Preserve S_ISGID
      fsdev: Fix parameter parsing for proxy helper

 MAINTAINERS                 |    6 +-
 fsdev/file-op-9p.h          |   12 +-
 fsdev/virtfs-proxy-helper.c |   10 +-
 hw/9pfs/cofile.c            |   14 ++
 hw/9pfs/virtio-9p-device.c  |    9 -
 hw/9pfs/virtio-9p-handle.c  |    4 +-
 hw/9pfs/virtio-9p-local.c   |  357 ++++++++++++++++++++++++++++++++++++++++++-
 hw/9pfs/virtio-9p.c         |    3 +-
 qemu-options.hx             |   18 ++-
 9 files changed, 397 insertions(+), 36 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2012-01-30 16:14 Aneesh Kumar K.V
@ 2012-02-07 12:36 ` Aneesh Kumar K.V
  0 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2012-02-07 12:36 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers


Hi Anthony,

Any update on this pull request ? You have merged the MAINTAINERS file
update separately. But that conflict should be easy to fix.

-anesh

On Mon, 30 Jan 2012 21:44:33 +0530, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
> 
> Hi Anthony,
> 
> I now have a successful build at build bot. So hopefully build breakage
> is gone. I also added "remove O_NOATIME" patch which Mohan acked.
> 
> -anees
> 
> The following changes since commit 8c4ec5c0269bda18bb777a64b2008088d1c632dc:
> 
>   pxa2xx_keypad: fix unbalanced parenthesis. (2012-01-17 02:14:42 +0100)
> 
> are available in the git repository at:
> 
>   git://github.com/kvaneesh/QEMU.git for-upstream
> 
> for you to fetch changes up to eed968607d656a218712df47a5e0432c21fd6994:
> 
>   hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode (2012-01-30 10:54:17 +0530)
> 
> ----------------------------------------------------------------
> (from the branch description for for-upstream local branch)
> 
> branch for landing changes for upstream merge
> 
> ----------------------------------------------------------------
> Aneesh Kumar K.V (3):
>       hw/9pfs: Add new security model mapped-file.
>       hw/9pfs: Fix crash when mounting with synthfs
>       hw/9pfs: Update MAINTAINERS file
> 
> Daniel P. Berrange (1):
>       hw/9pfs: Remove O_NOATIME flag from 9pfs open() calls in readonly mode
> 
> M. Mohan Kumar (2):
>       hw/9pfs: Preserve S_ISGID
>       fsdev: Fix parameter parsing for proxy helper
> 
>  MAINTAINERS                 |    6 +-
>  fsdev/file-op-9p.h          |   12 +-
>  fsdev/virtfs-proxy-helper.c |   10 +-
>  hw/9pfs/cofile.c            |   14 ++
>  hw/9pfs/virtio-9p-device.c  |    9 -
>  hw/9pfs/virtio-9p-handle.c  |    4 +-
>  hw/9pfs/virtio-9p-local.c   |  357 ++++++++++++++++++++++++++++++++++++++++++-
>  hw/9pfs/virtio-9p.c         |    3 +-
>  qemu-options.hx             |   18 ++-
>  9 files changed, 397 insertions(+), 36 deletions(-)
> 

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2012-02-26 17:44 Aneesh Kumar K.V
  2012-02-28 15:33 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2012-02-26 17:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori


Hi Anthony,

Please pull the below VirtFS  update

-aneesh

The following changes since commit 235fe3bfd46b1104575b540d0bc3fdf584030b99:

  qom: add test tools (2012-02-22 12:18:26 -0600)

are available in the git repository at:

  git://github.com/kvaneesh/QEMU.git for-upstream

for you to fetch changes up to 67d6fa53629f1eb3401974d740310c10e03fa1c9:

  hw/9pfs: Endian fixes for virtfs (2012-02-24 14:01:19 +0530)

----------------------------------------------------------------
Benjamin Herrenschmidt (1):
      hw/9pfs: Endian fixes for virtfs

Meador Inge (1):
      ./configure: add option for disabling VirtFS

 Makefile            |    2 ++
 configure           |   25 +++++++++++++++++++------
 hw/9pfs/virtio-9p.c |    8 +++++---
 3 files changed, 26 insertions(+), 9 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2012-02-26 17:44 Aneesh Kumar K.V
@ 2012-02-28 15:33 ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2012-02-28 15:33 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: qemu-devel

On 02/26/2012 11:44 AM, Aneesh Kumar K.V wrote:
> Hi Anthony,
>
> Please pull the below VirtFS  update
>
> -aneesh
>
> The following changes since commit 235fe3bfd46b1104575b540d0bc3fdf584030b99:
>
>    qom: add test tools (2012-02-22 12:18:26 -0600)
>
> are available in the git repository at:
>
>    git://github.com/kvaneesh/QEMU.git for-upstream
>
> for you to fetch changes up to 67d6fa53629f1eb3401974d740310c10e03fa1c9:
>
>    hw/9pfs: Endian fixes for virtfs (2012-02-24 14:01:19 +0530)

Pulled.  Thanks.

Regards,

Anthony Liguori

>
> ----------------------------------------------------------------
> Benjamin Herrenschmidt (1):
>        hw/9pfs: Endian fixes for virtfs
>
> Meador Inge (1):
>        ./configure: add option for disabling VirtFS
>
>   Makefile            |    2 ++
>   configure           |   25 +++++++++++++++++++------
>   hw/9pfs/virtio-9p.c |    8 +++++---
>   3 files changed, 26 insertions(+), 9 deletions(-)
>
>
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2012-07-31 17:27 Aneesh Kumar K.V
  2012-08-03 20:45 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2012-07-31 17:27 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers


Hi Anthony,

I have merged the configure fix which is sent as a part of 

http://thread.gmane.org/gmane.comp.emulators.qemu/160620/focus=160634

The following changes since commit 5e3bc7144edd6e4fa2824944e5eb16c28197dd5a:

  Merge remote-tracking branch 'mst/tags/for_anthony' into staging (2012-07-30 10:00:48 -0500)

are available in the git repository at:


  git://github.com/kvaneesh/QEMU.git for-upstream

for you to fetch changes up to 4cdc0789ec17ce1ce48506cae62035310e932a2e:

  hw/9pfs: Fix assert when disabling migration (2012-07-31 22:01:40 +0530)

----------------------------------------------------------------
Aneesh Kumar K.V (1):
      hw/9pfs: Fix assert when disabling migration

Stefan Weil (1):
      configure: Fix build with capabilities

 configure           |    2 +-
 hw/9pfs/virtio-9p.c |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index c65b5f6..309aeac 100755
--- a/configure
+++ b/configure
@@ -2084,7 +2084,7 @@ if test "$cap" != "no" ; then
   cat > $TMPC <<EOF
 #include <stdio.h>
 #include <sys/capability.h>
-int main(void) { cap_t caps; caps = cap_init(); }
+int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
 EOF
   if compile_prog "" "-lcap" ; then
     cap=yes
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index f4a7026..4b52540 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -983,11 +983,16 @@ static void v9fs_attach(void *opaque)
     err += offset;
     trace_v9fs_attach_return(pdu->tag, pdu->id,
                              qid.type, qid.version, qid.path);
-    s->root_fid = fid;
-    /* disable migration */
-    error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION,
-              s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
-    migrate_add_blocker(s->migration_blocker);
+    /*
+     * disable migration if we haven't done already.
+     * attach could get called multiple times for the same export.
+     */
+    if (!s->migration_blocker) {
+        s->root_fid = fid;
+        error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION,
+                  s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
+        migrate_add_blocker(s->migration_blocker);
+    }
 out:
     put_fid(pdu, fidp);
 out_nofid:

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2012-07-31 17:27 Aneesh Kumar K.V
@ 2012-08-03 20:45 ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2012-08-03 20:45 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers

"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:

> Hi Anthony,
>
> I have merged the configure fix which is sent as a part of 
>
> http://thread.gmane.org/gmane.comp.emulators.qemu/160620/focus=160634
>
> The following changes since commit 5e3bc7144edd6e4fa2824944e5eb16c28197dd5a:
>
>   Merge remote-tracking branch 'mst/tags/for_anthony' into staging (2012-07-30 10:00:48 -0500)
>
> are available in the git repository at:
>
>
>   git://github.com/kvaneesh/QEMU.git for-upstream
>
> for you to fetch changes up to 4cdc0789ec17ce1ce48506cae62035310e932a2e:
>
>   hw/9pfs: Fix assert when disabling migration (2012-07-31 22:01:40 +0530)

Pulled. Thanks.

Regards,

Anthony Liguori

>
> ----------------------------------------------------------------
> Aneesh Kumar K.V (1):
>       hw/9pfs: Fix assert when disabling migration
>
> Stefan Weil (1):
>       configure: Fix build with capabilities
>
>  configure           |    2 +-
>  hw/9pfs/virtio-9p.c |   15 ++++++++++-----
>  2 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/configure b/configure
> index c65b5f6..309aeac 100755
> --- a/configure
> +++ b/configure
> @@ -2084,7 +2084,7 @@ if test "$cap" != "no" ; then
>    cat > $TMPC <<EOF
>  #include <stdio.h>
>  #include <sys/capability.h>
> -int main(void) { cap_t caps; caps = cap_init(); }
> +int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
>  EOF
>    if compile_prog "" "-lcap" ; then
>      cap=yes
> diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
> index f4a7026..4b52540 100644
> --- a/hw/9pfs/virtio-9p.c
> +++ b/hw/9pfs/virtio-9p.c
> @@ -983,11 +983,16 @@ static void v9fs_attach(void *opaque)
>      err += offset;
>      trace_v9fs_attach_return(pdu->tag, pdu->id,
>                               qid.type, qid.version, qid.path);
> -    s->root_fid = fid;
> -    /* disable migration */
> -    error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION,
> -              s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
> -    migrate_add_blocker(s->migration_blocker);
> +    /*
> +     * disable migration if we haven't done already.
> +     * attach could get called multiple times for the same export.
> +     */
> +    if (!s->migration_blocker) {
> +        s->root_fid = fid;
> +        error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION,
> +                  s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
> +        migrate_add_blocker(s->migration_blocker);
> +    }
>  out:
>      put_fid(pdu, fidp);
>  out_nofid:

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2012-12-05 16:37 Aneesh Kumar K.V
  2012-12-10 16:58 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2012-12-05 16:37 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: QEMU Developers


The following changes since commit 16c6c80ac3a772b42a87b77dfdf0fdac7c607b0e:

  Open up 1.4 development branch (2012-12-03 14:08:40 -0600)

are available in the git repository at:

  git://github.com/kvaneesh/qemu.git for-upstream

for you to fetch changes up to 9fd2ecdc8cb2dc1a8a7c57b6c9c60bc9947b6a73:

  virtfs-proxy-helper: use setresuid and setresgid (2012-12-05 21:55:54 +0530)

----------------------------------------------------------------
Paolo Bonzini (1):
      virtfs-proxy-helper: use setresuid and setresgid

 fsdev/virtfs-proxy-helper.c |   93 +++++++++++++++++++++++++++++--------------
 1 file changed, 64 insertions(+), 29 deletions(-)

diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index f9a8270..df2a939 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -272,31 +272,76 @@ static int send_status(int sockfd, struct iovec *iovec, int status)
 /*
  * from man 7 capabilities, section
  * Effect of User ID Changes on Capabilities:
- * 4. If the file system user ID is changed from 0 to nonzero (see setfsuid(2))
- * then the following capabilities are cleared from the effective set:
- * CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH,  CAP_FOWNER, CAP_FSETID,
- * CAP_LINUX_IMMUTABLE  (since  Linux 2.2.30), CAP_MAC_OVERRIDE, and CAP_MKNOD
- * (since Linux 2.2.30). If the file system UID is changed from nonzero to 0,
- * then any of these capabilities that are enabled in the permitted set
- * are enabled in the effective set.
+ * If the effective user ID is changed from nonzero to 0, then the permitted
+ * set is copied to the effective set.  If the effective user ID is changed
+ * from 0 to nonzero, then all capabilities are are cleared from the effective
+ * set.
+ *
+ * The setfsuid/setfsgid man pages warn that changing the effective user ID may
+ * expose the program to unwanted signals, but this is not true anymore: for an
+ * unprivileged (without CAP_KILL) program to send a signal, the real or
+ * effective user ID of the sending process must equal the real or saved user
+ * ID of the target process.  Even when dropping privileges, it is enough to
+ * keep the saved UID to a "privileged" value and virtfs-proxy-helper won't
+ * be exposed to signals.  So just use setresuid/setresgid.
  */
-static int setfsugid(int uid, int gid)
+static int setugid(int uid, int gid, int *suid, int *sgid)
 {
+    int retval;
+
     /*
-     * We still need DAC_OVERRIDE because  we don't change
+     * We still need DAC_OVERRIDE because we don't change
      * supplementary group ids, and hence may be subjected DAC rules
      */
     cap_value_t cap_list[] = {
         CAP_DAC_OVERRIDE,
     };
 
-    setfsgid(gid);
-    setfsuid(uid);
+    *suid = geteuid();
+    *sgid = getegid();
+
+    if (setresgid(-1, gid, *sgid) == -1) {
+        retval = -errno;
+        goto err_out;
+    }
+
+    if (setresuid(-1, uid, *suid) == -1) {
+        retval = -errno;
+        goto err_sgid;
+    }
 
     if (uid != 0 || gid != 0) {
-        return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0);
+        if (do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0) < 0) {
+            retval = -errno;
+            goto err_suid;
+        }
     }
     return 0;
+
+err_suid:
+    if (setresuid(-1, *suid, *suid) == -1) {
+        abort();
+    }
+err_sgid:
+    if (setresgid(-1, *sgid, *sgid) == -1) {
+        abort();
+    }
+err_out:
+    return retval;
+}
+
+/*
+ * This is used to reset the ugid back with the saved values
+ * There is nothing much we can do checking error values here.
+ */
+static void resetugid(int suid, int sgid)
+{
+    if (setresgid(-1, sgid, sgid) == -1) {
+        abort();
+    }
+    if (setresuid(-1, suid, suid) == -1) {
+        abort();
+    }
 }
 
 /*
@@ -578,18 +623,15 @@ static int do_create_others(int type, struct iovec *iovec)
 
     v9fs_string_init(&path);
     v9fs_string_init(&oldpath);
-    cur_uid = geteuid();
-    cur_gid = getegid();
 
     retval = proxy_unmarshal(iovec, offset, "dd", &uid, &gid);
     if (retval < 0) {
         return retval;
     }
     offset += retval;
-    retval = setfsugid(uid, gid);
+    retval = setugid(uid, gid, &cur_uid, &cur_gid);
     if (retval < 0) {
-        retval = -errno;
-        goto err_out;
+        goto unmarshal_err_out;
     }
     switch (type) {
     case T_MKNOD:
@@ -619,9 +661,10 @@ static int do_create_others(int type, struct iovec *iovec)
     }
 
 err_out:
+    resetugid(cur_uid, cur_gid);
+unmarshal_err_out:
     v9fs_string_free(&path);
     v9fs_string_free(&oldpath);
-    setfsugid(cur_uid, cur_gid);
     return retval;
 }
 
@@ -641,24 +684,16 @@ static int do_create(struct iovec *iovec)
     if (ret < 0) {
         goto unmarshal_err_out;
     }
-    cur_uid = geteuid();
-    cur_gid = getegid();
-    ret = setfsugid(uid, gid);
+    ret = setugid(uid, gid, &cur_uid, &cur_gid);
     if (ret < 0) {
-        /*
-         * On failure reset back to the
-         * old uid/gid
-         */
-        ret = -errno;
-        goto err_out;
+        goto unmarshal_err_out;
     }
     ret = open(path.data, flags, mode);
     if (ret < 0) {
         ret = -errno;
     }
 
-err_out:
-    setfsugid(cur_uid, cur_gid);
+    resetugid(cur_uid, cur_gid);
 unmarshal_err_out:
     v9fs_string_free(&path);
     return ret;

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2012-12-05 16:37 Aneesh Kumar K.V
@ 2012-12-10 16:58 ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2012-12-10 16:58 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers

"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:

> The following changes since commit 16c6c80ac3a772b42a87b77dfdf0fdac7c607b0e:
>
>   Open up 1.4 development branch (2012-12-03 14:08:40 -0600)
>
> are available in the git repository at:
>
>   git://github.com/kvaneesh/qemu.git for-upstream
>
> for you to fetch changes up to 9fd2ecdc8cb2dc1a8a7c57b6c9c60bc9947b6a73:
>
>   virtfs-proxy-helper: use setresuid and setresgid (2012-12-05 21:55:54 +0530)
>

Pulled. Thanks.

Regards,

Anthony Liguori

> ----------------------------------------------------------------
> Paolo Bonzini (1):
>       virtfs-proxy-helper: use setresuid and setresgid
>
>  fsdev/virtfs-proxy-helper.c |   93 +++++++++++++++++++++++++++++--------------
>  1 file changed, 64 insertions(+), 29 deletions(-)
>
> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
> index f9a8270..df2a939 100644
> --- a/fsdev/virtfs-proxy-helper.c
> +++ b/fsdev/virtfs-proxy-helper.c
> @@ -272,31 +272,76 @@ static int send_status(int sockfd, struct iovec *iovec, int status)
>  /*
>   * from man 7 capabilities, section
>   * Effect of User ID Changes on Capabilities:
> - * 4. If the file system user ID is changed from 0 to nonzero (see setfsuid(2))
> - * then the following capabilities are cleared from the effective set:
> - * CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH,  CAP_FOWNER, CAP_FSETID,
> - * CAP_LINUX_IMMUTABLE  (since  Linux 2.2.30), CAP_MAC_OVERRIDE, and CAP_MKNOD
> - * (since Linux 2.2.30). If the file system UID is changed from nonzero to 0,
> - * then any of these capabilities that are enabled in the permitted set
> - * are enabled in the effective set.
> + * If the effective user ID is changed from nonzero to 0, then the permitted
> + * set is copied to the effective set.  If the effective user ID is changed
> + * from 0 to nonzero, then all capabilities are are cleared from the effective
> + * set.
> + *
> + * The setfsuid/setfsgid man pages warn that changing the effective user ID may
> + * expose the program to unwanted signals, but this is not true anymore: for an
> + * unprivileged (without CAP_KILL) program to send a signal, the real or
> + * effective user ID of the sending process must equal the real or saved user
> + * ID of the target process.  Even when dropping privileges, it is enough to
> + * keep the saved UID to a "privileged" value and virtfs-proxy-helper won't
> + * be exposed to signals.  So just use setresuid/setresgid.
>   */
> -static int setfsugid(int uid, int gid)
> +static int setugid(int uid, int gid, int *suid, int *sgid)
>  {
> +    int retval;
> +
>      /*
> -     * We still need DAC_OVERRIDE because  we don't change
> +     * We still need DAC_OVERRIDE because we don't change
>       * supplementary group ids, and hence may be subjected DAC rules
>       */
>      cap_value_t cap_list[] = {
>          CAP_DAC_OVERRIDE,
>      };
>  
> -    setfsgid(gid);
> -    setfsuid(uid);
> +    *suid = geteuid();
> +    *sgid = getegid();
> +
> +    if (setresgid(-1, gid, *sgid) == -1) {
> +        retval = -errno;
> +        goto err_out;
> +    }
> +
> +    if (setresuid(-1, uid, *suid) == -1) {
> +        retval = -errno;
> +        goto err_sgid;
> +    }
>  
>      if (uid != 0 || gid != 0) {
> -        return do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0);
> +        if (do_cap_set(cap_list, ARRAY_SIZE(cap_list), 0) < 0) {
> +            retval = -errno;
> +            goto err_suid;
> +        }
>      }
>      return 0;
> +
> +err_suid:
> +    if (setresuid(-1, *suid, *suid) == -1) {
> +        abort();
> +    }
> +err_sgid:
> +    if (setresgid(-1, *sgid, *sgid) == -1) {
> +        abort();
> +    }
> +err_out:
> +    return retval;
> +}
> +
> +/*
> + * This is used to reset the ugid back with the saved values
> + * There is nothing much we can do checking error values here.
> + */
> +static void resetugid(int suid, int sgid)
> +{
> +    if (setresgid(-1, sgid, sgid) == -1) {
> +        abort();
> +    }
> +    if (setresuid(-1, suid, suid) == -1) {
> +        abort();
> +    }
>  }
>  
>  /*
> @@ -578,18 +623,15 @@ static int do_create_others(int type, struct iovec *iovec)
>  
>      v9fs_string_init(&path);
>      v9fs_string_init(&oldpath);
> -    cur_uid = geteuid();
> -    cur_gid = getegid();
>  
>      retval = proxy_unmarshal(iovec, offset, "dd", &uid, &gid);
>      if (retval < 0) {
>          return retval;
>      }
>      offset += retval;
> -    retval = setfsugid(uid, gid);
> +    retval = setugid(uid, gid, &cur_uid, &cur_gid);
>      if (retval < 0) {
> -        retval = -errno;
> -        goto err_out;
> +        goto unmarshal_err_out;
>      }
>      switch (type) {
>      case T_MKNOD:
> @@ -619,9 +661,10 @@ static int do_create_others(int type, struct iovec *iovec)
>      }
>  
>  err_out:
> +    resetugid(cur_uid, cur_gid);
> +unmarshal_err_out:
>      v9fs_string_free(&path);
>      v9fs_string_free(&oldpath);
> -    setfsugid(cur_uid, cur_gid);
>      return retval;
>  }
>  
> @@ -641,24 +684,16 @@ static int do_create(struct iovec *iovec)
>      if (ret < 0) {
>          goto unmarshal_err_out;
>      }
> -    cur_uid = geteuid();
> -    cur_gid = getegid();
> -    ret = setfsugid(uid, gid);
> +    ret = setugid(uid, gid, &cur_uid, &cur_gid);
>      if (ret < 0) {
> -        /*
> -         * On failure reset back to the
> -         * old uid/gid
> -         */
> -        ret = -errno;
> -        goto err_out;
> +        goto unmarshal_err_out;
>      }
>      ret = open(path.data, flags, mode);
>      if (ret < 0) {
>          ret = -errno;
>      }
>  
> -err_out:
> -    setfsugid(cur_uid, cur_gid);
> +    resetugid(cur_uid, cur_gid);
>  unmarshal_err_out:
>      v9fs_string_free(&path);
>      return ret;

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2013-05-29 11:33 Aneesh Kumar K.V
  2013-05-31 18:48 ` Anthony Liguori
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2013-05-29 11:33 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers


The following changes since commit 371386fb60961e0afc02f03c817dff79633e323e:

  Update version for 1.5.0 release. (2013-05-20 08:20:08 -0500)

are available in the git repository at:

  git://github.com/kvaneesh/qemu.git for-upstream

for you to fetch changes up to db431f6adc881a0758512cd765b3108209013512:

  hw/9pfs: Be robust against paths without FS_IOC_GETVERSION (2013-05-28 15:23:12 +0530)

----------------------------------------------------------------
Aneesh Kumar K.V (3):
      hw/9pfs: Fix segfault with 9p2000.u
      hw/9pfs: use O_NOFOLLOW for mapped readlink operation
      hw/9pfs: Use O_NOFOLLOW when opening files on server

Gabriel de Perthuis (1):
      hw/9pfs: Be robust against paths without FS_IOC_GETVERSION

 hw/9pfs/cofile.c          |  4 ++++
 hw/9pfs/virtio-9p-local.c | 50 +++++++++++++++++++++++++++++++++++++++--------
 hw/9pfs/virtio-9p.c       |  2 +-
 3 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index 2efebf3..194c130 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -38,6 +38,10 @@ int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
             });
         v9fs_path_unlock(s);
     }
+    /* The ioctl may not be supported depending on the path */
+    if (err == -ENOTTY) {
+        err = 0;
+    }
     return err;
 }
 
diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c
index 6ece6f7..fc93e9e 100644
--- a/hw/9pfs/virtio-9p-local.c
+++ b/hw/9pfs/virtio-9p-local.c
@@ -59,6 +59,33 @@ static const char *local_mapped_attr_path(FsContext *ctx,
     return buffer;
 }
 
+static FILE *local_fopen(const char *path, const char *mode)
+{
+    int fd, o_mode = 0;
+    FILE *fp;
+    int flags = O_NOFOLLOW;
+    /*
+     * only supports two modes
+     */
+    if (mode[0] == 'r') {
+        flags |= O_RDONLY;
+    } else if (mode[0] == 'w') {
+        flags |= O_WRONLY | O_TRUNC | O_CREAT;
+        o_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+    } else {
+        return NULL;
+    }
+    fd = open(path, flags, o_mode);
+    if (fd == -1) {
+        return NULL;
+    }
+    fp = fdopen(fd, mode);
+    if (!fp) {
+        close(fd);
+    }
+    return fp;
+}
+
 #define ATTR_MAX 100
 static void local_mapped_file_attr(FsContext *ctx, const char *path,
                                    struct stat *stbuf)
@@ -68,7 +95,7 @@ static void local_mapped_file_attr(FsContext *ctx, const char *path,
     char attr_path[PATH_MAX];
 
     local_mapped_attr_path(ctx, path, attr_path);
-    fp = fopen(attr_path, "r");
+    fp = local_fopen(attr_path, "r");
     if (!fp) {
         return;
     }
@@ -152,7 +179,7 @@ static int local_set_mapped_file_attr(FsContext *ctx,
     char attr_path[PATH_MAX];
     int uid = -1, gid = -1, mode = -1, rdev = -1;
 
-    fp = fopen(local_mapped_attr_path(ctx, path, attr_path), "r");
+    fp = local_fopen(local_mapped_attr_path(ctx, path, attr_path), "r");
     if (!fp) {
         goto create_map_file;
     }
@@ -179,7 +206,7 @@ create_map_file:
     }
 
 update_map_file:
-    fp = fopen(attr_path, "w");
+    fp = local_fopen(attr_path, "w");
     if (!fp) {
         ret = -1;
         goto err_out;
@@ -284,7 +311,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
     if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||
         (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {
         int fd;
-        fd = open(rpath(fs_ctx, path, buffer), O_RDONLY);
+        fd = open(rpath(fs_ctx, path, buffer), O_RDONLY | O_NOFOLLOW);
         if (fd == -1) {
             return -1;
         }
@@ -316,7 +343,7 @@ static int local_open(FsContext *ctx, V9fsPath *fs_path,
     char buffer[PATH_MAX];
     char *path = fs_path->data;
 
-    fs->fd = open(rpath(ctx, path, buffer), flags);
+    fs->fd = open(rpath(ctx, path, buffer), flags | O_NOFOLLOW);
     return fs->fd;
 }
 
@@ -601,6 +628,11 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
     V9fsString fullname;
     char buffer[PATH_MAX];
 
+    /*
+     * Mark all the open to not follow symlinks
+     */
+    flags |= O_NOFOLLOW;
+
     v9fs_string_init(&fullname);
     v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
     path = fullname.data;
@@ -676,8 +708,9 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
     if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
         int fd;
         ssize_t oldpath_size, write_size;
-        fd = open(rpath(fs_ctx, newpath, buffer), O_CREAT|O_EXCL|O_RDWR,
-                SM_LOCAL_MODE_BITS);
+        fd = open(rpath(fs_ctx, newpath, buffer),
+                  O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW,
+                  SM_LOCAL_MODE_BITS);
         if (fd == -1) {
             err = fd;
             goto out;
@@ -705,7 +738,8 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
         int fd;
         ssize_t oldpath_size, write_size;
-        fd = open(rpath(fs_ctx, newpath, buffer), O_CREAT|O_EXCL|O_RDWR,
+        fd = open(rpath(fs_ctx, newpath, buffer),
+                  O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW,
                   SM_LOCAL_MODE_BITS);
         if (fd == -1) {
             err = fd;
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 296f66f..8cbb8ae 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -658,7 +658,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension)
         ret |= S_IFIFO;
     }
     if (mode & P9_STAT_MODE_DEVICE) {
-        if (extension && extension->data[0] == 'c') {
+        if (extension->size && extension->data[0] == 'c') {
             ret |= S_IFCHR;
         } else {
             ret |= S_IFBLK;

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2013-05-29 11:33 Aneesh Kumar K.V
@ 2013-05-31 18:48 ` Anthony Liguori
  0 siblings, 0 replies; 56+ messages in thread
From: Anthony Liguori @ 2013-05-31 18:48 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Anthony Liguori, QEMU Developers

Pulled.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2014-02-05  7:14 Aneesh Kumar K.V
  2014-02-05  7:58 ` Aneesh Kumar K.V
                   ` (2 more replies)
  0 siblings, 3 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-02-05  7:14 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers


Hi Anthony,

Please pull the below update for VirtFS

The following changes since commit 2f61120c10da9128357510debc8e66880cd2bfdc:

  Merge remote-tracking branch 'qmp-unstable/queue/qmp' into staging (2014-02-01 23:32:31 +0000)

are available in the git repository at:


  https://github.com/kvaneesh/qemu.git for-upstream

for you to fetch changes up to f8b7ee38b3ed4ec2da5cc0529cf0cf82c8589805:

  hw/9pfs: fix P9_STATS_GEN handling (2014-02-02 22:09:16 +0530)

----------------------------------------------------------------
Kirill A. Shutemov (4):
      hw/9pfs: fix error handing in local_ioc_getversion()
      hw/9pfs: handle undefined FS_IOC_GETVERSION case in handle_ioc_getversion()
      hw/9pfs: make get_st_gen() return ENOTTY error on special files
      hw/9pfs: fix P9_STATS_GEN handling

 hw/9pfs/cofile.c           |  4 ----
 hw/9pfs/virtio-9p-handle.c |  8 +++++++-
 hw/9pfs/virtio-9p-local.c  | 10 ++++++----
 hw/9pfs/virtio-9p-proxy.c  |  3 ++-
 hw/9pfs/virtio-9p.c        | 12 ++++++++++--
 5 files changed, 25 insertions(+), 12 deletions(-)

 -aneesh

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-02-05  7:14 Aneesh Kumar K.V
@ 2014-02-05  7:58 ` Aneesh Kumar K.V
  2014-02-10 18:48 ` Peter Maydell
  2014-02-10 19:21 ` Andreas Färber
  2 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-02-05  7:58 UTC (permalink / raw)
  To: Anthony Liguori, QEMU Developers


Adding the correct email address for Anthony.

-aneesh

"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:

> Hi Anthony,
>
> Please pull the below update for VirtFS
>
> The following changes since commit 2f61120c10da9128357510debc8e66880cd2bfdc:
>
>   Merge remote-tracking branch 'qmp-unstable/queue/qmp' into staging (2014-02-01 23:32:31 +0000)
>
> are available in the git repository at:
>
>
>   https://github.com/kvaneesh/qemu.git for-upstream
>
> for you to fetch changes up to f8b7ee38b3ed4ec2da5cc0529cf0cf82c8589805:
>
>   hw/9pfs: fix P9_STATS_GEN handling (2014-02-02 22:09:16 +0530)
>
> ----------------------------------------------------------------
> Kirill A. Shutemov (4):
>       hw/9pfs: fix error handing in local_ioc_getversion()
>       hw/9pfs: handle undefined FS_IOC_GETVERSION case in handle_ioc_getversion()
>       hw/9pfs: make get_st_gen() return ENOTTY error on special files
>       hw/9pfs: fix P9_STATS_GEN handling
>
>  hw/9pfs/cofile.c           |  4 ----
>  hw/9pfs/virtio-9p-handle.c |  8 +++++++-
>  hw/9pfs/virtio-9p-local.c  | 10 ++++++----
>  hw/9pfs/virtio-9p-proxy.c  |  3 ++-
>  hw/9pfs/virtio-9p.c        | 12 ++++++++++--
>  5 files changed, 25 insertions(+), 12 deletions(-)
>
>  -aneesh

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-02-05  7:14 Aneesh Kumar K.V
  2014-02-05  7:58 ` Aneesh Kumar K.V
@ 2014-02-10 18:48 ` Peter Maydell
  2014-02-10 19:21 ` Andreas Färber
  2 siblings, 0 replies; 56+ messages in thread
From: Peter Maydell @ 2014-02-10 18:48 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: Anthony Liguori, QEMU Developers

On 5 February 2014 07:14, Aneesh Kumar K.V
<aneesh.kumar@linux.vnet.ibm.com> wrote:
>
> Hi Anthony,
>
> Please pull the below update for VirtFS
>
> The following changes since commit 2f61120c10da9128357510debc8e66880cd2bfdc:
>
>   Merge remote-tracking branch 'qmp-unstable/queue/qmp' into staging (2014-02-01 23:32:31 +0000)
>
> are available in the git repository at:
>
>
>   https://github.com/kvaneesh/qemu.git for-upstream
>
> for you to fetch changes up to f8b7ee38b3ed4ec2da5cc0529cf0cf82c8589805:
>
>   hw/9pfs: fix P9_STATS_GEN handling (2014-02-02 22:09:16 +0530)

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-02-05  7:14 Aneesh Kumar K.V
  2014-02-05  7:58 ` Aneesh Kumar K.V
  2014-02-10 18:48 ` Peter Maydell
@ 2014-02-10 19:21 ` Andreas Färber
  2014-02-10 19:43   ` Peter Maydell
  2 siblings, 1 reply; 56+ messages in thread
From: Andreas Färber @ 2014-02-10 19:21 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Peter Maydell; +Cc: QEMU Developers, Anthony Liguori

Hi Aneesh,

Please remember to label the pull request [PULL 0/m] and to thread the
actual commits as [PULL n/m]. We had to adopt our scripts, too.

Peter, please either enforce those rules or drop them for all of us!

Thanks,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-02-10 19:21 ` Andreas Färber
@ 2014-02-10 19:43   ` Peter Maydell
  2014-02-10 19:48     ` Andreas Färber
  0 siblings, 1 reply; 56+ messages in thread
From: Peter Maydell @ 2014-02-10 19:43 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Aneesh Kumar K.V, Anthony Liguori, QEMU Developers

On 10 February 2014 19:21, Andreas Färber <afaerber@suse.de> wrote:
> Please remember to label the pull request [PULL 0/m] and to thread the
> actual commits as [PULL n/m]. We had to adopt our scripts, too.
>
> Peter, please either enforce those rules or drop them for all of us!

My workflow for applying pull requests doesn't technically
require this or check for it, and so I'm not going to
"enforce" this, since I might well not notice (and in this
case didn't). The rule is not for my benefit when applying
pulls, but for people who might be CC'd on patches forming
part of a pull request and who would otherwise not be able
to tell whether they could reasonably ignore them.

As usual we should:
(a) document our best practice:
 http://wiki.qemu.org/Contribute/SubmitAPullRequest
(b) politely nudge people if they have not followed it
 (and anybody who is adversely affected should feel free
 to do that; I don't have any particular greater standing
 here than you do); since this is pretty much always simply
 an occasional contributor who wasn't aware of something,
 a gentle nudge should be sufficient
(c) be open to reconsidering our practices if on balance the
 burden turns out to be greater than the benefit. (In this
 case personally I think the rule is a useful one.)

It's inevitably the case that some of our process isn't
enforced by technical means and so there will be occasional
accidental violations; we should in general assume good
faith. I'm not going to punitively refuse to apply pull
requests simply because they don't meet every detail of
what we prefer to do (though of course I will and
already have refused pulls which fail on significant points
like lack of signoff or review).

thanks
-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-02-10 19:43   ` Peter Maydell
@ 2014-02-10 19:48     ` Andreas Färber
  2014-02-10 19:51       ` Peter Maydell
  0 siblings, 1 reply; 56+ messages in thread
From: Andreas Färber @ 2014-02-10 19:48 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Aneesh Kumar K.V, Anthony Liguori, QEMU Developers

Am 10.02.2014 20:43, schrieb Peter Maydell:
> On 10 February 2014 19:21, Andreas Färber <afaerber@suse.de> wrote:
>> Please remember to label the pull request [PULL 0/m] and to thread the
>> actual commits as [PULL n/m]. We had to adopt our scripts, too.
>>
>> Peter, please either enforce those rules or drop them for all of us!
> 
> My workflow for applying pull requests doesn't technically
> require this or check for it, and so I'm not going to
[snip]

Anthony said that his "patches" tool relies on the 0/x, and I thought
you were using the same...

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-02-10 19:48     ` Andreas Färber
@ 2014-02-10 19:51       ` Peter Maydell
  0 siblings, 0 replies; 56+ messages in thread
From: Peter Maydell @ 2014-02-10 19:51 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Aneesh Kumar K.V, Anthony Liguori, QEMU Developers

On 10 February 2014 19:48, Andreas Färber <afaerber@suse.de> wrote:
> Am 10.02.2014 20:43, schrieb Peter Maydell:
>> On 10 February 2014 19:21, Andreas Färber <afaerber@suse.de> wrote:
>>> Please remember to label the pull request [PULL 0/m] and to thread the
>>> actual commits as [PULL n/m]. We had to adopt our scripts, too.
>>>
>>> Peter, please either enforce those rules or drop them for all of us!
>>
>> My workflow for applying pull requests doesn't technically
>> require this or check for it, and so I'm not going to
> [snip]
>
> Anthony said that his "patches" tool relies on the 0/x, and I thought
> you were using the same...

I was, but since the patches db isn't currently updating I
wrote a script which drives git directly and just wants the
"repo-url branchname" bit from the cover letter (and I find
the cover letters by textual search for the magic words that
git puts in pull requests).

thanks
-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2014-03-07 15:16 Aneesh Kumar K.V
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 1/5] fsdev: Fix overrun after readlink() fills buffer completely Aneesh Kumar K.V
                   ` (5 more replies)
  0 siblings, 6 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-03-07 15:16 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: qemu-devel

Hi,

Please pull the below update for VirtFS


The following changes since commit d5001cf787ad0514839a81d0f2e771e01e076e21:

  xilinx: Delete hw/include/xilinx.h (2014-02-26 14:54:45 +1000)

are available in the git repository at:

  https://github.com/kvaneesh/qemu.git for-upstream

for you to fetch changes up to 993c91a0e996346c7ee8fa2ca310cc76edb59e17:

  hw/9pfs: Include virtio-9p-device.o in build (2014-03-04 09:20:49 +0530)

----------------------------------------------------------------
Aneesh Kumar K.V (1):
      hw/9pfs: Include virtio-9p-device.o in build

Chen Gang (3):
      hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:"
      hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()
      hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation

Markus Armbruster (1):
      fsdev: Fix overrun after readlink() fills buffer completely

 Makefile.objs                  |   5 -
 fsdev/Makefile.objs            |   4 +-
 fsdev/virtfs-proxy-helper.c    |   2 +-
 hw/9pfs/cofs.c                 |  48 +++++--
 hw/9pfs/virtio-9p-handle.c     |   9 +-
 hw/9pfs/virtio-9p-local.c      | 288 +++++++++++++++++++++++++++--------------
 hw/9pfs/virtio-9p-posix-acl.c  |  52 ++++++--
 hw/9pfs/virtio-9p-xattr-user.c |  27 +++-
 hw/9pfs/virtio-9p-xattr.c      |   9 +-
 hw/9pfs/virtio-9p-xattr.h      |  27 +++-
 hw/9pfs/virtio-9p.h            |   6 +-
 hw/Makefile.objs               |   2 +-
 12 files changed, 322 insertions(+), 157 deletions(-)

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PATCH 1/5] fsdev: Fix overrun after readlink() fills buffer completely
  2014-03-07 15:16 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
@ 2014-03-07 15:16 ` Aneesh Kumar K.V
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 2/5] hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:" Aneesh Kumar K.V
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-03-07 15:16 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: Aneesh Kumar K.V, qemu-devel, Markus Armbruster

From: Markus Armbruster <armbru@redhat.com>

readlink() returns the number of bytes written to the buffer, and it
doesn't write a terminating null byte.  do_readlink() writes it
itself.  Overruns the buffer when readlink() filled it completely.

Fix by reserving space for the null byte when calling readlink(), like
we do elsewhere.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 fsdev/virtfs-proxy-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index 713a7b2b87a4..bfecb8706c85 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -595,7 +595,7 @@ static int do_readlink(struct iovec *iovec, struct iovec *out_iovec)
     }
     buffer = g_malloc(size);
     v9fs_string_init(&target);
-    retval = readlink(path.data, buffer, size);
+    retval = readlink(path.data, buffer, size - 1);
     if (retval > 0) {
         buffer[retval] = '\0';
         v9fs_string_sprintf(&target, "%s", buffer);
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PATCH 2/5] hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:"
  2014-03-07 15:16 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 1/5] fsdev: Fix overrun after readlink() fills buffer completely Aneesh Kumar K.V
@ 2014-03-07 15:16 ` Aneesh Kumar K.V
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 3/5] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf() Aneesh Kumar K.V
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-03-07 15:16 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: Aneesh Kumar K.V, qemu-devel, Chen Gang

From: Chen Gang <gang.chen.5i5j@gmail.com>

When "goto err_out", 'v9fs_string' already was allocated, so still need
free 'v9fs_string' before return.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/9pfs/virtio-9p-local.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c
index df0dbffa7ac4..62e694370f34 100644
--- a/hw/9pfs/virtio-9p-local.c
+++ b/hw/9pfs/virtio-9p-local.c
@@ -1059,9 +1059,9 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
     }
     /* Remove the name finally */
     ret = remove(rpath(ctx, fullname.data, buffer));
-    v9fs_string_free(&fullname);
 
 err_out:
+    v9fs_string_free(&fullname);
     return ret;
 }
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PATCH 3/5] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()
  2014-03-07 15:16 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 1/5] fsdev: Fix overrun after readlink() fills buffer completely Aneesh Kumar K.V
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 2/5] hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:" Aneesh Kumar K.V
@ 2014-03-07 15:16 ` Aneesh Kumar K.V
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation Aneesh Kumar K.V
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-03-07 15:16 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: Aneesh Kumar K.V, qemu-devel, Chen Gang

From: Chen Gang <gang.chen.5i5j@gmail.com>

'ctx->fs_root' + 'path'/'fullname.data' may be larger than PATH_MAX, so
need use snprintf() instead of sprintf() just like another area have done
in 9pfs. This could possibly result in the truncation of pathname, which we
address in the follow up patch.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/9pfs/virtio-9p-local.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c
index 62e694370f34..dc615a4d0fa4 100644
--- a/hw/9pfs/virtio-9p-local.c
+++ b/hw/9pfs/virtio-9p-local.c
@@ -898,7 +898,8 @@ static int local_remove(FsContext *ctx, const char *path)
          * directory
          */
         if (S_ISDIR(stbuf.st_mode)) {
-            sprintf(buffer, "%s/%s/%s", ctx->fs_root, path, VIRTFS_META_DIR);
+            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s",
+                     ctx->fs_root, path, VIRTFS_META_DIR);
             err = remove(buffer);
             if (err < 0 && errno != ENOENT) {
                 /*
@@ -1033,8 +1034,8 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
              * If directory remove .virtfs_metadata contained in the
              * directory
              */
-            sprintf(buffer, "%s/%s/%s", ctx->fs_root,
-                    fullname.data, VIRTFS_META_DIR);
+            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s", ctx->fs_root,
+                     fullname.data, VIRTFS_META_DIR);
             ret = remove(buffer);
             if (ret < 0 && errno != ENOENT) {
                 /*
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation
  2014-03-07 15:16 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
                   ` (2 preceding siblings ...)
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 3/5] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf() Aneesh Kumar K.V
@ 2014-03-07 15:16 ` Aneesh Kumar K.V
  2014-03-08 13:58   ` Chen Gang
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 5/5] hw/9pfs: Include virtio-9p-device.o in build Aneesh Kumar K.V
  2014-03-08 12:52 ` [Qemu-devel] [PULL] VirtFS update Peter Maydell
  5 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-03-07 15:16 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: Aneesh Kumar K.V, qemu-devel, Chen Gang

From: Chen Gang <gang.chen.5i5j@gmail.com>

When path is truncated by PATH_MAX limitation, it causes QEMU to access
incorrect file. So use original full path instead of PATH_MAX within
9pfs (need check/process ENOMEM for related memory allocation).

The related test:

 - Environments (for qemu-devel):

   - Host is under fedora17 desktop with ext4fs:

     qemu-system-x86_64 -hda test.img -m 1024 \
       -net nic,vlan=4,model=virtio,macaddr=00:16:35:AF:94:04 \
       -net tap,vlan=4,ifname=tap4,script=no,downscript=no \
       -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare \
       -fsdev local,security_model=passthrough,id=fsdev0,\
         path=/upstream/vm/data/share/1234567890abcdefghijklmnopqrstuvwxyz\
           ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890acdefghijklmnopqrstuvwxyz\
           ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/111111111111111111111111111\
           1111111111111111111111111111111111111111111111111111222222222222\
           2222222222222222222222222222222222222222222222222222222222222222\
           2222222222222222222222222222222222233333333333333333333333333333\
           3333333333333333333333333333333333

    - Guest is ubuntu12 server with 9pfs.

      mount -t 9p -o trans=virtio,version=9p2000.L hostshare /share

    - Limitations:

      full path limitation is PATH_MAX (4096B include nul) under Linux.
      file/dir node name maximized length is 256 (include nul) under ext4.

 - Special test:

    Under host, modify the file: "/upstream/vm/data/share/1234567890abcdefg\
      hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890acdefghijklmno\
      pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/111111111111111111111\
      111111111111111111111111111111111111111111111111111111111122222222222\
      222222222222222222222222222222222222222222222222222222222222222222222\
      222222222222222222222222222222233333333333333333333333333333333333333\
      3333333333333333333333333/4444444444444444444444444444444444444444444\
      444444444444444444444444444444444444444444444444444444444444444444444\
      444444444444444444444444444444444444444444444444444444444444444444444\
      444444444444444444444444444444444444444/55555555555555555555555555555\
      555555555555555555555555555555555555555555555555555555555555555555555\
      555555555555555555555555555555555555555555555555555555555555555555555\
      555555555555555555555555555555555555555555555555555555555555555555555\
      55555555/666666666666666666666666666666666666666666666666666666666666\
      666666666666666666666666666666666666666666666666666666666666666666666\
      666666666666666666666666666666666666666666666666666666666666666666666\
      666666666666666666666/77777777777777777777777777777777777777777777777\
      777777777777777777777777777777777777777777777777777777777777777777777\
      777777777777777777777777777777777777777777777777777777777777777777777\
      77777777777777777777777777777777777777777777777777777777777/888888888\
      888888888888888888888888888888888888888888888888888888888888888888888\
      888888888888888888888888888888888888888888888888888888888888888888888\
      888888888888888888888888888888888888888888888888888888888888888888888\
      888888888/99999999999999999999999999999999999999999999999999999999999\
      999999999999999999999999999999999999999999999999999999999999999999999\
      999999999999999999999999999999999999999999999999999999999999999999999\
      99999999999999999999999999999999999999999/000000000000000000000000000\
      000000000000000000000000000000000000000000000000000000000000000000000\
      000000000000000000000000000000000000000000000000000000000000000000000\
      000000000000000000000000000000000000000000000000/aaaaaaaaaaaaaaaaaaaa\
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbb\
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ccccccccc\
      ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\
      ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\
      ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\
      cccccccccc/dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\
      ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\
      ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\
      dddddddddddddddddddddd/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
      eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
      eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
      eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/fffffffffffffff\
      fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\
      fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\
      ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gggggggggg\
      ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\
      ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\
      ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\
      ggggggggggggggggggggggg/iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\
      iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\
      iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\
      iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/jjjjjjjjjjjjj\
      jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj\
      jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj/ppppppppppppppppppppp\
      ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\
      ppppppppppppppppppppppppppppppppppppppp/test1234567890file.log"
        (need enter dir firstly, then modify file, or can not open it).

   Under guest, still allow modify "test1234567890file.log" (will generate
   "test123456" file with contents).

   After apply this patch, can not open "test1234567890file.log" under guest
   (permission denied).

 - Common test:

   All are still OK after apply this path.

     "mkdir -p", "create/open file/dir", "modify file/dir", "rm file/dir".
     change various mount point paths under host and/or guest.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/9pfs/cofs.c                 |  48 +++++--
 hw/9pfs/virtio-9p-handle.c     |   9 +-
 hw/9pfs/virtio-9p-local.c      | 287 +++++++++++++++++++++++++++--------------
 hw/9pfs/virtio-9p-posix-acl.c  |  52 ++++++--
 hw/9pfs/virtio-9p-xattr-user.c |  27 +++-
 hw/9pfs/virtio-9p-xattr.c      |   9 +-
 hw/9pfs/virtio-9p-xattr.h      |  27 +++-
 hw/9pfs/virtio-9p.h            |   6 +-
 8 files changed, 316 insertions(+), 149 deletions(-)

diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c
index 389105074852..0aba70ad792f 100644
--- a/hw/9pfs/cofs.c
+++ b/hw/9pfs/cofs.c
@@ -17,35 +17,55 @@
 #include "block/coroutine.h"
 #include "virtio-9p-coth.h"
 
+static ssize_t __readlink(V9fsState *s, V9fsPath *path, V9fsString *buf)
+{
+    ssize_t len, maxlen = PATH_MAX;
+
+    buf->data = g_malloc(PATH_MAX);
+    for (;;) {
+        len = s->ops->readlink(&s->ctx, path, buf->data, maxlen);
+        if (len < 0) {
+            g_free(buf->data);
+            buf->data = NULL;
+            buf->size = 0;
+            break;
+        } else if (len == maxlen) {
+            /*
+             * We dodn't have space to put the NULL or we have more
+             * to read. Increase the size and try again
+             */
+            maxlen *= 2;
+            g_free(buf->data);
+            buf->data = g_malloc(maxlen);
+            continue;
+        }
+        /*
+         * Null terminate the readlink output
+         */
+        buf->data[len] = '\0';
+        buf->size = len;
+        break;
+    }
+    return len;
+}
+
 int v9fs_co_readlink(V9fsPDU *pdu, V9fsPath *path, V9fsString *buf)
 {
     int err;
-    ssize_t len;
     V9fsState *s = pdu->s;
 
     if (v9fs_request_cancelled(pdu)) {
         return -EINTR;
     }
-    buf->data = g_malloc(PATH_MAX);
     v9fs_path_read_lock(s);
     v9fs_co_run_in_worker(
         {
-            len = s->ops->readlink(&s->ctx, path,
-                                   buf->data, PATH_MAX - 1);
-            if (len > -1) {
-                buf->size = len;
-                buf->data[len] = 0;
-                err = 0;
-            } else {
+            err = __readlink(s, path, buf);
+            if (err < 0) {
                 err = -errno;
             }
         });
     v9fs_path_unlock(s);
-    if (err) {
-        g_free(buf->data);
-        buf->data = NULL;
-        buf->size = 0;
-    }
     return err;
 }
 
diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c
index 17002a3d2867..4b79cefd135e 100644
--- a/hw/9pfs/virtio-9p-handle.c
+++ b/hw/9pfs/virtio-9p-handle.c
@@ -498,7 +498,7 @@ static int handle_lremovexattr(FsContext *ctx, V9fsPath *fs_path,
 static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
                               const char *name, V9fsPath *target)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
     struct file_handle *fh;
     int dirfd, ret, mnt_id;
     struct handle_data *data = (struct handle_data *)ctx->private;
@@ -513,7 +513,9 @@ static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
         dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH);
     } else {
         /* relative to export root */
-        dirfd = open(rpath(ctx, ".", buffer), O_DIRECTORY);
+        buffer = rpath(ctx, ".");
+        dirfd = open(buffer, O_DIRECTORY);
+        g_free(buffer);
     }
     if (dirfd < 0) {
         return dirfd;
@@ -521,7 +523,7 @@ static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
     fh = g_malloc(sizeof(struct file_handle) + data->handle_bytes);
     fh->handle_bytes = data->handle_bytes;
     /* add a "./" at the beginning of the path */
-    snprintf(buffer, PATH_MAX, "./%s", name);
+    buffer = g_strdup_printf("./%s", name);
     /* flag = 0 imply don't follow symlink */
     ret = name_to_handle(dirfd, buffer, fh, &mnt_id, 0);
     if (!ret) {
@@ -531,6 +533,7 @@ static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
         g_free(fh);
     }
     close(dirfd);
+    g_free(buffer);
     return ret;
 }
 
diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c
index dc615a4d0fa4..56b302c122b6 100644
--- a/hw/9pfs/virtio-9p-local.c
+++ b/hw/9pfs/virtio-9p-local.c
@@ -42,18 +42,18 @@
 
 #define VIRTFS_META_DIR ".virtfs_metadata"
 
-static const char *local_mapped_attr_path(FsContext *ctx,
-                                          const char *path, char *buffer)
+static char *local_mapped_attr_path(FsContext *ctx, const char *path)
 {
     char *dir_name;
     char *tmp_path = g_strdup(path);
     char *base_name = basename(tmp_path);
+    char *buffer;
 
     /* NULL terminate the directory */
     dir_name = tmp_path;
     *(base_name - 1) = '\0';
 
-    snprintf(buffer, PATH_MAX, "%s/%s/%s/%s",
+    buffer = g_strdup_printf("%s/%s/%s/%s",
              ctx->fs_root, dir_name, VIRTFS_META_DIR, base_name);
     g_free(tmp_path);
     return buffer;
@@ -92,10 +92,11 @@ static void local_mapped_file_attr(FsContext *ctx, const char *path,
 {
     FILE *fp;
     char buf[ATTR_MAX];
-    char attr_path[PATH_MAX];
+    char *attr_path;
 
-    local_mapped_attr_path(ctx, path, attr_path);
+    attr_path = local_mapped_attr_path(ctx, path);
     fp = local_fopen(attr_path, "r");
+    g_free(attr_path);
     if (!fp) {
         return;
     }
@@ -118,12 +119,13 @@ static void local_mapped_file_attr(FsContext *ctx, const char *path,
 static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf)
 {
     int err;
-    char buffer[PATH_MAX];
+    char *buffer;
     char *path = fs_path->data;
 
-    err =  lstat(rpath(fs_ctx, path, buffer), stbuf);
+    buffer = rpath(fs_ctx, path);
+    err =  lstat(buffer, stbuf);
     if (err) {
-        return err;
+        goto err_out;
     }
     if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
         /* Actual credentials are part of extended attrs */
@@ -131,41 +133,42 @@ static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf)
         gid_t tmp_gid;
         mode_t tmp_mode;
         dev_t tmp_dev;
-        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.uid", &tmp_uid,
-                    sizeof(uid_t)) > 0) {
+        if (getxattr(buffer, "user.virtfs.uid", &tmp_uid, sizeof(uid_t)) > 0) {
             stbuf->st_uid = tmp_uid;
         }
-        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.gid", &tmp_gid,
-                    sizeof(gid_t)) > 0) {
+        if (getxattr(buffer, "user.virtfs.gid", &tmp_gid, sizeof(gid_t)) > 0) {
             stbuf->st_gid = tmp_gid;
         }
-        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.mode",
+        if (getxattr(buffer, "user.virtfs.mode",
                     &tmp_mode, sizeof(mode_t)) > 0) {
             stbuf->st_mode = tmp_mode;
         }
-        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.rdev", &tmp_dev,
-                        sizeof(dev_t)) > 0) {
+        if (getxattr(buffer, "user.virtfs.rdev", &tmp_dev, sizeof(dev_t)) > 0) {
                 stbuf->st_rdev = tmp_dev;
         }
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
         local_mapped_file_attr(fs_ctx, path, stbuf);
     }
+
+err_out:
+    g_free(buffer);
     return err;
 }
 
 static int local_create_mapped_attr_dir(FsContext *ctx, const char *path)
 {
     int err;
-    char attr_dir[PATH_MAX];
+    char *attr_dir;
     char *tmp_path = g_strdup(path);
 
-    snprintf(attr_dir, PATH_MAX, "%s/%s/%s",
+    attr_dir = g_strdup_printf("%s/%s/%s",
              ctx->fs_root, dirname(tmp_path), VIRTFS_META_DIR);
 
     err = mkdir(attr_dir, 0700);
     if (err < 0 && errno == EEXIST) {
         err = 0;
     }
+    g_free(attr_dir);
     g_free(tmp_path);
     return err;
 }
@@ -176,10 +179,11 @@ static int local_set_mapped_file_attr(FsContext *ctx,
     FILE *fp;
     int ret = 0;
     char buf[ATTR_MAX];
-    char attr_path[PATH_MAX];
+    char *attr_path;
     int uid = -1, gid = -1, mode = -1, rdev = -1;
 
-    fp = local_fopen(local_mapped_attr_path(ctx, path, attr_path), "r");
+    attr_path = local_mapped_attr_path(ctx, path);
+    fp = local_fopen(attr_path, "r");
     if (!fp) {
         goto create_map_file;
     }
@@ -241,6 +245,7 @@ update_map_file:
     fclose(fp);
 
 err_out:
+    g_free(attr_path);
     return ret;
 }
 
@@ -282,36 +287,43 @@ static int local_set_xattr(const char *path, FsCred *credp)
 static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,
                                          FsCred *credp)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
 
-    if (lchown(rpath(fs_ctx, path, buffer), credp->fc_uid,
-                credp->fc_gid) < 0) {
+    buffer = rpath(fs_ctx, path);
+    if (lchown(buffer, credp->fc_uid, credp->fc_gid) < 0) {
         /*
          * If we fail to change ownership and if we are
          * using security model none. Ignore the error
          */
         if ((fs_ctx->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) {
-            return -1;
+            goto err;
         }
     }
 
-    if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) {
-        return -1;
+    if (chmod(buffer, credp->fc_mode & 07777) < 0) {
+        goto err;
     }
+
+    g_free(buffer);
     return 0;
+err:
+    g_free(buffer);
+    return -1;
 }
 
 static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
                               char *buf, size_t bufsz)
 {
     ssize_t tsize = -1;
-    char buffer[PATH_MAX];
+    char *buffer;
     char *path = fs_path->data;
 
     if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||
         (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {
         int fd;
-        fd = open(rpath(fs_ctx, path, buffer), O_RDONLY | O_NOFOLLOW);
+        buffer = rpath(fs_ctx, path);
+        fd = open(buffer, O_RDONLY | O_NOFOLLOW);
+        g_free(buffer);
         if (fd == -1) {
             return -1;
         }
@@ -322,7 +334,9 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
         return tsize;
     } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
                (fs_ctx->export_flags & V9FS_SM_NONE)) {
-        tsize = readlink(rpath(fs_ctx, path, buffer), buf, bufsz);
+        buffer = rpath(fs_ctx, path);
+        tsize = readlink(buffer, buf, bufsz);
+        g_free(buffer);
     }
     return tsize;
 }
@@ -340,20 +354,24 @@ static int local_closedir(FsContext *ctx, V9fsFidOpenState *fs)
 static int local_open(FsContext *ctx, V9fsPath *fs_path,
                       int flags, V9fsFidOpenState *fs)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
     char *path = fs_path->data;
 
-    fs->fd = open(rpath(ctx, path, buffer), flags | O_NOFOLLOW);
+    buffer = rpath(ctx, path);
+    fs->fd = open(buffer, flags | O_NOFOLLOW);
+    g_free(buffer);
     return fs->fd;
 }
 
 static int local_opendir(FsContext *ctx,
                          V9fsPath *fs_path, V9fsFidOpenState *fs)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
     char *path = fs_path->data;
 
-    fs->dir = opendir(rpath(ctx, path, buffer));
+    buffer = rpath(ctx, path);
+    fs->dir = opendir(buffer);
+    g_free(buffer);
     if (!fs->dir) {
         return -1;
     }
@@ -441,18 +459,23 @@ static ssize_t local_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
 
 static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    int ret = -1;
     char *path = fs_path->data;
 
     if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
-        return local_set_xattr(rpath(fs_ctx, path, buffer), credp);
+        buffer = rpath(fs_ctx, path);
+        ret = local_set_xattr(buffer, credp);
+        g_free(buffer);
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
         return local_set_mapped_file_attr(fs_ctx, path, credp);
     } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
                (fs_ctx->export_flags & V9FS_SM_NONE)) {
-        return chmod(rpath(fs_ctx, path, buffer), credp->fc_mode);
+        buffer = rpath(fs_ctx, path);
+        ret = chmod(buffer, credp->fc_mode);
+        g_free(buffer);
     }
-    return -1;
+    return ret;
 }
 
 static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
@@ -462,7 +485,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
     int err = -1;
     int serrno = 0;
     V9fsString fullname;
-    char buffer[PATH_MAX];
+    char *buffer;
 
     v9fs_string_init(&fullname);
     v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
@@ -470,21 +493,23 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
 
     /* Determine the security model */
     if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
-        err = mknod(rpath(fs_ctx, path, buffer),
-                SM_LOCAL_MODE_BITS|S_IFREG, 0);
+        buffer = rpath(fs_ctx, path);
+        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);
         if (err == -1) {
+            g_free(buffer);
             goto out;
         }
-        err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
+        err = local_set_xattr(buffer, credp);
         if (err == -1) {
             serrno = errno;
             goto err_end;
         }
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
 
-        err = mknod(rpath(fs_ctx, path, buffer),
-                    SM_LOCAL_MODE_BITS|S_IFREG, 0);
+        buffer = rpath(fs_ctx, path);
+        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);
         if (err == -1) {
+            g_free(buffer);
             goto out;
         }
         err = local_set_mapped_file_attr(fs_ctx, path, credp);
@@ -494,9 +519,10 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
         }
     } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
                (fs_ctx->export_flags & V9FS_SM_NONE)) {
-        err = mknod(rpath(fs_ctx, path, buffer), credp->fc_mode,
-                credp->fc_rdev);
+        buffer = rpath(fs_ctx, path);
+        err = mknod(buffer, credp->fc_mode, credp->fc_rdev);
         if (err == -1) {
+            g_free(buffer);
             goto out;
         }
         err = local_post_create_passthrough(fs_ctx, path, credp);
@@ -508,8 +534,9 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
     goto out;
 
 err_end:
-    remove(rpath(fs_ctx, path, buffer));
+    remove(buffer);
     errno = serrno;
+    g_free(buffer);
 out:
     v9fs_string_free(&fullname);
     return err;
@@ -522,7 +549,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
     int err = -1;
     int serrno = 0;
     V9fsString fullname;
-    char buffer[PATH_MAX];
+    char *buffer;
 
     v9fs_string_init(&fullname);
     v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
@@ -530,19 +557,23 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
 
     /* Determine the security model */
     if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
-        err = mkdir(rpath(fs_ctx, path, buffer), SM_LOCAL_DIR_MODE_BITS);
+        buffer = rpath(fs_ctx, path);
+        err = mkdir(buffer, SM_LOCAL_DIR_MODE_BITS);
         if (err == -1) {
+            g_free(buffer);
             goto out;
         }
         credp->fc_mode = credp->fc_mode|S_IFDIR;
-        err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
+        err = local_set_xattr(buffer, credp);
         if (err == -1) {
             serrno = errno;
             goto err_end;
         }
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
-        err = mkdir(rpath(fs_ctx, path, buffer), SM_LOCAL_DIR_MODE_BITS);
+        buffer = rpath(fs_ctx, path);
+        err = mkdir(buffer, SM_LOCAL_DIR_MODE_BITS);
         if (err == -1) {
+            g_free(buffer);
             goto out;
         }
         credp->fc_mode = credp->fc_mode|S_IFDIR;
@@ -553,8 +584,10 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
         }
     } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
                (fs_ctx->export_flags & V9FS_SM_NONE)) {
-        err = mkdir(rpath(fs_ctx, path, buffer), credp->fc_mode);
+        buffer = rpath(fs_ctx, path);
+        err = mkdir(buffer, credp->fc_mode);
         if (err == -1) {
+            g_free(buffer);
             goto out;
         }
         err = local_post_create_passthrough(fs_ctx, path, credp);
@@ -566,8 +599,9 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
     goto out;
 
 err_end:
-    remove(rpath(fs_ctx, path, buffer));
+    remove(buffer);
     errno = serrno;
+    g_free(buffer);
 out:
     v9fs_string_free(&fullname);
     return err;
@@ -626,7 +660,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
     int err = -1;
     int serrno = 0;
     V9fsString fullname;
-    char buffer[PATH_MAX];
+    char *buffer;
 
     /*
      * Mark all the open to not follow symlinks
@@ -639,21 +673,25 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
 
     /* Determine the security model */
     if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
-        fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS);
+        buffer = rpath(fs_ctx, path);
+        fd = open(buffer, flags, SM_LOCAL_MODE_BITS);
         if (fd == -1) {
+            g_free(buffer);
             err = fd;
             goto out;
         }
         credp->fc_mode = credp->fc_mode|S_IFREG;
         /* Set cleint credentials in xattr */
-        err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
+        err = local_set_xattr(buffer, credp);
         if (err == -1) {
             serrno = errno;
             goto err_end;
         }
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
-        fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS);
+        buffer = rpath(fs_ctx, path);
+        fd = open(buffer, flags, SM_LOCAL_MODE_BITS);
         if (fd == -1) {
+            g_free(buffer);
             err = fd;
             goto out;
         }
@@ -666,8 +704,10 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
         }
     } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
                (fs_ctx->export_flags & V9FS_SM_NONE)) {
-        fd = open(rpath(fs_ctx, path, buffer), flags, credp->fc_mode);
+        buffer = rpath(fs_ctx, path);
+        fd = open(buffer, flags, credp->fc_mode);
         if (fd == -1) {
+            g_free(buffer);
             err = fd;
             goto out;
         }
@@ -683,8 +723,9 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
 
 err_end:
     close(fd);
-    remove(rpath(fs_ctx, path, buffer));
+    remove(buffer);
     errno = serrno;
+    g_free(buffer);
 out:
     v9fs_string_free(&fullname);
     return err;
@@ -698,7 +739,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
     int serrno = 0;
     char *newpath;
     V9fsString fullname;
-    char buffer[PATH_MAX];
+    char *buffer;
 
     v9fs_string_init(&fullname);
     v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
@@ -708,10 +749,10 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
     if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
         int fd;
         ssize_t oldpath_size, write_size;
-        fd = open(rpath(fs_ctx, newpath, buffer),
-                  O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW,
-                  SM_LOCAL_MODE_BITS);
+        buffer = rpath(fs_ctx, newpath);
+        fd = open(buffer, O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW, SM_LOCAL_MODE_BITS);
         if (fd == -1) {
+            g_free(buffer);
             err = fd;
             goto out;
         }
@@ -730,7 +771,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
         close(fd);
         /* Set cleint credentials in symlink's xattr */
         credp->fc_mode = credp->fc_mode|S_IFLNK;
-        err = local_set_xattr(rpath(fs_ctx, newpath, buffer), credp);
+        err = local_set_xattr(buffer, credp);
         if (err == -1) {
             serrno = errno;
             goto err_end;
@@ -738,10 +779,10 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
         int fd;
         ssize_t oldpath_size, write_size;
-        fd = open(rpath(fs_ctx, newpath, buffer),
-                  O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW,
-                  SM_LOCAL_MODE_BITS);
+        buffer = rpath(fs_ctx, newpath);
+        fd = open(buffer, O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW, SM_LOCAL_MODE_BITS);
         if (fd == -1) {
+            g_free(buffer);
             err = fd;
             goto out;
         }
@@ -767,12 +808,13 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
         }
     } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
                (fs_ctx->export_flags & V9FS_SM_NONE)) {
-        err = symlink(oldpath, rpath(fs_ctx, newpath, buffer));
+        buffer = rpath(fs_ctx, newpath);
+        err = symlink(oldpath, buffer);
         if (err) {
+            g_free(buffer);
             goto out;
         }
-        err = lchown(rpath(fs_ctx, newpath, buffer), credp->fc_uid,
-                     credp->fc_gid);
+        err = lchown(buffer, credp->fc_uid, credp->fc_gid);
         if (err == -1) {
             /*
              * If we fail to change ownership and if we are
@@ -788,8 +830,9 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
     goto out;
 
 err_end:
-    remove(rpath(fs_ctx, newpath, buffer));
+    remove(buffer);
     errno = serrno;
+    g_free(buffer);
 out:
     v9fs_string_free(&fullname);
     return err;
@@ -800,13 +843,16 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
 {
     int ret;
     V9fsString newpath;
-    char buffer[PATH_MAX], buffer1[PATH_MAX];
+    char *buffer, *buffer1;
 
     v9fs_string_init(&newpath);
     v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name);
 
-    ret = link(rpath(ctx, oldpath->data, buffer),
-               rpath(ctx, newpath.data, buffer1));
+    buffer = rpath(ctx, oldpath->data);
+    buffer1 = rpath(ctx, newpath.data);
+    ret = link(buffer, buffer1);
+    g_free(buffer);
+    g_free(buffer1);
 
     /* now link the virtfs_metadata files */
     if (!ret && (ctx->export_flags & V9FS_SM_MAPPED_FILE)) {
@@ -815,8 +861,11 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
         if (ret < 0) {
             goto err_out;
         }
-        ret = link(local_mapped_attr_path(ctx, oldpath->data, buffer),
-                   local_mapped_attr_path(ctx, newpath.data, buffer1));
+        buffer = local_mapped_attr_path(ctx, oldpath->data);
+        buffer1 = local_mapped_attr_path(ctx, newpath.data);
+        ret = link(buffer, buffer1);
+        g_free(buffer);
+        g_free(buffer1);
         if (ret < 0 && errno != ENOENT) {
             goto err_out;
         }
@@ -828,17 +877,21 @@ err_out:
 
 static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    int ret;
     char *path = fs_path->data;
 
-    return truncate(rpath(ctx, path, buffer), size);
+    buffer = rpath(ctx, path);
+    ret = truncate(buffer, size);
+    g_free(buffer);
+    return ret;
 }
 
 static int local_rename(FsContext *ctx, const char *oldpath,
                         const char *newpath)
 {
     int err;
-    char buffer[PATH_MAX], buffer1[PATH_MAX];
+    char *buffer, *buffer1;
 
     if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
         err = local_create_mapped_attr_dir(ctx, newpath);
@@ -846,50 +899,69 @@ static int local_rename(FsContext *ctx, const char *oldpath,
             return err;
         }
         /* rename the .virtfs_metadata files */
-        err = rename(local_mapped_attr_path(ctx, oldpath, buffer),
-                     local_mapped_attr_path(ctx, newpath, buffer1));
+        buffer = local_mapped_attr_path(ctx, oldpath);
+        buffer1 = local_mapped_attr_path(ctx, newpath);
+        err = rename(buffer, buffer1);
+        g_free(buffer);
+        g_free(buffer1);
         if (err < 0 && errno != ENOENT) {
             return err;
         }
     }
-    return rename(rpath(ctx, oldpath, buffer), rpath(ctx, newpath, buffer1));
+
+    buffer = rpath(ctx, oldpath);
+    buffer1 = rpath(ctx, newpath);
+    err = rename(buffer, buffer1);
+    g_free(buffer);
+    g_free(buffer1);
+    return err;
 }
 
 static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    int ret = -1;
     char *path = fs_path->data;
 
     if ((credp->fc_uid == -1 && credp->fc_gid == -1) ||
         (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
         (fs_ctx->export_flags & V9FS_SM_NONE)) {
-        return lchown(rpath(fs_ctx, path, buffer),
-                      credp->fc_uid, credp->fc_gid);
+        buffer = rpath(fs_ctx, path);
+        ret = lchown(buffer, credp->fc_uid, credp->fc_gid);
+        g_free(buffer);
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
-        return local_set_xattr(rpath(fs_ctx, path, buffer), credp);
+        buffer = rpath(fs_ctx, path);
+        ret = local_set_xattr(buffer, credp);
+        g_free(buffer);
     } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
         return local_set_mapped_file_attr(fs_ctx, path, credp);
     }
-    return -1;
+    return ret;
 }
 
 static int local_utimensat(FsContext *s, V9fsPath *fs_path,
                            const struct timespec *buf)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    int ret;
     char *path = fs_path->data;
 
-    return qemu_utimens(rpath(s, path, buffer), buf);
+    buffer = rpath(s, path);
+    ret = qemu_utimens(buffer, buf);
+    g_free(buffer);
+    return ret;
 }
 
 static int local_remove(FsContext *ctx, const char *path)
 {
     int err;
     struct stat stbuf;
-    char buffer[PATH_MAX];
+    char *buffer;
 
     if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
-        err =  lstat(rpath(ctx, path, buffer), &stbuf);
+        buffer = rpath(ctx, path);
+        err =  lstat(buffer, &stbuf);
+        g_free(buffer);
         if (err) {
             goto err_out;
         }
@@ -898,9 +970,10 @@ static int local_remove(FsContext *ctx, const char *path)
          * directory
          */
         if (S_ISDIR(stbuf.st_mode)) {
-            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s",
-                     ctx->fs_root, path, VIRTFS_META_DIR);
+            buffer = g_strdup_printf("%s/%s/%s", ctx->fs_root,
+                                     path, VIRTFS_META_DIR);
             err = remove(buffer);
+            g_free(buffer);
             if (err < 0 && errno != ENOENT) {
                 /*
                  * We didn't had the .virtfs_metadata file. May be file created
@@ -913,7 +986,9 @@ static int local_remove(FsContext *ctx, const char *path)
          * Now remove the name from parent directory
          * .virtfs_metadata directory
          */
-        err = remove(local_mapped_attr_path(ctx, path, buffer));
+        buffer = local_mapped_attr_path(ctx, path);
+        err = remove(buffer);
+        g_free(buffer);
         if (err < 0 && errno != ENOENT) {
             /*
              * We didn't had the .virtfs_metadata file. May be file created
@@ -922,7 +997,10 @@ static int local_remove(FsContext *ctx, const char *path)
             goto err_out;
         }
     }
-    return remove(rpath(ctx, path, buffer));
+
+    buffer = rpath(ctx, path);
+    err = remove(buffer);
+    g_free(buffer);
 err_out:
     return err;
 }
@@ -947,10 +1025,14 @@ static int local_fsync(FsContext *ctx, int fid_type,
 
 static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    int ret;
     char *path = fs_path->data;
 
-    return statfs(rpath(s, path, buffer), stbuf);
+    buffer = rpath(s, path);
+    ret = statfs(buffer, stbuf);
+    g_free(buffer);
+    return ret;
 }
 
 static ssize_t local_lgetxattr(FsContext *ctx, V9fsPath *fs_path,
@@ -1023,7 +1105,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
 {
     int ret;
     V9fsString fullname;
-    char buffer[PATH_MAX];
+    char *buffer;
 
     v9fs_string_init(&fullname);
 
@@ -1034,9 +1116,10 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
              * If directory remove .virtfs_metadata contained in the
              * directory
              */
-            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s", ctx->fs_root,
-                     fullname.data, VIRTFS_META_DIR);
+            buffer = g_strdup_printf("%s/%s/%s", ctx->fs_root,
+                                     fullname.data, VIRTFS_META_DIR);
             ret = remove(buffer);
+            g_free(buffer);
             if (ret < 0 && errno != ENOENT) {
                 /*
                  * We didn't had the .virtfs_metadata file. May be file created
@@ -1049,7 +1132,9 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
          * Now remove the name from parent directory
          * .virtfs_metadata directory.
          */
-        ret = remove(local_mapped_attr_path(ctx, fullname.data, buffer));
+        buffer = local_mapped_attr_path(ctx, fullname.data);
+        ret = remove(buffer);
+        g_free(buffer);
         if (ret < 0 && errno != ENOENT) {
             /*
              * We didn't had the .virtfs_metadata file. May be file created
@@ -1059,7 +1144,9 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
         }
     }
     /* Remove the name finally */
-    ret = remove(rpath(ctx, fullname.data, buffer));
+    buffer = rpath(ctx, fullname.data);
+    ret = remove(buffer);
+    g_free(buffer);
 
 err_out:
     v9fs_string_free(&fullname);
diff --git a/hw/9pfs/virtio-9p-posix-acl.c b/hw/9pfs/virtio-9p-posix-acl.c
index 339c5ecae441..803d9d94f3b8 100644
--- a/hw/9pfs/virtio-9p-posix-acl.c
+++ b/hw/9pfs/virtio-9p-posix-acl.c
@@ -26,8 +26,13 @@
 static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path,
                                 const char *name, void *value, size_t size)
 {
-    char buffer[PATH_MAX];
-    return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value, size);
+    char *buffer;
+    ssize_t ret;
+
+    buffer = rpath(ctx, path);
+    ret = lgetxattr(buffer, MAP_ACL_ACCESS, value, size);
+    g_free(buffer);
+    return ret;
 }
 
 static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path,
@@ -52,17 +57,23 @@ static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path,
 static int mp_pacl_setxattr(FsContext *ctx, const char *path, const char *name,
                             void *value, size_t size, int flags)
 {
-    char buffer[PATH_MAX];
-    return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value,
-            size, flags);
+    char *buffer;
+    int ret;
+
+    buffer = rpath(ctx, path);
+    ret = lsetxattr(buffer, MAP_ACL_ACCESS, value, size, flags);
+    g_free(buffer);
+    return ret;
 }
 
 static int mp_pacl_removexattr(FsContext *ctx,
                                const char *path, const char *name)
 {
     int ret;
-    char buffer[PATH_MAX];
-    ret  = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS);
+    char *buffer;
+
+    buffer = rpath(ctx, path);
+    ret  = lremovexattr(buffer, MAP_ACL_ACCESS);
     if (ret == -1 && errno == ENODATA) {
         /*
          * We don't get ENODATA error when trying to remove a
@@ -72,14 +83,20 @@ static int mp_pacl_removexattr(FsContext *ctx,
         errno = 0;
         ret = 0;
     }
+    g_free(buffer);
     return ret;
 }
 
 static ssize_t mp_dacl_getxattr(FsContext *ctx, const char *path,
                                 const char *name, void *value, size_t size)
 {
-    char buffer[PATH_MAX];
-    return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT, value, size);
+    char *buffer;
+    ssize_t ret;
+
+    buffer = rpath(ctx, path);
+    ret = lgetxattr(buffer, MAP_ACL_DEFAULT, value, size);
+    g_free(buffer);
+    return ret;
 }
 
 static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path,
@@ -104,17 +121,23 @@ static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path,
 static int mp_dacl_setxattr(FsContext *ctx, const char *path, const char *name,
                             void *value, size_t size, int flags)
 {
-    char buffer[PATH_MAX];
-    return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT, value,
-            size, flags);
+    char *buffer;
+    int ret;
+
+    buffer = rpath(ctx, path);
+    ret = lsetxattr(buffer, MAP_ACL_DEFAULT, value, size, flags);
+    g_free(buffer);
+    return ret;
 }
 
 static int mp_dacl_removexattr(FsContext *ctx,
                                const char *path, const char *name)
 {
     int ret;
-    char buffer[PATH_MAX];
-    ret  = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT);
+    char *buffer;
+
+    buffer = rpath(ctx, path);
+    ret  = lremovexattr(buffer, MAP_ACL_DEFAULT);
     if (ret == -1 && errno == ENODATA) {
         /*
          * We don't get ENODATA error when trying to remove a
@@ -124,6 +147,7 @@ static int mp_dacl_removexattr(FsContext *ctx,
         errno = 0;
         ret = 0;
     }
+    g_free(buffer);
     return ret;
 }
 
diff --git a/hw/9pfs/virtio-9p-xattr-user.c b/hw/9pfs/virtio-9p-xattr-user.c
index e0c92ebf9e5d..46133e06dbdf 100644
--- a/hw/9pfs/virtio-9p-xattr-user.c
+++ b/hw/9pfs/virtio-9p-xattr-user.c
@@ -21,7 +21,9 @@
 static ssize_t mp_user_getxattr(FsContext *ctx, const char *path,
                                 const char *name, void *value, size_t size)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    ssize_t ret;
+
     if (strncmp(name, "user.virtfs.", 12) == 0) {
         /*
          * Don't allow fetch of user.virtfs namesapce
@@ -30,7 +32,10 @@ static ssize_t mp_user_getxattr(FsContext *ctx, const char *path,
         errno = ENOATTR;
         return -1;
     }
-    return lgetxattr(rpath(ctx, path, buffer), name, value, size);
+    buffer = rpath(ctx, path);
+    ret = lgetxattr(buffer, name, value, size);
+    g_free(buffer);
+    return ret;
 }
 
 static ssize_t mp_user_listxattr(FsContext *ctx, const char *path,
@@ -69,7 +74,9 @@ static ssize_t mp_user_listxattr(FsContext *ctx, const char *path,
 static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name,
                             void *value, size_t size, int flags)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    int ret;
+
     if (strncmp(name, "user.virtfs.", 12) == 0) {
         /*
          * Don't allow fetch of user.virtfs namesapce
@@ -78,13 +85,18 @@ static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name,
         errno = EACCES;
         return -1;
     }
-    return lsetxattr(rpath(ctx, path, buffer), name, value, size, flags);
+    buffer = rpath(ctx, path);
+    ret = lsetxattr(buffer, name, value, size, flags);
+    g_free(buffer);
+    return ret;
 }
 
 static int mp_user_removexattr(FsContext *ctx,
                                const char *path, const char *name)
 {
-    char buffer[PATH_MAX];
+    char *buffer;
+    int ret;
+
     if (strncmp(name, "user.virtfs.", 12) == 0) {
         /*
          * Don't allow fetch of user.virtfs namesapce
@@ -93,7 +105,10 @@ static int mp_user_removexattr(FsContext *ctx,
         errno = EACCES;
         return -1;
     }
-    return lremovexattr(rpath(ctx, path, buffer), name);
+    buffer = rpath(ctx, path);
+    ret = lremovexattr(buffer, name);
+    g_free(buffer);
+    return ret;
 }
 
 XattrOperations mapped_user_xattr = {
diff --git a/hw/9pfs/virtio-9p-xattr.c b/hw/9pfs/virtio-9p-xattr.c
index 3fae557a84ff..07183887c5ee 100644
--- a/hw/9pfs/virtio-9p-xattr.c
+++ b/hw/9pfs/virtio-9p-xattr.c
@@ -67,21 +67,24 @@ ssize_t v9fs_list_xattr(FsContext *ctx, const char *path,
                         void *value, size_t vsize)
 {
     ssize_t size = 0;
-    char buffer[PATH_MAX];
+    char *buffer;
     void *ovalue = value;
     XattrOperations *xops;
     char *orig_value, *orig_value_start;
     ssize_t xattr_len, parsed_len = 0, attr_len;
 
     /* Get the actual len */
-    xattr_len = llistxattr(rpath(ctx, path, buffer), value, 0);
+    buffer = rpath(ctx, path);
+    xattr_len = llistxattr(buffer, value, 0);
     if (xattr_len <= 0) {
+        g_free(buffer);
         return xattr_len;
     }
 
     /* Now fetch the xattr and find the actual size */
     orig_value = g_malloc(xattr_len);
-    xattr_len = llistxattr(rpath(ctx, path, buffer), orig_value, xattr_len);
+    xattr_len = llistxattr(buffer, orig_value, xattr_len);
+    g_free(buffer);
 
     /* store the orig pointer */
     orig_value_start = orig_value;
diff --git a/hw/9pfs/virtio-9p-xattr.h b/hw/9pfs/virtio-9p-xattr.h
index 41cc6cbc7ba0..327b32b5aa9e 100644
--- a/hw/9pfs/virtio-9p-xattr.h
+++ b/hw/9pfs/virtio-9p-xattr.h
@@ -54,23 +54,38 @@ ssize_t pt_listxattr(FsContext *ctx, const char *path, char *name, void *value,
 static inline ssize_t pt_getxattr(FsContext *ctx, const char *path,
                                   const char *name, void *value, size_t size)
 {
-    char buffer[PATH_MAX];
-    return lgetxattr(rpath(ctx, path, buffer), name, value, size);
+    char *buffer;
+    ssize_t ret;
+
+    buffer = rpath(ctx, path);
+    ret = lgetxattr(buffer, name, value, size);
+    g_free(buffer);
+    return ret;
 }
 
 static inline int pt_setxattr(FsContext *ctx, const char *path,
                               const char *name, void *value,
                               size_t size, int flags)
 {
-    char buffer[PATH_MAX];
-    return lsetxattr(rpath(ctx, path, buffer), name, value, size, flags);
+    char *buffer;
+    int ret;
+
+    buffer = rpath(ctx, path);
+    ret = lsetxattr(buffer, name, value, size, flags);
+    g_free(buffer);
+    return ret;
 }
 
 static inline int pt_removexattr(FsContext *ctx,
                                  const char *path, const char *name)
 {
-    char buffer[PATH_MAX];
-    return lremovexattr(rpath(ctx, path, buffer), name);
+    char *buffer;
+    int ret;
+
+    buffer = rpath(ctx, path);
+    ret = lremovexattr(path, name);
+    g_free(buffer);
+    return ret;
 }
 
 static inline ssize_t notsup_getxattr(FsContext *ctx, const char *path,
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 1d6eedb7d8bc..2c3603aed0d0 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.h
@@ -6,6 +6,7 @@
 #include <sys/time.h>
 #include <utime.h>
 #include <sys/resource.h>
+#include <glib.h>
 #include "hw/virtio/virtio.h"
 #include "fsdev/file-op-9p.h"
 #include "fsdev/virtio-9p-marshal.h"
@@ -112,10 +113,9 @@ enum p9_proto_version {
 
 #define FID_REFERENCED          0x1
 #define FID_NON_RECLAIMABLE     0x2
-static inline const char *rpath(FsContext *ctx, const char *path, char *buffer)
+static inline char *rpath(FsContext *ctx, const char *path)
 {
-    snprintf(buffer, PATH_MAX, "%s/%s", ctx->fs_root, path);
-    return buffer;
+    return g_strdup_printf("%s/%s", ctx->fs_root, path);
 }
 
 /*
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PATCH 5/5] hw/9pfs: Include virtio-9p-device.o in build
  2014-03-07 15:16 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
                   ` (3 preceding siblings ...)
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation Aneesh Kumar K.V
@ 2014-03-07 15:16 ` Aneesh Kumar K.V
  2014-03-07 15:30   ` Andreas Färber
  2014-03-08 12:52 ` [Qemu-devel] [PULL] VirtFS update Peter Maydell
  5 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-03-07 15:16 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: qemu-devel, Aneesh Kumar K.V

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

After commit ba1183da9a10b94611cad88c44a5c6df005f9b55 we are including
hw/Makefile.objs directly from Makefile.target. Make sure hw/Makefile.objs
rules doesn't depend on variable defined in Makefile.objs

Tested-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 Makefile.objs       | 5 -----
 fsdev/Makefile.objs | 4 +++-
 hw/Makefile.objs    | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index 4a62913a4d25..5cd3d816ffb0 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -21,11 +21,6 @@ block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
 
 block-obj-m = block/
 
-ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
-# Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
-# only pull in the actual virtio-9p device if we also enabled virtio.
-CONFIG_REALLY_VIRTFS=y
-endif
 
 ######################################################################
 # smartcard
diff --git a/fsdev/Makefile.objs b/fsdev/Makefile.objs
index 206289c49f18..c27dad3f6dc7 100644
--- a/fsdev/Makefile.objs
+++ b/fsdev/Makefile.objs
@@ -1,4 +1,6 @@
-ifeq ($(CONFIG_REALLY_VIRTFS),y)
+ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
+# Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
+# only pull in the actual virtio-9p device if we also enabled virtio.
 common-obj-y = qemu-fsdev.o virtio-9p-marshal.o
 else
 common-obj-y = qemu-fsdev-dummy.o
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 05a00dc40133..d178b65de4d0 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -1,4 +1,4 @@
-devices-dirs-$(CONFIG_REALLY_VIRTFS) += 9pfs/
+devices-dirs-$(call land, $(CONFIG_VIRTIO),$(call land,$(CONFIG_VIRTFS),$(CONFIG_PCI))) += 9pfs/
 devices-dirs-$(CONFIG_ACPI) += acpi/
 devices-dirs-$(CONFIG_SOFTMMU) += audio/
 devices-dirs-$(CONFIG_SOFTMMU) += block/
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] hw/9pfs: Include virtio-9p-device.o in build
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 5/5] hw/9pfs: Include virtio-9p-device.o in build Aneesh Kumar K.V
@ 2014-03-07 15:30   ` Andreas Färber
  2014-03-07 17:07     ` Aneesh Kumar K.V
  0 siblings, 1 reply; 56+ messages in thread
From: Andreas Färber @ 2014-03-07 15:30 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: peter.maydell, qemu-devel, anthony

Am 07.03.2014 16:16, schrieb Aneesh Kumar K.V:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> 
> After commit ba1183da9a10b94611cad88c44a5c6df005f9b55 we are including
> hw/Makefile.objs directly from Makefile.target. Make sure hw/Makefile.objs
> rules doesn't depend on variable defined in Makefile.objs
> 
> Tested-by: Serge Hallyn <serge.hallyn@ubuntu.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Missing my Tested-by FWIW - but getting it fixed is the important part.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH 5/5] hw/9pfs: Include virtio-9p-device.o in build
  2014-03-07 15:30   ` Andreas Färber
@ 2014-03-07 17:07     ` Aneesh Kumar K.V
  0 siblings, 0 replies; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-03-07 17:07 UTC (permalink / raw)
  To: Andreas Färber; +Cc: peter.maydell, qemu-devel, anthony

Andreas Färber <afaerber@suse.de> writes:

> Am 07.03.2014 16:16, schrieb Aneesh Kumar K.V:
>> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>> 
>> After commit ba1183da9a10b94611cad88c44a5c6df005f9b55 we are including
>> hw/Makefile.objs directly from Makefile.target. Make sure hw/Makefile.objs
>> rules doesn't depend on variable defined in Makefile.objs
>> 
>> Tested-by: Serge Hallyn <serge.hallyn@ubuntu.com>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>
> Missing my Tested-by FWIW - but getting it fixed is the important part.
>

I had the tree pushed to github before that based on Serge's
feedback. I didn't want to rewrite the history before pull request.

-aneesh

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-03-07 15:16 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
                   ` (4 preceding siblings ...)
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 5/5] hw/9pfs: Include virtio-9p-device.o in build Aneesh Kumar K.V
@ 2014-03-08 12:52 ` Peter Maydell
  5 siblings, 0 replies; 56+ messages in thread
From: Peter Maydell @ 2014-03-08 12:52 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers, Anthony Liguori

On 7 March 2014 15:16, Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> wrote:
> Hi,
>
> Please pull the below update for VirtFS
>
>
> The following changes since commit d5001cf787ad0514839a81d0f2e771e01e076e21:
>
>   xilinx: Delete hw/include/xilinx.h (2014-02-26 14:54:45 +1000)
>
> are available in the git repository at:
>
>   https://github.com/kvaneesh/qemu.git for-upstream
>
> for you to fetch changes up to 993c91a0e996346c7ee8fa2ca310cc76edb59e17:
>
>   hw/9pfs: Include virtio-9p-device.o in build (2014-03-04 09:20:49 +0530)

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation
  2014-03-07 15:16 ` [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation Aneesh Kumar K.V
@ 2014-03-08 13:58   ` Chen Gang
  2014-03-16 13:32     ` Chen Gang
  0 siblings, 1 reply; 56+ messages in thread
From: Chen Gang @ 2014-03-08 13:58 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: peter.maydell, qemu-devel, anthony

OK, thanks.

Next, I will/should continue to analyse the performance issue for 9pfs
when users drop into a long directory path under bash shell.

Although I am not quite sure, hope I can find the root cause within this
month (2014-03-31).

Welcome any suggestions, discussions, and completions for it.

Thanks.

On 03/07/2014 11:16 PM, Aneesh Kumar K.V wrote:
> From: Chen Gang <gang.chen.5i5j@gmail.com>
> 
> When path is truncated by PATH_MAX limitation, it causes QEMU to access
> incorrect file. So use original full path instead of PATH_MAX within
> 9pfs (need check/process ENOMEM for related memory allocation).
> 
> The related test:
> 
>  - Environments (for qemu-devel):
> 
>    - Host is under fedora17 desktop with ext4fs:
> 
>      qemu-system-x86_64 -hda test.img -m 1024 \
>        -net nic,vlan=4,model=virtio,macaddr=00:16:35:AF:94:04 \
>        -net tap,vlan=4,ifname=tap4,script=no,downscript=no \
>        -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare \
>        -fsdev local,security_model=passthrough,id=fsdev0,\
>          path=/upstream/vm/data/share/1234567890abcdefghijklmnopqrstuvwxyz\
>            ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890acdefghijklmnopqrstuvwxyz\
>            ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/111111111111111111111111111\
>            1111111111111111111111111111111111111111111111111111222222222222\
>            2222222222222222222222222222222222222222222222222222222222222222\
>            2222222222222222222222222222222222233333333333333333333333333333\
>            3333333333333333333333333333333333
> 
>     - Guest is ubuntu12 server with 9pfs.
> 
>       mount -t 9p -o trans=virtio,version=9p2000.L hostshare /share
> 
>     - Limitations:
> 
>       full path limitation is PATH_MAX (4096B include nul) under Linux.
>       file/dir node name maximized length is 256 (include nul) under ext4.
> 
>  - Special test:
> 
>     Under host, modify the file: "/upstream/vm/data/share/1234567890abcdefg\
>       hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890acdefghijklmno\
>       pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/111111111111111111111\
>       111111111111111111111111111111111111111111111111111111111122222222222\
>       222222222222222222222222222222222222222222222222222222222222222222222\
>       222222222222222222222222222222233333333333333333333333333333333333333\
>       3333333333333333333333333/4444444444444444444444444444444444444444444\
>       444444444444444444444444444444444444444444444444444444444444444444444\
>       444444444444444444444444444444444444444444444444444444444444444444444\
>       444444444444444444444444444444444444444/55555555555555555555555555555\
>       555555555555555555555555555555555555555555555555555555555555555555555\
>       555555555555555555555555555555555555555555555555555555555555555555555\
>       555555555555555555555555555555555555555555555555555555555555555555555\
>       55555555/666666666666666666666666666666666666666666666666666666666666\
>       666666666666666666666666666666666666666666666666666666666666666666666\
>       666666666666666666666666666666666666666666666666666666666666666666666\
>       666666666666666666666/77777777777777777777777777777777777777777777777\
>       777777777777777777777777777777777777777777777777777777777777777777777\
>       777777777777777777777777777777777777777777777777777777777777777777777\
>       77777777777777777777777777777777777777777777777777777777777/888888888\
>       888888888888888888888888888888888888888888888888888888888888888888888\
>       888888888888888888888888888888888888888888888888888888888888888888888\
>       888888888888888888888888888888888888888888888888888888888888888888888\
>       888888888/99999999999999999999999999999999999999999999999999999999999\
>       999999999999999999999999999999999999999999999999999999999999999999999\
>       999999999999999999999999999999999999999999999999999999999999999999999\
>       99999999999999999999999999999999999999999/000000000000000000000000000\
>       000000000000000000000000000000000000000000000000000000000000000000000\
>       000000000000000000000000000000000000000000000000000000000000000000000\
>       000000000000000000000000000000000000000000000000/aaaaaaaaaaaaaaaaaaaa\
>       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
>       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\
>       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbb\
>       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
>       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\
>       bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ccccccccc\
>       ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\
>       ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\
>       ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\
>       cccccccccc/dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\
>       ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\
>       ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\
>       dddddddddddddddddddddd/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
>       eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
>       eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\
>       eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/fffffffffffffff\
>       fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\
>       fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\
>       ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gggggggggg\
>       ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\
>       ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\
>       ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\
>       ggggggggggggggggggggggg/iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\
>       iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\
>       iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\
>       iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/jjjjjjjjjjjjj\
>       jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj\
>       jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj/ppppppppppppppppppppp\
>       ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\
>       ppppppppppppppppppppppppppppppppppppppp/test1234567890file.log"
>         (need enter dir firstly, then modify file, or can not open it).
> 
>    Under guest, still allow modify "test1234567890file.log" (will generate
>    "test123456" file with contents).
> 
>    After apply this patch, can not open "test1234567890file.log" under guest
>    (permission denied).
> 
>  - Common test:
> 
>    All are still OK after apply this path.
> 
>      "mkdir -p", "create/open file/dir", "modify file/dir", "rm file/dir".
>      change various mount point paths under host and/or guest.
> 
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  hw/9pfs/cofs.c                 |  48 +++++--
>  hw/9pfs/virtio-9p-handle.c     |   9 +-
>  hw/9pfs/virtio-9p-local.c      | 287 +++++++++++++++++++++++++++--------------
>  hw/9pfs/virtio-9p-posix-acl.c  |  52 ++++++--
>  hw/9pfs/virtio-9p-xattr-user.c |  27 +++-
>  hw/9pfs/virtio-9p-xattr.c      |   9 +-
>  hw/9pfs/virtio-9p-xattr.h      |  27 +++-
>  hw/9pfs/virtio-9p.h            |   6 +-
>  8 files changed, 316 insertions(+), 149 deletions(-)
> 
> diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c
> index 389105074852..0aba70ad792f 100644
> --- a/hw/9pfs/cofs.c
> +++ b/hw/9pfs/cofs.c
> @@ -17,35 +17,55 @@
>  #include "block/coroutine.h"
>  #include "virtio-9p-coth.h"
>  
> +static ssize_t __readlink(V9fsState *s, V9fsPath *path, V9fsString *buf)
> +{
> +    ssize_t len, maxlen = PATH_MAX;
> +
> +    buf->data = g_malloc(PATH_MAX);
> +    for (;;) {
> +        len = s->ops->readlink(&s->ctx, path, buf->data, maxlen);
> +        if (len < 0) {
> +            g_free(buf->data);
> +            buf->data = NULL;
> +            buf->size = 0;
> +            break;
> +        } else if (len == maxlen) {
> +            /*
> +             * We dodn't have space to put the NULL or we have more
> +             * to read. Increase the size and try again
> +             */
> +            maxlen *= 2;
> +            g_free(buf->data);
> +            buf->data = g_malloc(maxlen);
> +            continue;
> +        }
> +        /*
> +         * Null terminate the readlink output
> +         */
> +        buf->data[len] = '\0';
> +        buf->size = len;
> +        break;
> +    }
> +    return len;
> +}
> +
>  int v9fs_co_readlink(V9fsPDU *pdu, V9fsPath *path, V9fsString *buf)
>  {
>      int err;
> -    ssize_t len;
>      V9fsState *s = pdu->s;
>  
>      if (v9fs_request_cancelled(pdu)) {
>          return -EINTR;
>      }
> -    buf->data = g_malloc(PATH_MAX);
>      v9fs_path_read_lock(s);
>      v9fs_co_run_in_worker(
>          {
> -            len = s->ops->readlink(&s->ctx, path,
> -                                   buf->data, PATH_MAX - 1);
> -            if (len > -1) {
> -                buf->size = len;
> -                buf->data[len] = 0;
> -                err = 0;
> -            } else {
> +            err = __readlink(s, path, buf);
> +            if (err < 0) {
>                  err = -errno;
>              }
>          });
>      v9fs_path_unlock(s);
> -    if (err) {
> -        g_free(buf->data);
> -        buf->data = NULL;
> -        buf->size = 0;
> -    }
>      return err;
>  }
>  
> diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c
> index 17002a3d2867..4b79cefd135e 100644
> --- a/hw/9pfs/virtio-9p-handle.c
> +++ b/hw/9pfs/virtio-9p-handle.c
> @@ -498,7 +498,7 @@ static int handle_lremovexattr(FsContext *ctx, V9fsPath *fs_path,
>  static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
>                                const char *name, V9fsPath *target)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
>      struct file_handle *fh;
>      int dirfd, ret, mnt_id;
>      struct handle_data *data = (struct handle_data *)ctx->private;
> @@ -513,7 +513,9 @@ static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
>          dirfd = open_by_handle(data->mountfd, dir_path->data, O_PATH);
>      } else {
>          /* relative to export root */
> -        dirfd = open(rpath(ctx, ".", buffer), O_DIRECTORY);
> +        buffer = rpath(ctx, ".");
> +        dirfd = open(buffer, O_DIRECTORY);
> +        g_free(buffer);
>      }
>      if (dirfd < 0) {
>          return dirfd;
> @@ -521,7 +523,7 @@ static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
>      fh = g_malloc(sizeof(struct file_handle) + data->handle_bytes);
>      fh->handle_bytes = data->handle_bytes;
>      /* add a "./" at the beginning of the path */
> -    snprintf(buffer, PATH_MAX, "./%s", name);
> +    buffer = g_strdup_printf("./%s", name);
>      /* flag = 0 imply don't follow symlink */
>      ret = name_to_handle(dirfd, buffer, fh, &mnt_id, 0);
>      if (!ret) {
> @@ -531,6 +533,7 @@ static int handle_name_to_path(FsContext *ctx, V9fsPath *dir_path,
>          g_free(fh);
>      }
>      close(dirfd);
> +    g_free(buffer);
>      return ret;
>  }
>  
> diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c
> index dc615a4d0fa4..56b302c122b6 100644
> --- a/hw/9pfs/virtio-9p-local.c
> +++ b/hw/9pfs/virtio-9p-local.c
> @@ -42,18 +42,18 @@
>  
>  #define VIRTFS_META_DIR ".virtfs_metadata"
>  
> -static const char *local_mapped_attr_path(FsContext *ctx,
> -                                          const char *path, char *buffer)
> +static char *local_mapped_attr_path(FsContext *ctx, const char *path)
>  {
>      char *dir_name;
>      char *tmp_path = g_strdup(path);
>      char *base_name = basename(tmp_path);
> +    char *buffer;
>  
>      /* NULL terminate the directory */
>      dir_name = tmp_path;
>      *(base_name - 1) = '\0';
>  
> -    snprintf(buffer, PATH_MAX, "%s/%s/%s/%s",
> +    buffer = g_strdup_printf("%s/%s/%s/%s",
>               ctx->fs_root, dir_name, VIRTFS_META_DIR, base_name);
>      g_free(tmp_path);
>      return buffer;
> @@ -92,10 +92,11 @@ static void local_mapped_file_attr(FsContext *ctx, const char *path,
>  {
>      FILE *fp;
>      char buf[ATTR_MAX];
> -    char attr_path[PATH_MAX];
> +    char *attr_path;
>  
> -    local_mapped_attr_path(ctx, path, attr_path);
> +    attr_path = local_mapped_attr_path(ctx, path);
>      fp = local_fopen(attr_path, "r");
> +    g_free(attr_path);
>      if (!fp) {
>          return;
>      }
> @@ -118,12 +119,13 @@ static void local_mapped_file_attr(FsContext *ctx, const char *path,
>  static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf)
>  {
>      int err;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>      char *path = fs_path->data;
>  
> -    err =  lstat(rpath(fs_ctx, path, buffer), stbuf);
> +    buffer = rpath(fs_ctx, path);
> +    err =  lstat(buffer, stbuf);
>      if (err) {
> -        return err;
> +        goto err_out;
>      }
>      if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
>          /* Actual credentials are part of extended attrs */
> @@ -131,41 +133,42 @@ static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf)
>          gid_t tmp_gid;
>          mode_t tmp_mode;
>          dev_t tmp_dev;
> -        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.uid", &tmp_uid,
> -                    sizeof(uid_t)) > 0) {
> +        if (getxattr(buffer, "user.virtfs.uid", &tmp_uid, sizeof(uid_t)) > 0) {
>              stbuf->st_uid = tmp_uid;
>          }
> -        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.gid", &tmp_gid,
> -                    sizeof(gid_t)) > 0) {
> +        if (getxattr(buffer, "user.virtfs.gid", &tmp_gid, sizeof(gid_t)) > 0) {
>              stbuf->st_gid = tmp_gid;
>          }
> -        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.mode",
> +        if (getxattr(buffer, "user.virtfs.mode",
>                      &tmp_mode, sizeof(mode_t)) > 0) {
>              stbuf->st_mode = tmp_mode;
>          }
> -        if (getxattr(rpath(fs_ctx, path, buffer), "user.virtfs.rdev", &tmp_dev,
> -                        sizeof(dev_t)) > 0) {
> +        if (getxattr(buffer, "user.virtfs.rdev", &tmp_dev, sizeof(dev_t)) > 0) {
>                  stbuf->st_rdev = tmp_dev;
>          }
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
>          local_mapped_file_attr(fs_ctx, path, stbuf);
>      }
> +
> +err_out:
> +    g_free(buffer);
>      return err;
>  }
>  
>  static int local_create_mapped_attr_dir(FsContext *ctx, const char *path)
>  {
>      int err;
> -    char attr_dir[PATH_MAX];
> +    char *attr_dir;
>      char *tmp_path = g_strdup(path);
>  
> -    snprintf(attr_dir, PATH_MAX, "%s/%s/%s",
> +    attr_dir = g_strdup_printf("%s/%s/%s",
>               ctx->fs_root, dirname(tmp_path), VIRTFS_META_DIR);
>  
>      err = mkdir(attr_dir, 0700);
>      if (err < 0 && errno == EEXIST) {
>          err = 0;
>      }
> +    g_free(attr_dir);
>      g_free(tmp_path);
>      return err;
>  }
> @@ -176,10 +179,11 @@ static int local_set_mapped_file_attr(FsContext *ctx,
>      FILE *fp;
>      int ret = 0;
>      char buf[ATTR_MAX];
> -    char attr_path[PATH_MAX];
> +    char *attr_path;
>      int uid = -1, gid = -1, mode = -1, rdev = -1;
>  
> -    fp = local_fopen(local_mapped_attr_path(ctx, path, attr_path), "r");
> +    attr_path = local_mapped_attr_path(ctx, path);
> +    fp = local_fopen(attr_path, "r");
>      if (!fp) {
>          goto create_map_file;
>      }
> @@ -241,6 +245,7 @@ update_map_file:
>      fclose(fp);
>  
>  err_out:
> +    g_free(attr_path);
>      return ret;
>  }
>  
> @@ -282,36 +287,43 @@ static int local_set_xattr(const char *path, FsCred *credp)
>  static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,
>                                           FsCred *credp)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
>  
> -    if (lchown(rpath(fs_ctx, path, buffer), credp->fc_uid,
> -                credp->fc_gid) < 0) {
> +    buffer = rpath(fs_ctx, path);
> +    if (lchown(buffer, credp->fc_uid, credp->fc_gid) < 0) {
>          /*
>           * If we fail to change ownership and if we are
>           * using security model none. Ignore the error
>           */
>          if ((fs_ctx->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) {
> -            return -1;
> +            goto err;
>          }
>      }
>  
> -    if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) {
> -        return -1;
> +    if (chmod(buffer, credp->fc_mode & 07777) < 0) {
> +        goto err;
>      }
> +
> +    g_free(buffer);
>      return 0;
> +err:
> +    g_free(buffer);
> +    return -1;
>  }
>  
>  static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
>                                char *buf, size_t bufsz)
>  {
>      ssize_t tsize = -1;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>      char *path = fs_path->data;
>  
>      if ((fs_ctx->export_flags & V9FS_SM_MAPPED) ||
>          (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) {
>          int fd;
> -        fd = open(rpath(fs_ctx, path, buffer), O_RDONLY | O_NOFOLLOW);
> +        buffer = rpath(fs_ctx, path);
> +        fd = open(buffer, O_RDONLY | O_NOFOLLOW);
> +        g_free(buffer);
>          if (fd == -1) {
>              return -1;
>          }
> @@ -322,7 +334,9 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
>          return tsize;
>      } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
>                 (fs_ctx->export_flags & V9FS_SM_NONE)) {
> -        tsize = readlink(rpath(fs_ctx, path, buffer), buf, bufsz);
> +        buffer = rpath(fs_ctx, path);
> +        tsize = readlink(buffer, buf, bufsz);
> +        g_free(buffer);
>      }
>      return tsize;
>  }
> @@ -340,20 +354,24 @@ static int local_closedir(FsContext *ctx, V9fsFidOpenState *fs)
>  static int local_open(FsContext *ctx, V9fsPath *fs_path,
>                        int flags, V9fsFidOpenState *fs)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
>      char *path = fs_path->data;
>  
> -    fs->fd = open(rpath(ctx, path, buffer), flags | O_NOFOLLOW);
> +    buffer = rpath(ctx, path);
> +    fs->fd = open(buffer, flags | O_NOFOLLOW);
> +    g_free(buffer);
>      return fs->fd;
>  }
>  
>  static int local_opendir(FsContext *ctx,
>                           V9fsPath *fs_path, V9fsFidOpenState *fs)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
>      char *path = fs_path->data;
>  
> -    fs->dir = opendir(rpath(ctx, path, buffer));
> +    buffer = rpath(ctx, path);
> +    fs->dir = opendir(buffer);
> +    g_free(buffer);
>      if (!fs->dir) {
>          return -1;
>      }
> @@ -441,18 +459,23 @@ static ssize_t local_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
>  
>  static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    int ret = -1;
>      char *path = fs_path->data;
>  
>      if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
> -        return local_set_xattr(rpath(fs_ctx, path, buffer), credp);
> +        buffer = rpath(fs_ctx, path);
> +        ret = local_set_xattr(buffer, credp);
> +        g_free(buffer);
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
>          return local_set_mapped_file_attr(fs_ctx, path, credp);
>      } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
>                 (fs_ctx->export_flags & V9FS_SM_NONE)) {
> -        return chmod(rpath(fs_ctx, path, buffer), credp->fc_mode);
> +        buffer = rpath(fs_ctx, path);
> +        ret = chmod(buffer, credp->fc_mode);
> +        g_free(buffer);
>      }
> -    return -1;
> +    return ret;
>  }
>  
>  static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
> @@ -462,7 +485,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
>      int err = -1;
>      int serrno = 0;
>      V9fsString fullname;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>  
>      v9fs_string_init(&fullname);
>      v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
> @@ -470,21 +493,23 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
>  
>      /* Determine the security model */
>      if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
> -        err = mknod(rpath(fs_ctx, path, buffer),
> -                SM_LOCAL_MODE_BITS|S_IFREG, 0);
> +        buffer = rpath(fs_ctx, path);
> +        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);
>          if (err == -1) {
> +            g_free(buffer);
>              goto out;
>          }
> -        err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
> +        err = local_set_xattr(buffer, credp);
>          if (err == -1) {
>              serrno = errno;
>              goto err_end;
>          }
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
>  
> -        err = mknod(rpath(fs_ctx, path, buffer),
> -                    SM_LOCAL_MODE_BITS|S_IFREG, 0);
> +        buffer = rpath(fs_ctx, path);
> +        err = mknod(buffer, SM_LOCAL_MODE_BITS|S_IFREG, 0);
>          if (err == -1) {
> +            g_free(buffer);
>              goto out;
>          }
>          err = local_set_mapped_file_attr(fs_ctx, path, credp);
> @@ -494,9 +519,10 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
>          }
>      } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
>                 (fs_ctx->export_flags & V9FS_SM_NONE)) {
> -        err = mknod(rpath(fs_ctx, path, buffer), credp->fc_mode,
> -                credp->fc_rdev);
> +        buffer = rpath(fs_ctx, path);
> +        err = mknod(buffer, credp->fc_mode, credp->fc_rdev);
>          if (err == -1) {
> +            g_free(buffer);
>              goto out;
>          }
>          err = local_post_create_passthrough(fs_ctx, path, credp);
> @@ -508,8 +534,9 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
>      goto out;
>  
>  err_end:
> -    remove(rpath(fs_ctx, path, buffer));
> +    remove(buffer);
>      errno = serrno;
> +    g_free(buffer);
>  out:
>      v9fs_string_free(&fullname);
>      return err;
> @@ -522,7 +549,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
>      int err = -1;
>      int serrno = 0;
>      V9fsString fullname;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>  
>      v9fs_string_init(&fullname);
>      v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
> @@ -530,19 +557,23 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
>  
>      /* Determine the security model */
>      if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
> -        err = mkdir(rpath(fs_ctx, path, buffer), SM_LOCAL_DIR_MODE_BITS);
> +        buffer = rpath(fs_ctx, path);
> +        err = mkdir(buffer, SM_LOCAL_DIR_MODE_BITS);
>          if (err == -1) {
> +            g_free(buffer);
>              goto out;
>          }
>          credp->fc_mode = credp->fc_mode|S_IFDIR;
> -        err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
> +        err = local_set_xattr(buffer, credp);
>          if (err == -1) {
>              serrno = errno;
>              goto err_end;
>          }
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
> -        err = mkdir(rpath(fs_ctx, path, buffer), SM_LOCAL_DIR_MODE_BITS);
> +        buffer = rpath(fs_ctx, path);
> +        err = mkdir(buffer, SM_LOCAL_DIR_MODE_BITS);
>          if (err == -1) {
> +            g_free(buffer);
>              goto out;
>          }
>          credp->fc_mode = credp->fc_mode|S_IFDIR;
> @@ -553,8 +584,10 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
>          }
>      } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
>                 (fs_ctx->export_flags & V9FS_SM_NONE)) {
> -        err = mkdir(rpath(fs_ctx, path, buffer), credp->fc_mode);
> +        buffer = rpath(fs_ctx, path);
> +        err = mkdir(buffer, credp->fc_mode);
>          if (err == -1) {
> +            g_free(buffer);
>              goto out;
>          }
>          err = local_post_create_passthrough(fs_ctx, path, credp);
> @@ -566,8 +599,9 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path,
>      goto out;
>  
>  err_end:
> -    remove(rpath(fs_ctx, path, buffer));
> +    remove(buffer);
>      errno = serrno;
> +    g_free(buffer);
>  out:
>      v9fs_string_free(&fullname);
>      return err;
> @@ -626,7 +660,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
>      int err = -1;
>      int serrno = 0;
>      V9fsString fullname;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>  
>      /*
>       * Mark all the open to not follow symlinks
> @@ -639,21 +673,25 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
>  
>      /* Determine the security model */
>      if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
> -        fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS);
> +        buffer = rpath(fs_ctx, path);
> +        fd = open(buffer, flags, SM_LOCAL_MODE_BITS);
>          if (fd == -1) {
> +            g_free(buffer);
>              err = fd;
>              goto out;
>          }
>          credp->fc_mode = credp->fc_mode|S_IFREG;
>          /* Set cleint credentials in xattr */
> -        err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
> +        err = local_set_xattr(buffer, credp);
>          if (err == -1) {
>              serrno = errno;
>              goto err_end;
>          }
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
> -        fd = open(rpath(fs_ctx, path, buffer), flags, SM_LOCAL_MODE_BITS);
> +        buffer = rpath(fs_ctx, path);
> +        fd = open(buffer, flags, SM_LOCAL_MODE_BITS);
>          if (fd == -1) {
> +            g_free(buffer);
>              err = fd;
>              goto out;
>          }
> @@ -666,8 +704,10 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
>          }
>      } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
>                 (fs_ctx->export_flags & V9FS_SM_NONE)) {
> -        fd = open(rpath(fs_ctx, path, buffer), flags, credp->fc_mode);
> +        buffer = rpath(fs_ctx, path);
> +        fd = open(buffer, flags, credp->fc_mode);
>          if (fd == -1) {
> +            g_free(buffer);
>              err = fd;
>              goto out;
>          }
> @@ -683,8 +723,9 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name,
>  
>  err_end:
>      close(fd);
> -    remove(rpath(fs_ctx, path, buffer));
> +    remove(buffer);
>      errno = serrno;
> +    g_free(buffer);
>  out:
>      v9fs_string_free(&fullname);
>      return err;
> @@ -698,7 +739,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
>      int serrno = 0;
>      char *newpath;
>      V9fsString fullname;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>  
>      v9fs_string_init(&fullname);
>      v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
> @@ -708,10 +749,10 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
>      if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
>          int fd;
>          ssize_t oldpath_size, write_size;
> -        fd = open(rpath(fs_ctx, newpath, buffer),
> -                  O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW,
> -                  SM_LOCAL_MODE_BITS);
> +        buffer = rpath(fs_ctx, newpath);
> +        fd = open(buffer, O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW, SM_LOCAL_MODE_BITS);
>          if (fd == -1) {
> +            g_free(buffer);
>              err = fd;
>              goto out;
>          }
> @@ -730,7 +771,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
>          close(fd);
>          /* Set cleint credentials in symlink's xattr */
>          credp->fc_mode = credp->fc_mode|S_IFLNK;
> -        err = local_set_xattr(rpath(fs_ctx, newpath, buffer), credp);
> +        err = local_set_xattr(buffer, credp);
>          if (err == -1) {
>              serrno = errno;
>              goto err_end;
> @@ -738,10 +779,10 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
>          int fd;
>          ssize_t oldpath_size, write_size;
> -        fd = open(rpath(fs_ctx, newpath, buffer),
> -                  O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW,
> -                  SM_LOCAL_MODE_BITS);
> +        buffer = rpath(fs_ctx, newpath);
> +        fd = open(buffer, O_CREAT|O_EXCL|O_RDWR|O_NOFOLLOW, SM_LOCAL_MODE_BITS);
>          if (fd == -1) {
> +            g_free(buffer);
>              err = fd;
>              goto out;
>          }
> @@ -767,12 +808,13 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
>          }
>      } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
>                 (fs_ctx->export_flags & V9FS_SM_NONE)) {
> -        err = symlink(oldpath, rpath(fs_ctx, newpath, buffer));
> +        buffer = rpath(fs_ctx, newpath);
> +        err = symlink(oldpath, buffer);
>          if (err) {
> +            g_free(buffer);
>              goto out;
>          }
> -        err = lchown(rpath(fs_ctx, newpath, buffer), credp->fc_uid,
> -                     credp->fc_gid);
> +        err = lchown(buffer, credp->fc_uid, credp->fc_gid);
>          if (err == -1) {
>              /*
>               * If we fail to change ownership and if we are
> @@ -788,8 +830,9 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath,
>      goto out;
>  
>  err_end:
> -    remove(rpath(fs_ctx, newpath, buffer));
> +    remove(buffer);
>      errno = serrno;
> +    g_free(buffer);
>  out:
>      v9fs_string_free(&fullname);
>      return err;
> @@ -800,13 +843,16 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
>  {
>      int ret;
>      V9fsString newpath;
> -    char buffer[PATH_MAX], buffer1[PATH_MAX];
> +    char *buffer, *buffer1;
>  
>      v9fs_string_init(&newpath);
>      v9fs_string_sprintf(&newpath, "%s/%s", dirpath->data, name);
>  
> -    ret = link(rpath(ctx, oldpath->data, buffer),
> -               rpath(ctx, newpath.data, buffer1));
> +    buffer = rpath(ctx, oldpath->data);
> +    buffer1 = rpath(ctx, newpath.data);
> +    ret = link(buffer, buffer1);
> +    g_free(buffer);
> +    g_free(buffer1);
>  
>      /* now link the virtfs_metadata files */
>      if (!ret && (ctx->export_flags & V9FS_SM_MAPPED_FILE)) {
> @@ -815,8 +861,11 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath,
>          if (ret < 0) {
>              goto err_out;
>          }
> -        ret = link(local_mapped_attr_path(ctx, oldpath->data, buffer),
> -                   local_mapped_attr_path(ctx, newpath.data, buffer1));
> +        buffer = local_mapped_attr_path(ctx, oldpath->data);
> +        buffer1 = local_mapped_attr_path(ctx, newpath.data);
> +        ret = link(buffer, buffer1);
> +        g_free(buffer);
> +        g_free(buffer1);
>          if (ret < 0 && errno != ENOENT) {
>              goto err_out;
>          }
> @@ -828,17 +877,21 @@ err_out:
>  
>  static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    int ret;
>      char *path = fs_path->data;
>  
> -    return truncate(rpath(ctx, path, buffer), size);
> +    buffer = rpath(ctx, path);
> +    ret = truncate(buffer, size);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static int local_rename(FsContext *ctx, const char *oldpath,
>                          const char *newpath)
>  {
>      int err;
> -    char buffer[PATH_MAX], buffer1[PATH_MAX];
> +    char *buffer, *buffer1;
>  
>      if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
>          err = local_create_mapped_attr_dir(ctx, newpath);
> @@ -846,50 +899,69 @@ static int local_rename(FsContext *ctx, const char *oldpath,
>              return err;
>          }
>          /* rename the .virtfs_metadata files */
> -        err = rename(local_mapped_attr_path(ctx, oldpath, buffer),
> -                     local_mapped_attr_path(ctx, newpath, buffer1));
> +        buffer = local_mapped_attr_path(ctx, oldpath);
> +        buffer1 = local_mapped_attr_path(ctx, newpath);
> +        err = rename(buffer, buffer1);
> +        g_free(buffer);
> +        g_free(buffer1);
>          if (err < 0 && errno != ENOENT) {
>              return err;
>          }
>      }
> -    return rename(rpath(ctx, oldpath, buffer), rpath(ctx, newpath, buffer1));
> +
> +    buffer = rpath(ctx, oldpath);
> +    buffer1 = rpath(ctx, newpath);
> +    err = rename(buffer, buffer1);
> +    g_free(buffer);
> +    g_free(buffer1);
> +    return err;
>  }
>  
>  static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    int ret = -1;
>      char *path = fs_path->data;
>  
>      if ((credp->fc_uid == -1 && credp->fc_gid == -1) ||
>          (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
>          (fs_ctx->export_flags & V9FS_SM_NONE)) {
> -        return lchown(rpath(fs_ctx, path, buffer),
> -                      credp->fc_uid, credp->fc_gid);
> +        buffer = rpath(fs_ctx, path);
> +        ret = lchown(buffer, credp->fc_uid, credp->fc_gid);
> +        g_free(buffer);
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
> -        return local_set_xattr(rpath(fs_ctx, path, buffer), credp);
> +        buffer = rpath(fs_ctx, path);
> +        ret = local_set_xattr(buffer, credp);
> +        g_free(buffer);
>      } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
>          return local_set_mapped_file_attr(fs_ctx, path, credp);
>      }
> -    return -1;
> +    return ret;
>  }
>  
>  static int local_utimensat(FsContext *s, V9fsPath *fs_path,
>                             const struct timespec *buf)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    int ret;
>      char *path = fs_path->data;
>  
> -    return qemu_utimens(rpath(s, path, buffer), buf);
> +    buffer = rpath(s, path);
> +    ret = qemu_utimens(buffer, buf);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static int local_remove(FsContext *ctx, const char *path)
>  {
>      int err;
>      struct stat stbuf;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>  
>      if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
> -        err =  lstat(rpath(ctx, path, buffer), &stbuf);
> +        buffer = rpath(ctx, path);
> +        err =  lstat(buffer, &stbuf);
> +        g_free(buffer);
>          if (err) {
>              goto err_out;
>          }
> @@ -898,9 +970,10 @@ static int local_remove(FsContext *ctx, const char *path)
>           * directory
>           */
>          if (S_ISDIR(stbuf.st_mode)) {
> -            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s",
> -                     ctx->fs_root, path, VIRTFS_META_DIR);
> +            buffer = g_strdup_printf("%s/%s/%s", ctx->fs_root,
> +                                     path, VIRTFS_META_DIR);
>              err = remove(buffer);
> +            g_free(buffer);
>              if (err < 0 && errno != ENOENT) {
>                  /*
>                   * We didn't had the .virtfs_metadata file. May be file created
> @@ -913,7 +986,9 @@ static int local_remove(FsContext *ctx, const char *path)
>           * Now remove the name from parent directory
>           * .virtfs_metadata directory
>           */
> -        err = remove(local_mapped_attr_path(ctx, path, buffer));
> +        buffer = local_mapped_attr_path(ctx, path);
> +        err = remove(buffer);
> +        g_free(buffer);
>          if (err < 0 && errno != ENOENT) {
>              /*
>               * We didn't had the .virtfs_metadata file. May be file created
> @@ -922,7 +997,10 @@ static int local_remove(FsContext *ctx, const char *path)
>              goto err_out;
>          }
>      }
> -    return remove(rpath(ctx, path, buffer));
> +
> +    buffer = rpath(ctx, path);
> +    err = remove(buffer);
> +    g_free(buffer);
>  err_out:
>      return err;
>  }
> @@ -947,10 +1025,14 @@ static int local_fsync(FsContext *ctx, int fid_type,
>  
>  static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    int ret;
>      char *path = fs_path->data;
>  
> -    return statfs(rpath(s, path, buffer), stbuf);
> +    buffer = rpath(s, path);
> +    ret = statfs(buffer, stbuf);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static ssize_t local_lgetxattr(FsContext *ctx, V9fsPath *fs_path,
> @@ -1023,7 +1105,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
>  {
>      int ret;
>      V9fsString fullname;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>  
>      v9fs_string_init(&fullname);
>  
> @@ -1034,9 +1116,10 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
>               * If directory remove .virtfs_metadata contained in the
>               * directory
>               */
> -            snprintf(buffer, ARRAY_SIZE(buffer), "%s/%s/%s", ctx->fs_root,
> -                     fullname.data, VIRTFS_META_DIR);
> +            buffer = g_strdup_printf("%s/%s/%s", ctx->fs_root,
> +                                     fullname.data, VIRTFS_META_DIR);
>              ret = remove(buffer);
> +            g_free(buffer);
>              if (ret < 0 && errno != ENOENT) {
>                  /*
>                   * We didn't had the .virtfs_metadata file. May be file created
> @@ -1049,7 +1132,9 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
>           * Now remove the name from parent directory
>           * .virtfs_metadata directory.
>           */
> -        ret = remove(local_mapped_attr_path(ctx, fullname.data, buffer));
> +        buffer = local_mapped_attr_path(ctx, fullname.data);
> +        ret = remove(buffer);
> +        g_free(buffer);
>          if (ret < 0 && errno != ENOENT) {
>              /*
>               * We didn't had the .virtfs_metadata file. May be file created
> @@ -1059,7 +1144,9 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir,
>          }
>      }
>      /* Remove the name finally */
> -    ret = remove(rpath(ctx, fullname.data, buffer));
> +    buffer = rpath(ctx, fullname.data);
> +    ret = remove(buffer);
> +    g_free(buffer);
>  
>  err_out:
>      v9fs_string_free(&fullname);
> diff --git a/hw/9pfs/virtio-9p-posix-acl.c b/hw/9pfs/virtio-9p-posix-acl.c
> index 339c5ecae441..803d9d94f3b8 100644
> --- a/hw/9pfs/virtio-9p-posix-acl.c
> +++ b/hw/9pfs/virtio-9p-posix-acl.c
> @@ -26,8 +26,13 @@
>  static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path,
>                                  const char *name, void *value, size_t size)
>  {
> -    char buffer[PATH_MAX];
> -    return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value, size);
> +    char *buffer;
> +    ssize_t ret;
> +
> +    buffer = rpath(ctx, path);
> +    ret = lgetxattr(buffer, MAP_ACL_ACCESS, value, size);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path,
> @@ -52,17 +57,23 @@ static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path,
>  static int mp_pacl_setxattr(FsContext *ctx, const char *path, const char *name,
>                              void *value, size_t size, int flags)
>  {
> -    char buffer[PATH_MAX];
> -    return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value,
> -            size, flags);
> +    char *buffer;
> +    int ret;
> +
> +    buffer = rpath(ctx, path);
> +    ret = lsetxattr(buffer, MAP_ACL_ACCESS, value, size, flags);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static int mp_pacl_removexattr(FsContext *ctx,
>                                 const char *path, const char *name)
>  {
>      int ret;
> -    char buffer[PATH_MAX];
> -    ret  = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS);
> +    char *buffer;
> +
> +    buffer = rpath(ctx, path);
> +    ret  = lremovexattr(buffer, MAP_ACL_ACCESS);
>      if (ret == -1 && errno == ENODATA) {
>          /*
>           * We don't get ENODATA error when trying to remove a
> @@ -72,14 +83,20 @@ static int mp_pacl_removexattr(FsContext *ctx,
>          errno = 0;
>          ret = 0;
>      }
> +    g_free(buffer);
>      return ret;
>  }
>  
>  static ssize_t mp_dacl_getxattr(FsContext *ctx, const char *path,
>                                  const char *name, void *value, size_t size)
>  {
> -    char buffer[PATH_MAX];
> -    return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT, value, size);
> +    char *buffer;
> +    ssize_t ret;
> +
> +    buffer = rpath(ctx, path);
> +    ret = lgetxattr(buffer, MAP_ACL_DEFAULT, value, size);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path,
> @@ -104,17 +121,23 @@ static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path,
>  static int mp_dacl_setxattr(FsContext *ctx, const char *path, const char *name,
>                              void *value, size_t size, int flags)
>  {
> -    char buffer[PATH_MAX];
> -    return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT, value,
> -            size, flags);
> +    char *buffer;
> +    int ret;
> +
> +    buffer = rpath(ctx, path);
> +    ret = lsetxattr(buffer, MAP_ACL_DEFAULT, value, size, flags);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static int mp_dacl_removexattr(FsContext *ctx,
>                                 const char *path, const char *name)
>  {
>      int ret;
> -    char buffer[PATH_MAX];
> -    ret  = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT);
> +    char *buffer;
> +
> +    buffer = rpath(ctx, path);
> +    ret  = lremovexattr(buffer, MAP_ACL_DEFAULT);
>      if (ret == -1 && errno == ENODATA) {
>          /*
>           * We don't get ENODATA error when trying to remove a
> @@ -124,6 +147,7 @@ static int mp_dacl_removexattr(FsContext *ctx,
>          errno = 0;
>          ret = 0;
>      }
> +    g_free(buffer);
>      return ret;
>  }
>  
> diff --git a/hw/9pfs/virtio-9p-xattr-user.c b/hw/9pfs/virtio-9p-xattr-user.c
> index e0c92ebf9e5d..46133e06dbdf 100644
> --- a/hw/9pfs/virtio-9p-xattr-user.c
> +++ b/hw/9pfs/virtio-9p-xattr-user.c
> @@ -21,7 +21,9 @@
>  static ssize_t mp_user_getxattr(FsContext *ctx, const char *path,
>                                  const char *name, void *value, size_t size)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    ssize_t ret;
> +
>      if (strncmp(name, "user.virtfs.", 12) == 0) {
>          /*
>           * Don't allow fetch of user.virtfs namesapce
> @@ -30,7 +32,10 @@ static ssize_t mp_user_getxattr(FsContext *ctx, const char *path,
>          errno = ENOATTR;
>          return -1;
>      }
> -    return lgetxattr(rpath(ctx, path, buffer), name, value, size);
> +    buffer = rpath(ctx, path);
> +    ret = lgetxattr(buffer, name, value, size);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static ssize_t mp_user_listxattr(FsContext *ctx, const char *path,
> @@ -69,7 +74,9 @@ static ssize_t mp_user_listxattr(FsContext *ctx, const char *path,
>  static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name,
>                              void *value, size_t size, int flags)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    int ret;
> +
>      if (strncmp(name, "user.virtfs.", 12) == 0) {
>          /*
>           * Don't allow fetch of user.virtfs namesapce
> @@ -78,13 +85,18 @@ static int mp_user_setxattr(FsContext *ctx, const char *path, const char *name,
>          errno = EACCES;
>          return -1;
>      }
> -    return lsetxattr(rpath(ctx, path, buffer), name, value, size, flags);
> +    buffer = rpath(ctx, path);
> +    ret = lsetxattr(buffer, name, value, size, flags);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static int mp_user_removexattr(FsContext *ctx,
>                                 const char *path, const char *name)
>  {
> -    char buffer[PATH_MAX];
> +    char *buffer;
> +    int ret;
> +
>      if (strncmp(name, "user.virtfs.", 12) == 0) {
>          /*
>           * Don't allow fetch of user.virtfs namesapce
> @@ -93,7 +105,10 @@ static int mp_user_removexattr(FsContext *ctx,
>          errno = EACCES;
>          return -1;
>      }
> -    return lremovexattr(rpath(ctx, path, buffer), name);
> +    buffer = rpath(ctx, path);
> +    ret = lremovexattr(buffer, name);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  XattrOperations mapped_user_xattr = {
> diff --git a/hw/9pfs/virtio-9p-xattr.c b/hw/9pfs/virtio-9p-xattr.c
> index 3fae557a84ff..07183887c5ee 100644
> --- a/hw/9pfs/virtio-9p-xattr.c
> +++ b/hw/9pfs/virtio-9p-xattr.c
> @@ -67,21 +67,24 @@ ssize_t v9fs_list_xattr(FsContext *ctx, const char *path,
>                          void *value, size_t vsize)
>  {
>      ssize_t size = 0;
> -    char buffer[PATH_MAX];
> +    char *buffer;
>      void *ovalue = value;
>      XattrOperations *xops;
>      char *orig_value, *orig_value_start;
>      ssize_t xattr_len, parsed_len = 0, attr_len;
>  
>      /* Get the actual len */
> -    xattr_len = llistxattr(rpath(ctx, path, buffer), value, 0);
> +    buffer = rpath(ctx, path);
> +    xattr_len = llistxattr(buffer, value, 0);
>      if (xattr_len <= 0) {
> +        g_free(buffer);
>          return xattr_len;
>      }
>  
>      /* Now fetch the xattr and find the actual size */
>      orig_value = g_malloc(xattr_len);
> -    xattr_len = llistxattr(rpath(ctx, path, buffer), orig_value, xattr_len);
> +    xattr_len = llistxattr(buffer, orig_value, xattr_len);
> +    g_free(buffer);
>  
>      /* store the orig pointer */
>      orig_value_start = orig_value;
> diff --git a/hw/9pfs/virtio-9p-xattr.h b/hw/9pfs/virtio-9p-xattr.h
> index 41cc6cbc7ba0..327b32b5aa9e 100644
> --- a/hw/9pfs/virtio-9p-xattr.h
> +++ b/hw/9pfs/virtio-9p-xattr.h
> @@ -54,23 +54,38 @@ ssize_t pt_listxattr(FsContext *ctx, const char *path, char *name, void *value,
>  static inline ssize_t pt_getxattr(FsContext *ctx, const char *path,
>                                    const char *name, void *value, size_t size)
>  {
> -    char buffer[PATH_MAX];
> -    return lgetxattr(rpath(ctx, path, buffer), name, value, size);
> +    char *buffer;
> +    ssize_t ret;
> +
> +    buffer = rpath(ctx, path);
> +    ret = lgetxattr(buffer, name, value, size);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static inline int pt_setxattr(FsContext *ctx, const char *path,
>                                const char *name, void *value,
>                                size_t size, int flags)
>  {
> -    char buffer[PATH_MAX];
> -    return lsetxattr(rpath(ctx, path, buffer), name, value, size, flags);
> +    char *buffer;
> +    int ret;
> +
> +    buffer = rpath(ctx, path);
> +    ret = lsetxattr(buffer, name, value, size, flags);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static inline int pt_removexattr(FsContext *ctx,
>                                   const char *path, const char *name)
>  {
> -    char buffer[PATH_MAX];
> -    return lremovexattr(rpath(ctx, path, buffer), name);
> +    char *buffer;
> +    int ret;
> +
> +    buffer = rpath(ctx, path);
> +    ret = lremovexattr(path, name);
> +    g_free(buffer);
> +    return ret;
>  }
>  
>  static inline ssize_t notsup_getxattr(FsContext *ctx, const char *path,
> diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
> index 1d6eedb7d8bc..2c3603aed0d0 100644
> --- a/hw/9pfs/virtio-9p.h
> +++ b/hw/9pfs/virtio-9p.h
> @@ -6,6 +6,7 @@
>  #include <sys/time.h>
>  #include <utime.h>
>  #include <sys/resource.h>
> +#include <glib.h>
>  #include "hw/virtio/virtio.h"
>  #include "fsdev/file-op-9p.h"
>  #include "fsdev/virtio-9p-marshal.h"
> @@ -112,10 +113,9 @@ enum p9_proto_version {
>  
>  #define FID_REFERENCED          0x1
>  #define FID_NON_RECLAIMABLE     0x2
> -static inline const char *rpath(FsContext *ctx, const char *path, char *buffer)
> +static inline char *rpath(FsContext *ctx, const char *path)
>  {
> -    snprintf(buffer, PATH_MAX, "%s/%s", ctx->fs_root, path);
> -    return buffer;
> +    return g_strdup_printf("%s/%s", ctx->fs_root, path);
>  }
>  
>  /*
> 


-- 
Chen Gang

Open, share and attitude like air, water and life which God blessed

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation
  2014-03-08 13:58   ` Chen Gang
@ 2014-03-16 13:32     ` Chen Gang
  2014-03-18  0:31       ` [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement Chen Gang
  2014-03-23 13:27       ` [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation Chen Gang
  0 siblings, 2 replies; 56+ messages in thread
From: Chen Gang @ 2014-03-16 13:32 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: peter.maydell, qemu-devel, anthony

On 03/08/2014 09:58 PM, Chen Gang wrote:
> OK, thanks.
>
> Next, I will/should continue to analyse the performance issue for 9pfs
> when users drop into a long directory path under bash shell.
>

After have a test, I am sure it is not 9pfs issue, either not Qemu's
issue, it's Linux kernel vfs or block sub-systems' issue. The related
test environments (originally, our 9pfs is upper on ext4):

 - for ext4 file system under my Fedora laptop (Qemu does not start).

 - for ntfs file system under my Fedora laptop (Qemu does not start).

 - for ext4 file system under my Ubuntu in Qemu.

For a very long file name (e.g. > 3K long), all of them are very very
slow. (and I also tested the ext2 /boot partition under Ubuntu in Qemu,
it is not slow, I guess the reson is its partition size is small).


Next, I will/shall communicate with upstream kernel for it.  :-)


> Although I am not quite sure, hope I can find the root cause within
> month (2014-03-31).
>
> Welcome any suggestions, discussions, and completions for it.
>
> Thanks.
>


-- 
Chen Gang

Open, share and attitude like air, water and life which God blessed

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement.
  2014-03-16 13:32     ` Chen Gang
@ 2014-03-18  0:31       ` Chen Gang
  2014-03-18  0:39         ` Peter Maydell
  2014-03-18  5:14         ` Peter Crosthwaite
  2014-03-23 13:27       ` [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation Chen Gang
  1 sibling, 2 replies; 56+ messages in thread
From: Chen Gang @ 2014-03-18  0:31 UTC (permalink / raw)
  To: peter.maydell; +Cc: qemu-devel

Clean up useless 'break' statement after 'return' statement.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 target-arm/gdbstub64.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
index e8a8295..8f3b8d1 100644
--- a/target-arm/gdbstub64.c
+++ b/target-arm/gdbstub64.c
@@ -32,10 +32,8 @@ int aarch64_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
     switch (n) {
     case 31:
         return gdb_get_reg64(mem_buf, env->xregs[31]);
-        break;
     case 32:
         return gdb_get_reg64(mem_buf, env->pc);
-        break;
     case 33:
         return gdb_get_reg32(mem_buf, pstate_read(env));
     }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement.
  2014-03-18  0:31       ` [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement Chen Gang
@ 2014-03-18  0:39         ` Peter Maydell
  2014-03-18  0:53           ` Chen Gang
  2014-03-18  5:14         ` Peter Crosthwaite
  1 sibling, 1 reply; 56+ messages in thread
From: Peter Maydell @ 2014-03-18  0:39 UTC (permalink / raw)
  To: Chen Gang; +Cc: QEMU Developers

On 18 March 2014 00:31, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
> Clean up useless 'break' statement after 'return' statement.
>
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement.
  2014-03-18  0:39         ` Peter Maydell
@ 2014-03-18  0:53           ` Chen Gang
  0 siblings, 0 replies; 56+ messages in thread
From: Chen Gang @ 2014-03-18  0:53 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

On 03/18/2014 08:39 AM, Peter Maydell wrote:
> On 18 March 2014 00:31, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
>> Clean up useless 'break' statement after 'return' statement.
>>
>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> thanks
> -- PMM
> 

Thank you too.

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement.
  2014-03-18  0:31       ` [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement Chen Gang
  2014-03-18  0:39         ` Peter Maydell
@ 2014-03-18  5:14         ` Peter Crosthwaite
  2014-03-19  3:25           ` Chen Gang
  1 sibling, 1 reply; 56+ messages in thread
From: Peter Crosthwaite @ 2014-03-18  5:14 UTC (permalink / raw)
  To: Chen Gang; +Cc: Peter Maydell, qemu-devel@nongnu.org Developers

On Tue, Mar 18, 2014 at 10:31 AM, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
> Clean up useless 'break' statement after 'return' statement.
>
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

> ---
>  target-arm/gdbstub64.c |    2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
> index e8a8295..8f3b8d1 100644
> --- a/target-arm/gdbstub64.c
> +++ b/target-arm/gdbstub64.c
> @@ -32,10 +32,8 @@ int aarch64_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
>      switch (n) {
>      case 31:
>          return gdb_get_reg64(mem_buf, env->xregs[31]);
> -        break;
>      case 32:
>          return gdb_get_reg64(mem_buf, env->pc);
> -        break;
>      case 33:
>          return gdb_get_reg32(mem_buf, pstate_read(env));
>      }
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement.
  2014-03-18  5:14         ` Peter Crosthwaite
@ 2014-03-19  3:25           ` Chen Gang
  0 siblings, 0 replies; 56+ messages in thread
From: Chen Gang @ 2014-03-19  3:25 UTC (permalink / raw)
  To: Peter Crosthwaite; +Cc: Peter Maydell, qemu-devel@nongnu.org Developers

On 03/18/2014 01:14 PM, Peter Crosthwaite wrote:
> On Tue, Mar 18, 2014 at 10:31 AM, Chen Gang <gang.chen.5i5j@gmail.com> wrote:
>> > Clean up useless 'break' statement after 'return' statement.
>> >
>> > Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> 

OK, thanks.

-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation
  2014-03-16 13:32     ` Chen Gang
  2014-03-18  0:31       ` [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement Chen Gang
@ 2014-03-23 13:27       ` Chen Gang
  1 sibling, 0 replies; 56+ messages in thread
From: Chen Gang @ 2014-03-23 13:27 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: peter.maydell, qemu-devel, anthony

On 03/16/2014 09:32 PM, Chen Gang wrote:
> On 03/08/2014 09:58 PM, Chen Gang wrote:
>> OK, thanks.
>>
>> Next, I will/should continue to analyse the performance issue for 9pfs
>> when users drop into a long directory path under bash shell.
>>
> 
> After have a test, I am sure it is not 9pfs issue, either not Qemu's
> issue, it's Linux kernel vfs or block sub-systems' issue. The related
> test environments (originally, our 9pfs is upper on ext4):
> 
>  - for ext4 file system under my Fedora laptop (Qemu does not start).
> 
>  - for ntfs file system under my Fedora laptop (Qemu does not start).
> 
>  - for ext4 file system under my Ubuntu in Qemu.
> 
> For a very long file name (e.g. > 3K long), all of them are very very
> slow. (and I also tested the ext2 /boot partition under Ubuntu in Qemu,
> it is not slow, I guess the reson is its partition size is small).
> 
> 
> Next, I will/shall communicate with upstream kernel for it.  :-)
> 
> 
>> Although I am not quite sure, hope I can find the root cause within
>> month (2014-03-31).
>>
>> Welcome any suggestions, discussions, and completions for it.
>>
>> Thanks.
>>
> 
> 

Sorry, after give a little more test, for the lower performance issue
under a long deep path, 'bash' is the direct cause (may also be root
cause).

Also sorry, 'bash' is out of my focusing border now, so I provide the
related information below, welcome any members (e.g. 'bash', fedora, or
ubuntu members) to help check, when they have time, thanks.

  Environments (e.g. fedora 17):

    [root@gchen ~]# uname -a
    Linux gchen 3.14.0-rc7-next-20140321 #2 SMP Sun Mar 23 19:46:37 CST 2014 x86_64 x86_64 x86_64 GNU/Linux
    [root@gchen ~]# cat /etc/*-release
    Fedora release 17 (Beefy Miracle)
    NAME=Fedora
    VERSION="17 (Beefy Miracle)"
    ID=fedora
    VERSION_ID=17
    PRETTY_NAME="Fedora 17 (Beefy Miracle)"
    ANSI_COLOR="0;34"
    CPE_NAME="cpe:/o:fedoraproject:fedora:17"
    Fedora release 17 (Beefy Miracle)
    Fedora release 17 (Beefy Miracle)

  'bash' is very busy under user mode (I am only one cpu):

    top - 20:12:01 up 23 min,  5 users,  load average: 0.60, 0.35, 0.33
    Tasks: 137 total,   2 running, 135 sleeping,   0 stopped,   0 zombie
    Cpu(s): 97.1%us,  2.9%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:   1942468k total,   820896k used,  1121572k free,    40060k buffers
    Swap:        0k total,        0k used,        0k free,   446328k cached

      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
     4010 root      20   0  113m 5236 3096 R 92.3  0.3   3:57.19 -bash
     2955 root      20   0  136m  21m  10m S  2.9  1.1   0:16.00 /usr/bin/Xorg :0 -background none -logverbose 7 -auth /var/run/gdm/auth-for-gdm-8
     3860 gchen     20   0  582m  28m  19m S  1.9  1.5   0:22.93 gnome-terminal
     3348 gchen     20   0 1405m 117m  46m S  1.0  6.2   0:23.34 /usr/bin/gnome-shell
     3728 gchen     20   0  442m 8248 6140 S  1.0  0.4   0:12.05 /usr/bin/ibus-daemon -r --xim
     ...

  The related 'bash' stack is below (each time, always drop into it):

    #0  0x00000036bb290c1c in strcoll_l () from /lib64/libc.so.6
    #1  0x000000000047ff48 in ?? ()
    #2  0x0000000000480517 in ?? ()
    #3  0x0000000000480fb7 in ?? ()
    #4  0x00000000004806e0 in ?? ()
    #5  0x0000000000480fb7 in ?? ()
    #6  0x00000000004806e0 in ?? ()
    #7  0x0000000000482528 in xstrmatch ()
    #8  0x0000000000456f79 in binary_test ()
    #9  0x000000000042f308 in ?? ()
    #10 0x000000000042f449 in ?? ()
    #11 0x0000000000432379 in execute_command_internal ()
    #12 0x000000000043583e in execute_command ()
    #13 0x000000000043295e in execute_command_internal ()
    #14 0x000000000043349f in execute_command_internal ()
    #15 0x000000000043583e in execute_command ()
    #16 0x0000000000433464 in execute_command_internal ()
    #17 0x000000000043583e in execute_command ()
    #18 0x0000000000433464 in execute_command_internal ()
    #19 0x000000000043583e in execute_command ()
    #20 0x0000000000433464 in execute_command_internal ()
    #21 0x000000000043583e in execute_command ()
    #22 0x0000000000433464 in execute_command_internal ()
    #23 0x000000000043583e in execute_command ()
    #24 0x0000000000433464 in execute_command_internal ()
    #25 0x000000000043583e in execute_command ()
    #26 0x0000000000433464 in execute_command_internal ()
    #27 0x0000000000432613 in execute_command_internal ()
    #28 0x000000000043440e in ?? ()
    #29 0x0000000000431a8c in ?? ()
    #30 0x0000000000432873 in execute_command_internal ()
    #31 0x000000000043583e in execute_command ()
    #32 0x000000000043310d in execute_command_internal ()
    #33 0x000000000043349f in execute_command_internal ()
    #34 0x000000000043583e in execute_command ()
    #35 0x0000000000433464 in execute_command_internal ()
    #36 0x000000000043583e in execute_command ()
    #37 0x0000000000433464 in execute_command_internal ()
    #38 0x000000000043583e in execute_command ()
    #39 0x0000000000433464 in execute_command_internal ()
    #40 0x000000000043583e in execute_command ()
    #41 0x0000000000433464 in execute_command_internal ()
    #42 0x000000000043583e in execute_command ()
    #43 0x0000000000433464 in execute_command_internal ()
    #44 0x000000000043583e in execute_command ()
    #45 0x0000000000433464 in execute_command_internal ()
    #46 0x000000000043583e in execute_command ()
    #47 0x0000000000433464 in execute_command_internal ()
    #48 0x000000000043583e in execute_command ()
    #49 0x0000000000433464 in execute_command_internal ()
    #50 0x000000000043583e in execute_command ()
    #51 0x0000000000433464 in execute_command_internal ()
    #52 0x0000000000432613 in execute_command_internal ()
    #53 0x000000000043440e in ?? ()
    #54 0x00000000004346b5 in execute_shell_function ()
    #55 0x00000000004693c7 in gen_compspec_completions ()
    #56 0x0000000000469b69 in ?? ()
    #57 0x0000000000469cac in programmable_completions ()
    #58 0x0000000000463d01 in ?? ()
    #59 0x000000000049130f in ?? ()
    #60 0x0000000000491d68 in rl_complete_internal ()
    #61 0x000000000048978d in _rl_dispatch_subseq ()
    #62 0x0000000000489cf8 in readline_internal_char ()
    #63 0x000000000048a1a5 in readline ()
    #64 0x000000000041e59c in ?? ()
    #65 0x0000000000420158 in ?? ()
    #66 0x0000000000422d76 in ?? ()
    #67 0x000000000042610b in yyparse ()
    #68 0x000000000041de6a in parse_command ()
    #69 0x000000000041df36 in read_command ()
    #70 0x000000000041e193 in reader_loop ()
    #71 0x000000000041c6e5 in main ()


Thanks.
-- 
Chen Gang

Open, share and attitude like air, water and life which God blessed

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2014-09-04 16:01 Aneesh Kumar K.V
  2014-09-04 18:21 ` Peter Maydell
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2014-09-04 16:01 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: qemu-devel, Aneesh Kumar K.V

The following changes since commit 30eaca3acdf17d7bcbd1213eb149c02037edfb0b:

  Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20140902-1' into staging (2014-09-02 10:26:10 +0100)

are available in the git repository at:


  https://github.com/kvaneesh/qemu.git for-upstream

for you to fetch changes up to 840a1bf2832f5783d1070547fcb460216fc219e5:

  hw/9pfs: Don't return type from host in readdir on local 9p filesystem (2014-09-04 10:51:13 -0500)

----------------------------------------------------------------
Aneesh Kumar K.V (1):
      hw/9pfs: Use little-endian format for xattr values

Bastian Blank (1):
      hw/9pfs: Don't return type from host in readdir on local 9p filesystem

 hw/9pfs/virtio-9p-local.c | 49 +++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 25 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2014-09-04 16:01 Aneesh Kumar K.V
@ 2014-09-04 18:21 ` Peter Maydell
  0 siblings, 0 replies; 56+ messages in thread
From: Peter Maydell @ 2014-09-04 18:21 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers, Anthony Liguori

On 4 September 2014 17:01, Aneesh Kumar K.V
<aneesh.kumar@linux.vnet.ibm.com> wrote:
> The following changes since commit 30eaca3acdf17d7bcbd1213eb149c02037edfb0b:
>
>   Merge remote-tracking branch 'remotes/spice/tags/pull-spice-20140902-1' into staging (2014-09-02 10:26:10 +0100)
>
> are available in the git repository at:
>
>
>   https://github.com/kvaneesh/qemu.git for-upstream
>
> for you to fetch changes up to 840a1bf2832f5783d1070547fcb460216fc219e5:
>
>   hw/9pfs: Don't return type from host in readdir on local 9p filesystem (2014-09-04 10:51:13 -0500)
>
> ----------------------------------------------------------------
> Aneesh Kumar K.V (1):
>       hw/9pfs: Use little-endian format for xattr values
>
> Bastian Blank (1):
>       hw/9pfs: Don't return type from host in readdir on local 9p filesystem
>
>  hw/9pfs/virtio-9p-local.c | 49 +++++++++++++++++++++++------------------------
>  1 file changed, 24 insertions(+), 25 deletions(-)
>
> --
> 1.9.1

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2015-03-16 10:09 Aneesh Kumar K.V
  2015-03-16 13:55 ` Peter Maydell
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2015-03-16 10:09 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: qemu-devel, Aneesh Kumar K.V


Hi,

Please pull the below update for VirtFS

The following changes since commit ee74801035b0b5f1fdfd4e31d3a53f511f91c804:

  Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150311' into staging (2015-03-11 18:22:15 +0000)

are available in the git repository at:

  https://github.com/kvaneesh/qemu.git for-upstream

for you to fetch changes up to 4ed7b2c3a78f785a1bcbe575e08c379b166723e3:

  virtio: Fix memory leaks reported by Coverity (2015-03-16 13:32:24 +0530)

----------------------------------------------------------------
Michael Tokarev (2):
      9pfs-local: simplify/optimize local_mapped_attr_path()
      9pfs-proxy: tiny cleanups in proxy_pwritev and proxy_preadv

Shannon Zhao (3):
      hw/9pfs/virtio-9p-posix-acl: Fix out-of-bounds access
      fsdev/virtfs-proxy-helper: Fix improper use of negative value
      virtfs-proxy: Fix possible overflow

Stefan Weil (1):
      virtio: Fix memory leaks reported by Coverity

 fsdev/virtfs-proxy-helper.c   |  4 ++++
 hw/9pfs/virtio-9p-local.c     | 52 ++++++++++++++++---------------------------
 hw/9pfs/virtio-9p-posix-acl.c |  2 +-
 hw/9pfs/virtio-9p-proxy.c     | 22 +++++++++---------
 4 files changed, 36 insertions(+), 44 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2015-03-16 10:09 Aneesh Kumar K.V
@ 2015-03-16 13:55 ` Peter Maydell
  0 siblings, 0 replies; 56+ messages in thread
From: Peter Maydell @ 2015-03-16 13:55 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers, Anthony Liguori

On 16 March 2015 at 10:09, Aneesh Kumar K.V
<aneesh.kumar@linux.vnet.ibm.com> wrote:
>
> Hi,
>
> Please pull the below update for VirtFS
>
> The following changes since commit ee74801035b0b5f1fdfd4e31d3a53f511f91c804:
>
>   Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150311' into staging (2015-03-11 18:22:15 +0000)
>
> are available in the git repository at:
>
>   https://github.com/kvaneesh/qemu.git for-upstream
>
> for you to fetch changes up to 4ed7b2c3a78f785a1bcbe575e08c379b166723e3:

Nudge: this is not a signed pull request. I am currently still
accepting and applying these, but after 2.3 is out I plan to
start rejecting them. You should update your workflow (ask me
if you're not sure how, it's not too much different).

>   virtio: Fix memory leaks reported by Coverity (2015-03-16 13:32:24 +0530)

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

* [Qemu-devel] [PULL] VirtFS update
@ 2015-06-16 15:29 Aneesh Kumar K.V
  2015-06-17 11:26 ` Peter Maydell
  0 siblings, 1 reply; 56+ messages in thread
From: Aneesh Kumar K.V @ 2015-06-16 15:29 UTC (permalink / raw)
  To: anthony, peter.maydell; +Cc: qemu-devel, Aneesh Kumar K.V

The following changes since commit 93f6d1c16036aaf34055d16f54ea770fb8d6d280:

  Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150615-1' into staging (2015-06-16 10:35:43 +0100)

are available in the git repository at:

  https://github.com/kvaneesh/qemu.git tags/for-upstream-signed

for you to fetch changes up to f8d30a4f96d6c3a12e692d2e69b8fe4734b916c6:

  virtfs-proxy-helper: fail gracefully if socket path is too long (2015-06-16 20:32:29 +0530)

----------------------------------------------------------------
VirtFS update:

* Fix for virtfs-proxy-helper crash
* Gracefully handle the error condition on input validation in virtfs-proxy-helper

----------------------------------------------------------------
Stefan Hajnoczi (2):
      virtfs-proxy-helper: add missing long option terminator
      virtfs-proxy-helper: fail gracefully if socket path is too long

 fsdev/virtfs-proxy-helper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [Qemu-devel] [PULL] VirtFS update
  2015-06-16 15:29 Aneesh Kumar K.V
@ 2015-06-17 11:26 ` Peter Maydell
  0 siblings, 0 replies; 56+ messages in thread
From: Peter Maydell @ 2015-06-17 11:26 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: QEMU Developers, Anthony Liguori

On 16 June 2015 at 16:29, Aneesh Kumar K.V
<aneesh.kumar@linux.vnet.ibm.com> wrote:
> The following changes since commit 93f6d1c16036aaf34055d16f54ea770fb8d6d280:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20150615-1' into staging (2015-06-16 10:35:43 +0100)
>
> are available in the git repository at:
>
>   https://github.com/kvaneesh/qemu.git tags/for-upstream-signed
>
> for you to fetch changes up to f8d30a4f96d6c3a12e692d2e69b8fe4734b916c6:
>
>   virtfs-proxy-helper: fail gracefully if socket path is too long (2015-06-16 20:32:29 +0530)
>
> ----------------------------------------------------------------
> VirtFS update:
>
> * Fix for virtfs-proxy-helper crash
> * Gracefully handle the error condition on input validation in virtfs-proxy-helper
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2015-06-17 11:26 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-07 15:16 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
2014-03-07 15:16 ` [Qemu-devel] [PATCH 1/5] fsdev: Fix overrun after readlink() fills buffer completely Aneesh Kumar K.V
2014-03-07 15:16 ` [Qemu-devel] [PATCH 2/5] hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:" Aneesh Kumar K.V
2014-03-07 15:16 ` [Qemu-devel] [PATCH 3/5] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf() Aneesh Kumar K.V
2014-03-07 15:16 ` [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation Aneesh Kumar K.V
2014-03-08 13:58   ` Chen Gang
2014-03-16 13:32     ` Chen Gang
2014-03-18  0:31       ` [Qemu-devel] [PATCH trivial] target-arm/gdbstub64.c: remove useless 'break' statement Chen Gang
2014-03-18  0:39         ` Peter Maydell
2014-03-18  0:53           ` Chen Gang
2014-03-18  5:14         ` Peter Crosthwaite
2014-03-19  3:25           ` Chen Gang
2014-03-23 13:27       ` [Qemu-devel] [PATCH 4/5] hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation Chen Gang
2014-03-07 15:16 ` [Qemu-devel] [PATCH 5/5] hw/9pfs: Include virtio-9p-device.o in build Aneesh Kumar K.V
2014-03-07 15:30   ` Andreas Färber
2014-03-07 17:07     ` Aneesh Kumar K.V
2014-03-08 12:52 ` [Qemu-devel] [PULL] VirtFS update Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2015-06-16 15:29 Aneesh Kumar K.V
2015-06-17 11:26 ` Peter Maydell
2015-03-16 10:09 Aneesh Kumar K.V
2015-03-16 13:55 ` Peter Maydell
2014-09-04 16:01 Aneesh Kumar K.V
2014-09-04 18:21 ` Peter Maydell
2014-02-05  7:14 Aneesh Kumar K.V
2014-02-05  7:58 ` Aneesh Kumar K.V
2014-02-10 18:48 ` Peter Maydell
2014-02-10 19:21 ` Andreas Färber
2014-02-10 19:43   ` Peter Maydell
2014-02-10 19:48     ` Andreas Färber
2014-02-10 19:51       ` Peter Maydell
2013-05-29 11:33 Aneesh Kumar K.V
2013-05-31 18:48 ` Anthony Liguori
2012-12-05 16:37 Aneesh Kumar K.V
2012-12-10 16:58 ` Anthony Liguori
2012-07-31 17:27 Aneesh Kumar K.V
2012-08-03 20:45 ` Anthony Liguori
2012-02-26 17:44 Aneesh Kumar K.V
2012-02-28 15:33 ` Anthony Liguori
2012-01-30 16:14 Aneesh Kumar K.V
2012-02-07 12:36 ` Aneesh Kumar K.V
2012-01-23 13:02 Aneesh Kumar K.V
2012-01-23 17:05 ` Anthony Liguori
2012-01-23 18:25   ` Aneesh Kumar K.V
2011-12-21  7:57 Aneesh Kumar K.V
2011-12-27 16:36 ` Anthony Liguori
2011-12-17 13:31 Aneesh Kumar K.V
2011-12-05  9:04 Aneesh Kumar K.V
2011-11-02 10:22 [Qemu-devel] [PULL] Virtfs update Aneesh Kumar K.V
2011-11-02 12:42 ` Anthony Liguori
2011-11-02 14:09   ` Aneesh Kumar K.V
2011-11-03 13:09     ` Anthony Liguori
2011-11-02 15:55   ` Markus Armbruster
2011-09-27  9:11 [Qemu-devel] [PULL] VirtFS update Aneesh Kumar K.V
2011-09-29 20:05 ` Anthony Liguori
2011-09-13 13:27 Aneesh Kumar K.V
2011-09-15 19:10 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).