Skip to content

Commit

Permalink
NFSv4.1: fix zero value filehandle in post open getattr
Browse files Browse the repository at this point in the history
[ Upstream commit 4506f23 ]

Currently, if the OPEN compound experiencing an error and needs to
get the file attributes separately, it will send a stand alone
GETATTR but it would use the filehandle from the results of
the OPEN compound. In case of the CLAIM_FH OPEN, nfs_openres's fh
is zero value. That generate a GETATTR that's sent with a zero
value filehandle, and results in the server returning an error.

Instead, for the CLAIM_FH OPEN, take the filehandle that was used
in the PUTFH of the OPEN compound.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
olgakorn1 authored and gregkh committed Oct 6, 2023
1 parent e9f05ae commit 3608be1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2708,8 +2708,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data,
return status;
}
if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) {
struct nfs_fh *fh = &o_res->fh;

nfs4_sequence_free_slot(&o_res->seq_res);
nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, NULL);
if (o_arg->claim == NFS4_OPEN_CLAIM_FH)
fh = NFS_FH(d_inode(data->dentry));
nfs4_proc_getattr(server, fh, o_res->f_attr, NULL);
}
return 0;
}
Expand Down

0 comments on commit 3608be1

Please sign in to comment.