public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kvm tools: Add missing 9p remove handler
@ 2011-11-07 15:19 Sasha Levin
  2011-11-07 15:19 ` [PATCH 2/2] kvm tools: Add missing 9p rename handler Sasha Levin
  2011-11-07 15:38 ` [PATCH 1/2] kvm tools: Add missing 9p remove handler Pekka Enberg
  0 siblings, 2 replies; 10+ messages in thread
From: Sasha Levin @ 2011-11-07 15:19 UTC (permalink / raw)
  To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/virtio/9p.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
index 1569bb2..08b1be7 100644
--- a/tools/kvm/virtio/9p.c
+++ b/tools/kvm/virtio/9p.c
@@ -677,6 +677,30 @@ err_out:
 	return;
 }
 
+static void virtio_p9_remove(struct p9_dev *p9dev,
+			       struct p9_pdu *pdu, u32 *outlen)
+{
+	int ret;
+	u32 fid_val;
+	struct p9_fid *fid;
+	char full_path[PATH_MAX];
+
+	virtio_p9_pdu_readf(pdu, "d", &fid_val);
+	fid = &p9dev->fids[fid_val];
+
+	sprintf(full_path, "%s", fid->abs_path);
+	ret = remove(full_path);
+	if (ret < 0)
+		goto err_out;
+	*outlen = pdu->write_offset;
+	virtio_p9_set_reply_header(pdu, *outlen);
+	return;
+
+err_out:
+	virtio_p9_error_reply(p9dev, pdu, errno, outlen);
+	return;	
+}
+			       
 static void virtio_p9_readlink(struct p9_dev *p9dev,
 			       struct p9_pdu *pdu, u32 *outlen)
 {
@@ -1048,6 +1072,7 @@ static p9_handler *virtio_9p_dotl_handler [] = {
 	[P9_TSYMLINK]     = virtio_p9_symlink,
 	[P9_TLCREATE]     = virtio_p9_create,
 	[P9_TWRITE]       = virtio_p9_write,
+	[P9_TREMOVE]      = virtio_p9_remove,
 };
 
 static struct p9_pdu *virtio_p9_pdu_init(struct kvm *kvm, struct virt_queue *vq)
-- 
1.7.7.2


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

* [PATCH 2/2] kvm tools: Add missing 9p rename handler
  2011-11-07 15:19 [PATCH 1/2] kvm tools: Add missing 9p remove handler Sasha Levin
@ 2011-11-07 15:19 ` Sasha Levin
  2011-11-07 15:38 ` [PATCH 1/2] kvm tools: Add missing 9p remove handler Pekka Enberg
  1 sibling, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2011-11-07 15:19 UTC (permalink / raw)
  To: penberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Sasha Levin

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/virtio/9p.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
index 08b1be7..2392bd1 100644
--- a/tools/kvm/virtio/9p.c
+++ b/tools/kvm/virtio/9p.c
@@ -700,6 +700,32 @@ err_out:
 	virtio_p9_error_reply(p9dev, pdu, errno, outlen);
 	return;	
 }
+
+static void virtio_p9_rename(struct p9_dev *p9dev,
+			       struct p9_pdu *pdu, u32 *outlen)
+{
+	int ret;
+	u32 fid_val, new_fid_val;
+	struct p9_fid *fid, *new_fid;
+	char full_path[PATH_MAX], *new_name;
+
+	virtio_p9_pdu_readf(pdu, "dds", &fid_val, &new_fid_val, &new_name);
+	fid = &p9dev->fids[fid_val];
+	new_fid = &p9dev->fids[new_fid_val];
+
+	sprintf(full_path, "%s/%s", new_fid->abs_path, new_name);
+	ret = rename(fid->abs_path, full_path);
+	if (ret < 0)
+		goto err_out;
+	close_fid(p9dev, fid_val);
+	*outlen = pdu->write_offset;
+	virtio_p9_set_reply_header(pdu, *outlen);
+	return;
+
+err_out:
+	virtio_p9_error_reply(p9dev, pdu, errno, outlen);
+	return;	
+}
 			       
 static void virtio_p9_readlink(struct p9_dev *p9dev,
 			       struct p9_pdu *pdu, u32 *outlen)
