mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-20 17:41:09 +00:00
NFS: Fix attribute bitmask in _nfs42_proc_fallocate()
[ Upstream commite99812e138
] We can't use nfs4_fattr_bitmap as a bitmask, because it hasn't been filtered to represent the attributes supported by the server. Instead, let's revert to using server->cache_consistency_bitmask after adding in the missing SPACE_USED attribute. Fixes:913eca1aea
("NFS: Fallocate should use the nfs4_fattr_bitmap") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ce2b470add
commit
a09afbb636
1 changed files with 8 additions and 2 deletions
|
@ -46,11 +46,12 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
|
||||||
{
|
{
|
||||||
struct inode *inode = file_inode(filep);
|
struct inode *inode = file_inode(filep);
|
||||||
struct nfs_server *server = NFS_SERVER(inode);
|
struct nfs_server *server = NFS_SERVER(inode);
|
||||||
|
u32 bitmask[3];
|
||||||
struct nfs42_falloc_args args = {
|
struct nfs42_falloc_args args = {
|
||||||
.falloc_fh = NFS_FH(inode),
|
.falloc_fh = NFS_FH(inode),
|
||||||
.falloc_offset = offset,
|
.falloc_offset = offset,
|
||||||
.falloc_length = len,
|
.falloc_length = len,
|
||||||
.falloc_bitmask = nfs4_fattr_bitmap,
|
.falloc_bitmask = bitmask,
|
||||||
};
|
};
|
||||||
struct nfs42_falloc_res res = {
|
struct nfs42_falloc_res res = {
|
||||||
.falloc_server = server,
|
.falloc_server = server,
|
||||||
|
@ -68,6 +69,10 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(bitmask, server->cache_consistency_bitmask, sizeof(bitmask));
|
||||||
|
if (server->attr_bitmask[1] & FATTR4_WORD1_SPACE_USED)
|
||||||
|
bitmask[1] |= FATTR4_WORD1_SPACE_USED;
|
||||||
|
|
||||||
res.falloc_fattr = nfs_alloc_fattr();
|
res.falloc_fattr = nfs_alloc_fattr();
|
||||||
if (!res.falloc_fattr)
|
if (!res.falloc_fattr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -75,7 +80,8 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
|
||||||
status = nfs4_call_sync(server->client, server, msg,
|
status = nfs4_call_sync(server->client, server, msg,
|
||||||
&args.seq_args, &res.seq_res, 0);
|
&args.seq_args, &res.seq_res, 0);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
status = nfs_post_op_update_inode(inode, res.falloc_fattr);
|
status = nfs_post_op_update_inode_force_wcc(inode,
|
||||||
|
res.falloc_fattr);
|
||||||
|
|
||||||
kfree(res.falloc_fattr);
|
kfree(res.falloc_fattr);
|
||||||
return status;
|
return status;
|
||||||
|
|
Loading…
Reference in a new issue