mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
9p: Fix initialisation of netfs_inode for 9p
[ Upstream commit 9546ac78b2 ]
The 9p filesystem is calling netfs_inode_init() in v9fs_init_inode() -
before the struct inode fields have been initialised from the obtained file
stats (ie. after v9fs_stat2inode*() has been called), but netfslib wants to
set a couple of its fields from i_size.
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Marc Dionne <marc.dionne@auristor.com>
Tested-by: Dominique Martinet <asmadeus@codewreck.org>
Acked-by: Dominique Martinet <asmadeus@codewreck.org>
cc: Eric Van Hensbergen <ericvh@kernel.org>
cc: Latchesar Ionkov <lucho@ionkov.net>
cc: Dominique Martinet <asmadeus@codewreck.org>
cc: Christian Schoenebeck <linux_oss@crudebyte.com>
cc: v9fs@lists.linux.dev
cc: linux-cachefs@redhat.com
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
38d437d728
commit
11a93a7383
@@ -42,6 +42,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb);
|
|||||||
void v9fs_free_inode(struct inode *inode);
|
void v9fs_free_inode(struct inode *inode);
|
||||||
struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode,
|
struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode,
|
||||||
dev_t rdev);
|
dev_t rdev);
|
||||||
|
void v9fs_set_netfs_context(struct inode *inode);
|
||||||
int v9fs_init_inode(struct v9fs_session_info *v9ses,
|
int v9fs_init_inode(struct v9fs_session_info *v9ses,
|
||||||
struct inode *inode, umode_t mode, dev_t rdev);
|
struct inode *inode, umode_t mode, dev_t rdev);
|
||||||
void v9fs_evict_inode(struct inode *inode);
|
void v9fs_evict_inode(struct inode *inode);
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ void v9fs_free_inode(struct inode *inode)
|
|||||||
/*
|
/*
|
||||||
* Set parameters for the netfs library
|
* Set parameters for the netfs library
|
||||||
*/
|
*/
|
||||||
static void v9fs_set_netfs_context(struct inode *inode)
|
void v9fs_set_netfs_context(struct inode *inode)
|
||||||
{
|
{
|
||||||
struct v9fs_inode *v9inode = V9FS_I(inode);
|
struct v9fs_inode *v9inode = V9FS_I(inode);
|
||||||
netfs_inode_init(&v9inode->netfs, &v9fs_req_ops);
|
netfs_inode_init(&v9inode->netfs, &v9fs_req_ops);
|
||||||
@@ -326,8 +326,6 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
|
|||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
v9fs_set_netfs_context(inode);
|
|
||||||
error:
|
error:
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -359,6 +357,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev)
|
|||||||
iput(inode);
|
iput(inode);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
v9fs_set_netfs_context(inode);
|
||||||
return inode;
|
return inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,6 +463,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
v9fs_stat2inode(st, inode, sb, 0);
|
v9fs_stat2inode(st, inode, sb, 0);
|
||||||
|
v9fs_set_netfs_context(inode);
|
||||||
v9fs_cache_inode_get_cookie(inode);
|
v9fs_cache_inode_get_cookie(inode);
|
||||||
unlock_new_inode(inode);
|
unlock_new_inode(inode);
|
||||||
return inode;
|
return inode;
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
v9fs_stat2inode_dotl(st, inode, 0);
|
v9fs_stat2inode_dotl(st, inode, 0);
|
||||||
|
v9fs_set_netfs_context(inode);
|
||||||
v9fs_cache_inode_get_cookie(inode);
|
v9fs_cache_inode_get_cookie(inode);
|
||||||
retval = v9fs_get_acl(inode, fid);
|
retval = v9fs_get_acl(inode, fid);
|
||||||
if (retval)
|
if (retval)
|
||||||
|
|||||||
Reference in New Issue
Block a user