[RFC PATCH 0/2] vfs:9p: fix open-unlink-fstat bug

From: Jianyong Wu
Date: Sun Jul 19 2020 - 21:46:36 EST


how to reproduce:
in 9p guest:

struct stat *statbuf;
int fd;

fd = open("tmp", O_RDWR);
unlink("tmp");
fstat(fd, statbuf);

fstat will fail as "tmp" in 9p server side has been removed. 9p server
can't retrieve the file context as the guest has not passed it down.
so we should pass the file info down in 9p guest in getattr op.
it need add a new file member in "struct kstat" as "struct istat" does.

Jianyong Wu (2):
vfs: pass file down when getattr to avoid losing info.
9p: retrieve fid from file if it exists when getattr.

fs/9p/vfs_inode.c | 9 +++++++--
fs/9p/vfs_inode_dotl.c | 9 +++++++--
fs/stat.c | 1 +
include/linux/stat.h | 6 ++++++
4 files changed, 21 insertions(+), 4 deletions(-)

--
2.17.1