nfsd: set the server_scope during service startup
[linux-block.git] / fs / nfsd / nfs3xdr.c
index 195ab7a0fc89160142e7ee7aeeeabef4808a6864..aae514d40b641aba55d40c4431df41c56331cc5e 100644 (file)
@@ -32,14 +32,14 @@ static u32  nfs3_ftypes[] = {
  * XDR functions for basic NFS types
  */
 static __be32 *
-encode_time3(__be32 *p, struct timespec *time)
+encode_time3(__be32 *p, struct timespec64 *time)
 {
        *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec);
        return p;
 }
 
 static __be32 *
-decode_time3(__be32 *p, struct timespec *time)
+decode_time3(__be32 *p, struct timespec64 *time)
 {
        time->tv_sec = ntohl(*p++);
        time->tv_nsec = ntohl(*p++);
@@ -167,7 +167,6 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
              struct kstat *stat)
 {
        struct user_namespace *userns = nfsd_user_namespace(rqstp);
-       struct timespec ts;
        *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
        *p++ = htonl((u32) (stat->mode & S_IALLUGO));
        *p++ = htonl((u32) stat->nlink);
@@ -183,12 +182,9 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
        *p++ = htonl((u32) MINOR(stat->rdev));
        p = encode_fsid(p, fhp);
        p = xdr_encode_hyper(p, stat->ino);
-       ts = timespec64_to_timespec(stat->atime);
-       p = encode_time3(p, &ts);
-       ts = timespec64_to_timespec(stat->mtime);
-       p = encode_time3(p, &ts);
-       ts = timespec64_to_timespec(stat->ctime);
-       p = encode_time3(p, &ts);
+       p = encode_time3(p, &stat->atime);
+       p = encode_time3(p, &stat->mtime);
+       p = encode_time3(p, &stat->ctime);
 
        return p;
 }
@@ -277,8 +273,8 @@ void fill_pre_wcc(struct svc_fh *fhp)
                stat.size  = inode->i_size;
        }
 
-       fhp->fh_pre_mtime = timespec64_to_timespec(stat.mtime);
-       fhp->fh_pre_ctime = timespec64_to_timespec(stat.ctime);
+       fhp->fh_pre_mtime = stat.mtime;
+       fhp->fh_pre_ctime = stat.ctime;
        fhp->fh_pre_size  = stat.size;
        fhp->fh_pre_change = nfsd4_change_attribute(&stat, inode);
        fhp->fh_pre_saved = true;
@@ -330,7 +326,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p)
        p = decode_sattr3(p, &args->attrs, nfsd_user_namespace(rqstp));
 
        if ((args->check_guard = ntohl(*p++)) != 0) { 
-               struct timespec time; 
+               struct timespec64 time;
                p = decode_time3(p, &time);
                args->guardtime = time.tv_sec;
        }
@@ -751,17 +747,13 @@ int
 nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p)
 {
        struct nfsd3_writeres *resp = rqstp->rq_resp;
-       struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
-       __be32 verf[2];
 
        p = encode_wcc_data(rqstp, p, &resp->fh);
        if (resp->status == 0) {
                *p++ = htonl(resp->count);
                *p++ = htonl(resp->committed);
-               /* unique identifier, y2038 overflow can be ignored */
-               nfsd_copy_boot_verifier(verf, nn);
-               *p++ = verf[0];
-               *p++ = verf[1];
+               *p++ = resp->verf[0];
+               *p++ = resp->verf[1];
        }
        return xdr_ressize_check(rqstp, p);
 }
@@ -1125,16 +1117,12 @@ int
 nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p)
 {
        struct nfsd3_commitres *resp = rqstp->rq_resp;
-       struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
-       __be32 verf[2];
 
        p = encode_wcc_data(rqstp, p, &resp->fh);
        /* Write verifier */
        if (resp->status == 0) {
-               /* unique identifier, y2038 overflow can be ignored */
-               nfsd_copy_boot_verifier(verf, nn);
-               *p++ = verf[0];
-               *p++ = verf[1];
+               *p++ = resp->verf[0];
+               *p++ = resp->verf[1];
        }
        return xdr_ressize_check(rqstp, p);
 }