@@ -1073,6 +1099,7 @@ static p9_handler *virtio_9p_dotl_handler [] = {
 	[P9_TLCREATE]     = virtio_p9_create,
 	[P9_TWRITE]       = virtio_p9_write,
 	[P9_TREMOVE]      = virtio_p9_remove,
+	[P9_TRENAME]      = virtio_p9_rename,
 };
 
 static struct p9_pdu *virtio_p9_pdu_init(struct kvm *kvm, struct virt_queue *vq)
-- 
1.7.7.2


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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 15:19 [PATCH 1/2] kvm tools: Add missing 9p remove handler Sasha Levin
  2011-11-07 15:19 ` [PATCH 2/2] kvm tools: Add missing 9p rename handler Sasha Levin
@ 2011-11-07 15:38 ` Pekka Enberg
  2011-11-07 15:38   ` Sasha Levin
  2011-11-07 20:52   ` Darren Hart
  1 sibling, 2 replies; 10+ messages in thread
From: Pekka Enberg @ 2011-11-07 15:38 UTC (permalink / raw)
  To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov, Darren Hart

On Mon, 2011-11-07 at 17:19 +0200, Sasha Levin wrote:
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>

-ENOCHANGELOG :-)

I assume this is related to the git problems Darren Hart reported on
Google Plus?

> ---
>  tools/kvm/virtio/9p.c |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
> index 1569bb2..08b1be7 100644
> --- a/tools/kvm/virtio/9p.c
> +++ b/tools/kvm/virtio/9p.c
> @@ -677,6 +677,30 @@ err_out:
>  	return;
>  }
>  
> +static void virtio_p9_remove(struct p9_dev *p9dev,
> +			       struct p9_pdu *pdu, u32 *outlen)
> +{
> +	int ret;
> +	u32 fid_val;
> +	struct p9_fid *fid;
> +	char full_path[PATH_MAX];
> +
> +	virtio_p9_pdu_readf(pdu, "d", &fid_val);
> +	fid = &p9dev->fids[fid_val];
> +
> +	sprintf(full_path, "%s", fid->abs_path);
> +	ret = remove(full_path);
> +	if (ret < 0)
> +		goto err_out;
> +	*outlen = pdu->write_offset;
> +	virtio_p9_set_reply_header(pdu, *outlen);
> +	return;
> +
> +err_out:
> +	virtio_p9_error_reply(p9dev, pdu, errno, outlen);
> +	return;	
> +}
> +			       
>  static void virtio_p9_readlink(struct p9_dev *p9dev,
>  			       struct p9_pdu *pdu, u32 *outlen)
>  {
> @@ -1048,6 +1072,7 @@ static p9_handler *virtio_9p_dotl_handler [] = {
>  	[P9_TSYMLINK]     = virtio_p9_symlink,
>  	[P9_TLCREATE]     = virtio_p9_create,
>  	[P9_TWRITE]       = virtio_p9_write,
> +	[P9_TREMOVE]      = virtio_p9_remove,
>  };
>  
>  static struct p9_pdu *virtio_p9_pdu_init(struct kvm *kvm, struct virt_queue *vq)



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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 15:38 ` [PATCH 1/2] kvm tools: Add missing 9p remove handler Pekka Enberg
@ 2011-11-07 15:38   ` Sasha Levin
  2011-11-07 15:43     ` Pekka Enberg
  2011-11-07 20:52   ` Darren Hart
  1 sibling, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2011-11-07 15:38 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Darren Hart

On Mon, 2011-11-07 at 17:38 +0200, Pekka Enberg wrote:
> On Mon, 2011-11-07 at 17:19 +0200, Sasha Levin wrote:
> > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> 
> -ENOCHANGELOG :-)
> 
> I assume this is related to the git problems Darren Hart reported on
> Google Plus?

Yup.

