From 2c30dd744aa02d31a8a3b87daaba0b2cb774f346 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Thu, 19 Jan 2012 12:21:11 +0530 Subject: 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 --- hw/9pfs/cofile.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'hw/9pfs/cofile.c') diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c index b15838c1e6..9345aaeb2e 100644 --- a/hw/9pfs/cofile.c +++ b/hw/9pfs/cofile.c @@ -76,6 +76,20 @@ int v9fs_co_fstat(V9fsPDU *pdu, V9fsFidState *fidp, struct stat *stbuf) err = -errno; } }); + /* + * Some FS driver (local:mapped-file) can't support fetching attributes + * using file descriptor. Use Path name in that case. + */ + if (err == -EOPNOTSUPP) { + err = v9fs_co_lstat(pdu, &fidp->path, stbuf); + if (err == -ENOENT) { + /* + * fstat on an unlinked file. Work with partial results + * returned from s->ops->fstat + */ + err = 0; + } + } return err; } -- cgit v1.2.1