mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 11:44:01 +08:00
nfsd4: don't query change attribute in v2/v3 case
inode_query_iversion() has side effects, and there's no point calling it when we're not even going to use it. We check whether we're currently processing a v4 request by checking fh_maxsize, which is arguably a little hacky; we could add a flag to svc_fh instead. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
4b03d99794
commit
942b20dc24
@ -259,11 +259,11 @@ void fill_pre_wcc(struct svc_fh *fhp)
|
|||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct kstat stat;
|
struct kstat stat;
|
||||||
|
bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
|
||||||
__be32 err;
|
__be32 err;
|
||||||
|
|
||||||
if (fhp->fh_pre_saved)
|
if (fhp->fh_pre_saved)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inode = d_inode(fhp->fh_dentry);
|
inode = d_inode(fhp->fh_dentry);
|
||||||
err = fh_getattr(fhp, &stat);
|
err = fh_getattr(fhp, &stat);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -272,11 +272,12 @@ void fill_pre_wcc(struct svc_fh *fhp)
|
|||||||
stat.ctime = inode->i_ctime;
|
stat.ctime = inode->i_ctime;
|
||||||
stat.size = inode->i_size;
|
stat.size = inode->i_size;
|
||||||
}
|
}
|
||||||
|
if (v4)
|
||||||
|
fhp->fh_pre_change = nfsd4_change_attribute(&stat, inode);
|
||||||
|
|
||||||
fhp->fh_pre_mtime = stat.mtime;
|
fhp->fh_pre_mtime = stat.mtime;
|
||||||
fhp->fh_pre_ctime = stat.ctime;
|
fhp->fh_pre_ctime = stat.ctime;
|
||||||
fhp->fh_pre_size = stat.size;
|
fhp->fh_pre_size = stat.size;
|
||||||
fhp->fh_pre_change = nfsd4_change_attribute(&stat, inode);
|
|
||||||
fhp->fh_pre_saved = true;
|
fhp->fh_pre_saved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,6 +286,8 @@ void fill_pre_wcc(struct svc_fh *fhp)
|
|||||||
*/
|
*/
|
||||||
void fill_post_wcc(struct svc_fh *fhp)
|
void fill_post_wcc(struct svc_fh *fhp)
|
||||||
{
|
{
|
||||||
|
bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
|
||||||
|
struct inode *inode = d_inode(fhp->fh_dentry);
|
||||||
__be32 err;
|
__be32 err;
|
||||||
|
|
||||||
if (fhp->fh_post_saved)
|
if (fhp->fh_post_saved)
|
||||||
@ -293,11 +296,12 @@ void fill_post_wcc(struct svc_fh *fhp)
|
|||||||
err = fh_getattr(fhp, &fhp->fh_post_attr);
|
err = fh_getattr(fhp, &fhp->fh_post_attr);
|
||||||
if (err) {
|
if (err) {
|
||||||
fhp->fh_post_saved = false;
|
fhp->fh_post_saved = false;
|
||||||
fhp->fh_post_attr.ctime = d_inode(fhp->fh_dentry)->i_ctime;
|
fhp->fh_post_attr.ctime = inode->i_ctime;
|
||||||
} else
|
} else
|
||||||
fhp->fh_post_saved = true;
|
fhp->fh_post_saved = true;
|
||||||
fhp->fh_post_change = nfsd4_change_attribute(&fhp->fh_post_attr,
|
if (v4)
|
||||||
d_inode(fhp->fh_dentry));
|
fhp->fh_post_change =
|
||||||
|
nfsd4_change_attribute(&fhp->fh_post_attr, inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user