We forgot to do something that handles unlinks and renames when we
switches to .l, now we do.

git has just raised those issues.

-- 

Sasha.


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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 15:38   ` Sasha Levin
@ 2011-11-07 15:43     ` Pekka Enberg
  2011-11-07 15:45       ` Sasha Levin
  0 siblings, 1 reply; 10+ messages in thread
From: Pekka Enberg @ 2011-11-07 15:43 UTC (permalink / raw)
  To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov, Darren Hart

On Mon, 2011-11-07 at 17:38 +0200, Sasha Levin wrote:
> On Mon, 2011-11-07 at 17:38 +0200, Pekka Enberg wrote:
> > On Mon, 2011-11-07 at 17:19 +0200, Sasha Levin wrote:
> > > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> > 
> > -ENOCHANGELOG :-)
> > 
> > I assume this is related to the git problems Darren Hart reported on
> > Google Plus?
> 
> Yup.
> 
> We forgot to do something that handles unlinks and renames when we
> switches to .l, now we do.
> 
> git has just raised those issues.

Well, it'd be nice to say that in the changelog and add a Reported-by
from Darren, no? ;-)

			Pekka



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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 15:43     ` Pekka Enberg
@ 2011-11-07 15:45       ` Sasha Levin
  0 siblings, 0 replies; 10+ messages in thread
From: Sasha Levin @ 2011-11-07 15:45 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: kvm, mingo, asias.hejun, gorcunov, Darren Hart

On Mon, 2011-11-07 at 17:43 +0200, Pekka Enberg wrote:
> On Mon, 2011-11-07 at 17:38 +0200, Sasha Levin wrote:
> > On Mon, 2011-11-07 at 17:38 +0200, Pekka Enberg wrote:
> > > On Mon, 2011-11-07 at 17:19 +0200, Sasha Levin wrote:
> > > > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> > > 
> > > -ENOCHANGELOG :-)
> > > 
> > > I assume this is related to the git problems Darren Hart reported on
> > > Google Plus?
> > 
> > Yup.
> > 
> > We forgot to do something that handles unlinks and renames when we
> > switches to .l, now we do.
> > 
> > git has just raised those issues.
> 
> Well, it'd be nice to say that in the changelog and add a Reported-by
> from Darren, no? ;-)

I'll resend :)

-- 

Sasha.


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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 15:38 ` [PATCH 1/2] kvm tools: Add missing 9p remove handler Pekka Enberg
  2011-11-07 15:38   ` Sasha Levin
@ 2011-11-07 20:52   ` Darren Hart
  2011-11-07 21:40     ` Sasha Levin
  1 sibling, 1 reply; 10+ messages in thread
From: Darren Hart @ 2011-11-07 20:52 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, kvm, mingo, asias.hejun, gorcunov

Hi Pekka,

On 11/07/2011 07:38 AM, Pekka Enberg wrote:
> On Mon, 2011-11-07 at 17:19 +0200, Sasha Levin wrote:
>> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> 
> -ENOCHANGELOG :-)
> 
> I assume this is related to the git problems Darren Hart reported on
> Google Plus?

These patches certainly help things along. The git init command now
completes and and I can remove existing git repositories (which I could
not before).

I was unable to get a git clone to complete (hangs at receiving objects
0%). I was able to create a new repository, edit a file, add it, and
commit it. "git log" return nothing, same with git show HEAD:

sh-4.2# cd 9ptest/
sh-4.2# ls
world
sh-4.2# git status
# On branch master
nothing to commit (working directory clean)

(so it doesn't list "world" as untracked nor as changed but not
committed). It has been committed.

sh-4.2# git log
sh-4.2# git show HEAD
sh-4.2# git whatchanged HEAD

A couple nitpics below:

> 
>> ---
>>  tools/kvm/virtio/9p.c |   25 +++++++++++++++++++++++++
>>  1 files changed, 25 insertions(+), 0 deletions(-)
>>
>> diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
>> index 1569bb2..08b1be7 100644
>> --- a/tools/kvm/virtio/9p.c
>> +++ b/tools/kvm/virtio/9p.c
>> @@ -677,6 +677,30 @@ err_out:
>>  	return;
>>  }
>>  
>> +static void virtio_p9_remove(struct p9_dev *p9dev,
>> +			       struct p9_pdu *pdu, u32 *outlen)
>> +{
>> +	int ret;
>> +	u32 fid_val;
>> +	struct p9_fid *fid;
>> +	char full_path[PATH_MAX];
>> +
>> +	virtio_p9_pdu_readf(pdu, "d", &fid_val);
>> +	fid = &p9dev->fids[fid_val];
>> +
>> +	sprintf(full_path, "%s", fid->abs_path);
>> +	ret = remove(full_path);
>> +	if (ret < 0)
>> +		goto err_out;
>> +	*outlen = pdu->write_offset;
>> +	virtio_p9_set_reply_header(pdu, *outlen);
>> +	return;
>> +
>> +err_out:
>> +	virtio_p9_error_reply(p9dev, pdu, errno, outlen);
>> +	return;	

EOL whitespace ^


The same issue exists with the _rename patch following this one.

>> +}
>> +			       

EOL white space ^

>>  static void virtio_p9_readlink(struct p9_dev *p9dev,
>>  			       struct p9_pdu *pdu, u32 *outlen)
>>  {
>> @@ -1048,6 +1072,7 @@ static p9_handler *virtio_9p_dotl_handler [] = {
>>  	[P9_TSYMLINK]     = virtio_p9_symlink,
>>  	[P9_TLCREATE]     = virtio_p9_create,
>>  	[P9_TWRITE]       = virtio_p9_write,
>> +	[P9_TREMOVE]      = virtio_p9_remove,
>>  };
>>  
>>  static struct p9_pdu *virtio_p9_pdu_init(struct kvm *kvm, struct virt_queue *vq)
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 20:52   ` Darren Hart
@ 2011-11-07 21:40     ` Sasha Levin
  2011-11-07 22:16       ` Darren Hart
  0 siblings, 1 reply; 10+ messages in thread
From: Sasha Levin @ 2011-11-07 21:40 UTC (permalink / raw)
  To: Darren Hart; +Cc: Pekka Enberg, kvm, mingo, asias.hejun, gorcunov

Hi Darren,

On Mon, 2011-11-07 at 12:52 -0800, Darren Hart wrote:
> Hi Pekka,
> 
> On 11/07/2011 07:38 AM, Pekka Enberg wrote:
> > On Mon, 2011-11-07 at 17:19 +0200, Sasha Levin wrote:
> >> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> > 
> > -ENOCHANGELOG :-)
> > 
> > I assume this is related to the git problems Darren Hart reported on
> > Google Plus?
> 
> These patches certainly help things along. The git init command now
> completes and and I can remove existing git repositories (which I could
> not before).
> 
> I was unable to get a git clone to complete (hangs at receiving objects
> 0%). I was able to create a new repository, edit a file, add it, and
> commit it. "git log" return nothing, same with git show HEAD:

I've tested 'git clone' with several repositories, and it worked fine.
Maybe it's stuck because you're trying to clone something big?

Could you try cloning a small repository and see if it works for you?

> sh-4.2# cd 9ptest/
> sh-4.2# ls
> world
> sh-4.2# git status
> # On branch master
> nothing to commit (working directory clean)
> 
> (so it doesn't list "world" as untracked nor as changed but not
> committed). It has been committed.
> 
> sh-4.2# git log
> sh-4.2# git show HEAD
> sh-4.2# git whatchanged HEAD

I've tried doing as follows:

git init
echo "test" > dummy_file
git add dummy_file
git commit -m "my message"
git log

At that point I got the right response from 'git log', as well as from
the other status commands. Did you do anything different?

-- 

