Commit 2a1aa489 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by J. Bruce Fields

nfsd: pass a 64-bit guardtime to nfsd_setattr()

Guardtime handling in nfs3 differs between 32-bit and 64-bit
architectures, and uses the deprecated time_t type.

Change it to using time64_t, which behaves the same way on
64-bit and 32-bit architectures, treating the number as an
unsigned 32-bit entity with a range of year 1970 to 2106
consistently, and avoiding the y2038 overflow.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 9cc76801
...@@ -984,7 +984,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -984,7 +984,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
if (status) if (status)
goto out; goto out;
status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr, status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr,
0, (time_t)0); 0, (time64_t)0);
out: out:
fh_drop_write(&cstate->current_fh); fh_drop_write(&cstate->current_fh);
return status; return status;
......
...@@ -4721,7 +4721,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, ...@@ -4721,7 +4721,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh,
return 0; return 0;
if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) if (!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
return nfserr_inval; return nfserr_inval;
return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0); return nfsd_setattr(rqstp, fh, &iattr, 0, (time64_t)0);
} }
static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp, static __be32 nfs4_get_vfs_file(struct svc_rqst *rqstp, struct nfs4_file *fp,
......
...@@ -113,7 +113,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp) ...@@ -113,7 +113,7 @@ nfsd_proc_setattr(struct svc_rqst *rqstp)
} }
} }
nfserr = nfsd_setattr(rqstp, fhp, iap, 0, (time_t)0); nfserr = nfsd_setattr(rqstp, fhp, iap, 0, (time64_t)0);
done: done:
return nfsd_return_attrs(nfserr, resp); return nfsd_return_attrs(nfserr, resp);
} }
...@@ -380,7 +380,7 @@ nfsd_proc_create(struct svc_rqst *rqstp) ...@@ -380,7 +380,7 @@ nfsd_proc_create(struct svc_rqst *rqstp)
*/ */
attr->ia_valid &= ATTR_SIZE; attr->ia_valid &= ATTR_SIZE;
if (attr->ia_valid) if (attr->ia_valid)
nfserr = nfsd_setattr(rqstp, newfhp, attr, 0, (time_t)0); nfserr = nfsd_setattr(rqstp, newfhp, attr, 0, (time64_t)0);
} }
out_unlock: out_unlock:
......
...@@ -364,7 +364,7 @@ nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -364,7 +364,7 @@ nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,
*/ */
__be32 __be32
nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
int check_guard, time_t guardtime) int check_guard, time64_t guardtime)
{ {
struct dentry *dentry; struct dentry *dentry;
struct inode *inode; struct inode *inode;
...@@ -1133,7 +1133,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp, ...@@ -1133,7 +1133,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *resfhp,
if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID))
iap->ia_valid &= ~(ATTR_UID|ATTR_GID); iap->ia_valid &= ~(ATTR_UID|ATTR_GID);
if (iap->ia_valid) if (iap->ia_valid)
return nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); return nfsd_setattr(rqstp, resfhp, iap, 0, (time64_t)0);
/* Callers expect file metadata to be committed here */ /* Callers expect file metadata to be committed here */
return nfserrno(commit_metadata(resfhp)); return nfserrno(commit_metadata(resfhp));
} }
......
...@@ -48,7 +48,7 @@ __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, ...@@ -48,7 +48,7 @@ __be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *,
const char *, unsigned int, const char *, unsigned int,
struct svc_export **, struct dentry **); struct svc_export **, struct dentry **);
__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, __be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
struct iattr *, int, time_t); struct iattr *, int, time64_t);
int nfsd_mountpoint(struct dentry *, struct svc_export *); int nfsd_mountpoint(struct dentry *, struct svc_export *);
#ifdef CONFIG_NFSD_V4 #ifdef CONFIG_NFSD_V4
__be32 nfsd4_set_nfs4_label(struct svc_rqst *, struct svc_fh *, __be32 nfsd4_set_nfs4_label(struct svc_rqst *, struct svc_fh *,
......
...@@ -14,7 +14,7 @@ struct nfsd3_sattrargs { ...@@ -14,7 +14,7 @@ struct nfsd3_sattrargs {
struct svc_fh fh; struct svc_fh fh;
struct iattr attrs; struct iattr attrs;
int check_guard; int check_guard;
time_t guardtime; time64_t guardtime;
}; };
struct nfsd3_diropargs { struct nfsd3_diropargs {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment