Commit-ID: 5fd2a45e96670408462e8791415953d9019d1030 Gitweb: http://git.kernel.org/tip/5fd2a45e96670408462e8791415953d9019d1030 Author: Pekka Enberg <penberg@xxxxxxxxxx> AuthorDate: Wed, 3 Oct 2012 10:54:05 +0300 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Tue, 9 Oct 2012 09:27:12 +0300 kvm tools: Drop lchown() calls from 9p Creating new files in a guest: echo "hello, world" > hello.txt results in EPERM on my machine. The problem is that virtio_p9_create() calls lchown() on UID zero (we are logged in as root in the guest) which obviously doesn't work. In fact, ownership changes can't work unless we have some sort of uid/gid mapping. Therefore, drop the calls to lchown(). Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- tools/kvm/virtio/9p.c | 16 ---------------- 1 files changed, 0 insertions(+), 16 deletions(-) diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index 4864b2f..835a8c4 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -286,10 +286,6 @@ static void virtio_p9_create(struct p9_dev *p9dev, if (ret < 0) goto err_out; - ret = lchown(full_path, dfid->uid, gid); - if (ret < 0) - goto err_out; - sprintf(dfid->path, "%s/%s", dfid->path, name); stat2qid(&st, &qid); virtio_p9_pdu_writef(pdu, "Qd", &qid, 0); @@ -330,10 +326,6 @@ static void virtio_p9_mkdir(struct p9_dev *p9dev, if (ret < 0) goto err_out; - ret = lchown(full_path, dfid->uid, gid); - if (ret < 0) - goto err_out; - stat2qid(&st, &qid); virtio_p9_pdu_writef(pdu, "Qd", &qid, 0); *outlen = pdu->write_offset; @@ -874,10 +866,6 @@ static void virtio_p9_mknod(struct p9_dev *p9dev, if (ret < 0) goto err_out; - ret = lchown(full_path, dfid->uid, gid); - if (ret < 0) - goto err_out; - stat2qid(&st, &qid); virtio_p9_pdu_writef(pdu, "Q", &qid); free(name); @@ -936,10 +924,6 @@ static void virtio_p9_symlink(struct p9_dev *p9dev, if (lstat(new_name, &st) < 0) goto err_out; - ret = lchown(new_name, dfid->uid, gid); - if (ret < 0) - goto err_out; - stat2qid(&st, &qid); virtio_p9_pdu_writef(pdu, "Q", &qid); free(name); -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html