Sasha.


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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 21:40     ` Sasha Levin
@ 2011-11-07 22:16       ` Darren Hart
  2011-11-08  6:36         ` Pekka Enberg
  0 siblings, 1 reply; 10+ messages in thread
From: Darren Hart @ 2011-11-07 22:16 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Pekka Enberg, kvm, mingo, asias.hejun, gorcunov



On 11/07/2011 01:40 PM, Sasha Levin wrote:
> Hi Darren,
> 
> On Mon, 2011-11-07 at 12:52 -0800, Darren Hart wrote:
>> Hi Pekka,
>>
>> On 11/07/2011 07:38 AM, Pekka Enberg wrote:
>>> On Mon, 2011-11-07 at 17:19 +0200, Sasha Levin wrote:
>>>> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
>>>
>>> -ENOCHANGELOG :-)
>>>
>>> I assume this is related to the git problems Darren Hart reported on
>>> Google Plus?
>>
>> These patches certainly help things along. The git init command now
>> completes and and I can remove existing git repositories (which I could
>> not before).
>>
>> I was unable to get a git clone to complete (hangs at receiving objects
>> 0%). I was able to create a new repository, edit a file, add it, and
>> commit it. "git log" return nothing, same with git show HEAD:
> 
> I've tested 'git clone' with several repositories, and it worked fine.
> Maybe it's stuck because you're trying to clone something big?
> 
> Could you try cloning a small repository and see if it works for you?

sh-4.2# git clone git://github.com/dvhart/braindump.git
Cloning into braindump...
remote: Counting objects: 1014, done.
remote: Compressing objects: 100% (441/441), done.
Receiving objects:  21% (213/1014)

This one made some progress on receiving objects, then hung for several
minutes (stuck there now).


> 
>> sh-4.2# cd 9ptest/
>> sh-4.2# ls
>> world
>> sh-4.2# git status
>> # On branch master
>> nothing to commit (working directory clean)
>>
>> (so it doesn't list "world" as untracked nor as changed but not
>> committed). It has been committed.
>>
>> sh-4.2# git log
>> sh-4.2# git show HEAD
>> sh-4.2# git whatchanged HEAD
> 
> I've tried doing as follows:
> 
> git init
> echo "test" > dummy_file
> git add dummy_file
> git commit -m "my message"
> git log
> 
> At that point I got the right response from 'git log', as well as from
> the other status commands. Did you do anything different?

That was precisely what I did.


-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel

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

* Re: [PATCH 1/2] kvm tools: Add missing 9p remove handler
  2011-11-07 22:16       ` Darren Hart
@ 2011-11-08  6:36         ` Pekka Enberg
  0 siblings, 0 replies; 10+ messages in thread
From: Pekka Enberg @ 2011-11-08  6:36 UTC (permalink / raw)
  To: Darren Hart; +Cc: Sasha Levin, kvm, mingo, asias.hejun, gorcunov

On Mon, 7 Nov 2011, Darren Hart wrote:
>> Could you try cloning a small repository and see if it works for you?
>
> sh-4.2# git clone git://github.com/dvhart/braindump.git
> Cloning into braindump...
> remote: Counting objects: 1014, done.
> remote: Compressing objects: 100% (441/441), done.
> Receiving objects:  21% (213/1014)
>
> This one made some progress on receiving objects, then hung for several
> minutes (stuck there now).

Can you run

   kvm debug -a

in another host terminal when the guest gets stuck and post the output? 
(There's sysqr-t output on guest terminal too.)

 			Pekka

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

end of thread, other threads:[~2011-11-08  6:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-07 15:19 [PATCH 1/2] kvm tools: Add missing 9p remove handler Sasha Levin
2011-11-07 15:19 ` [PATCH 2/2] kvm tools: Add missing 9p rename handler Sasha Levin
2011-11-07 15:38 ` [PATCH 1/2] kvm tools: Add missing 9p remove handler Pekka Enberg
2011-11-07 15:38   ` Sasha Levin
2011-11-07 15:43     ` Pekka Enberg
2011-11-07 15:45       ` Sasha Levin
2011-11-07 20:52   ` Darren Hart
2011-11-07 21:40     ` Sasha Levin
2011-11-07 22:16       ` Darren Hart
2011-11-08  6:36         ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox