Commit graph

22 commits

Author SHA1 Message Date
Kirill A. Shutemov f8b7ee38b3 hw/9pfs: fix P9_STATS_GEN handling
Currently we fail getattr request altogether if we can't read
P9_STATS_GEN for some reason. It breaks valid use cases:

E.g let's assume we have non-readable directory with execution bit set
on host and we export it to client over 9p On host we can chdir into
directory, but not open directory on read and list content.

But if client will try to call getattr (as part of chdir(2)) for the
directory it will fail with -EACCES. It happens because we try to open
the directory on read to call ioctl(FS_IOC_GETVERSION), it fails and we
return the error code to client.

It's excessive. The solution is to make P9_STATS_GEN failure non-fatal
for getattr request. Just don't set P9_STATS_GEN flag in result mask on
failure.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2014-02-02 22:09:16 +05:30
Gabriel de Perthuis db431f6adc hw/9pfs: Be robust against paths without FS_IOC_GETVERSION
9P optionally uses the FS_IOC_GETVERSION ioctl to get information about
a file's version (sometimes called generation number).

The code checks for supported filesystems at mount time, but some paths
may come from other mounted filesystems.

Change it to treat unsupported paths the same as unsupported
filesystems, returning 0 in both cases.

Note: ENOTTY is the error code for an unsupported ioctl.

This fix allows booting a linux kernel with the same / filesystem as the
host; otherwise the boot fails when mounting devtmpfs.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2013-05-28 15:23:12 +05:30
Paolo Bonzini 1de7afc984 misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:32:39 +01:00
Paolo Bonzini 737e150e89 block: move include files to include/block/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:31:31 +01:00
Aneesh Kumar K.V 2c30dd744a hw/9pfs: Add new security model mapped-file.
This enable us to do passthrough equivalent security model on NFS directory.
NFS server mostly do root squashing and don't support xattr. Hence we cannot
use 'passthrough' or 'mapped' security model

Also added "mapped-xattr" security to indicate earlier "mapped" security model
Older name is still supported.

POSIX rules regarding ctime update on chmod are not followed by this security model.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2012-01-19 12:21:11 +05:30
Aneesh Kumar K.V 8b88827222 hw/9pfs: Use the correct file descriptor in Fsdriver Callback
Fsdriver callback that operate on file descriptor need to
differentiate between directory fd and file fd.

Based on the original patch from Sassan Panahinejad <sassan@sassan.me.uk>

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-12-04 22:35:28 +05:30
Aneesh Kumar K.V cc720ddb54 hw/9pfs: Abstract open state of fid to V9fsFidOpenState
To implement synthetic file system in Qemu we may not really
require file descriptor and Dir *. Make generic code use
V9fsFidOpenState instead.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-31 12:34:17 +05:30
Harsh Prateek Bora e06a765efb hw/9pfs: Add st_gen support in getattr reply
This patch use file system specific ioctl for getting i_generation
value. Not all file system support the ioctl. So we add an export
specific extended operation and assign right callback for the
file system that support i_generation ioctl

["M. Mohan Kumar" <mohan@in.ibm.com> we can do ioctl only for
regular files and directories on the server]

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-10-15 15:30:27 +05:30
Aneesh Kumar K.V bccacf6c79 hw/9pfs: Implement TFLUSH operation
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 532decb715 hw/9pfs: Add fs driver specific details to fscontext
Add a new context flag PATHNAME_FSCONTEXT and indicate whether
the fs driver track fid using path names. Also add a private
pointer that help us to track fs driver specific values in there

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 2289be19ae hw/9pfs: Move fid pathname tracking to seperate data type.
This enables us to add handles to track fids later. The
V9fsPath added is similar to V9fsString except that the
size include the NULL byte also.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 02cb7f3a25 hw/9pfs: Use read-write lock for protecting fid path.
On rename we take the write lock and this ensure path
doesn't change as we operate on them.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-09-22 21:38:52 +05:30
Aneesh Kumar K.V 7a46274529 hw/9pfs: Add file descriptor reclaim support
[M. Mohan Kumar <mohan@in.ibm.com> removed some unused variables]

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-25 20:16:41 +05:30
Aneesh Kumar K.V 7eafdcc96c hw/9pfs: Add yield support for preadv coroutine
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:47 +05:30
Aneesh Kumar K.V f6b3c976c6 hw/9pfs: Add yield support for pwritev coroutine
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:37 +05:30
Venkateswararao Jujjuri c6c069b0c5 hw/9pfs: Add yield support for link coroutine
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:33 +05:30
Aneesh Kumar K.V 4743d1f5d3 hw/9pfs: Add yield support for fsync coroutine
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:18 +05:30
Aneesh Kumar K.V bed4352c4f hw/9pfs: Add yeild support for clunk related coroutine
This include lsetxattr, lremovexattr, closedir and close.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:44:13 +05:30
Venkateswararao Jujjuri e4de423214 hw/9pfs: Add yield support for open2 coroutine
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:21:42 +05:30
Aneesh Kumar K.V f6b7f0ab5c hw/9pfs: Add yield support for open and opendir coroutine
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:19:53 +05:30
Aneesh Kumar K.V 03feb1e172 hw/9pfs: Add yeild support for fstat coroutine
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-22 09:14:04 +05:30
Aneesh Kumar K.V 172198d4db hw/9pfs: Add yield support to lstat coroutine
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
2011-08-08 23:42:58 +05:30