Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
9p: fix create->unlink->fstat bug
this is the kvmtool side of the bug fix.  Essentially if we have
a fid that is already open then use fstat instead of lstat to avoid
the aforementioned problem.

Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
  • Loading branch information
ericvh committed Apr 12, 2015
1 parent e325f3e commit 2fa2f7e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/kvm/virtio/9p.c
Expand Up @@ -584,8 +584,14 @@ static void virtio_p9_getattr(struct p9_dev *p9dev,

virtio_p9_pdu_readf(pdu, "dq", &fid_val, &request_mask);
fid = get_fid(p9dev, fid_val);
if (lstat(fid->abs_path, &st) < 0)
goto err_out;

if(fid->fd > 0) {
if(fstat(fid->fd, &st) < 0)
goto err_out;
} else {
if (lstat(fid->abs_path, &st) < 0)
goto err_out;
}

virtio_p9_fill_stat(p9dev, &st, &statl);
virtio_p9_pdu_writef(pdu, "A", &statl);
Expand Down

0 comments on commit 2fa2f7e

Please sign in to comment.