aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs3xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs3xdr.c')
-rw-r--r--fs/nfsd/nfs3xdr.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index e695660921ec..6f677988c71d 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -149,6 +149,27 @@ decode_sattr3(__be32 *p, struct iattr *iap)
149 return p; 149 return p;
150} 150}
151 151
152static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
153{
154 u64 f;
155 switch(fsid_source(fhp)) {
156 default:
157 case FSIDSOURCE_DEV:
158 p = xdr_encode_hyper(p, (u64)huge_encode_dev
159 (fhp->fh_dentry->d_inode->i_sb->s_dev));
160 break;
161 case FSIDSOURCE_FSID:
162 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
163 break;
164 case FSIDSOURCE_UUID:
165 f = ((u64*)fhp->fh_export->ex_uuid)[0];
166 f ^= ((u64*)fhp->fh_export->ex_uuid)[1];
167 p = xdr_encode_hyper(p, f);
168 break;
169 }
170 return p;
171}
172
152static __be32 * 173static __be32 *
153encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, 174encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
154 struct kstat *stat) 175 struct kstat *stat)
@@ -169,10 +190,7 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
169 p = xdr_encode_hyper(p, ((u64)stat->blocks) << 9); 190 p = xdr_encode_hyper(p, ((u64)stat->blocks) << 9);
170 *p++ = htonl((u32) MAJOR(stat->rdev)); 191 *p++ = htonl((u32) MAJOR(stat->rdev));
171 *p++ = htonl((u32) MINOR(stat->rdev)); 192 *p++ = htonl((u32) MINOR(stat->rdev));
172 if (is_fsid(fhp, rqstp->rq_reffh)) 193 p = encode_fsid(p, fhp);
173 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
174 else
175 p = xdr_encode_hyper(p, (u64) huge_encode_dev(stat->dev));
176 p = xdr_encode_hyper(p, (u64) stat->ino); 194 p = xdr_encode_hyper(p, (u64) stat->ino);
177 p = encode_time3(p, &stat->atime); 195 p = encode_time3(p, &stat->atime);
178 lease_get_mtime(dentry->d_inode, &time); 196 lease_get_mtime(dentry->d_inode, &time);
@@ -203,10 +221,7 @@ encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
203 p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9); 221 p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9);
204 *p++ = fhp->fh_post_rdev[0]; 222 *p++ = fhp->fh_post_rdev[0];
205 *p++ = fhp->fh_post_rdev[1]; 223 *p++ = fhp->fh_post_rdev[1];
206 if (is_fsid(fhp, rqstp->rq_reffh)) 224 p = encode_fsid(p, fhp);
207 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
208 else
209 p = xdr_encode_hyper(p, (u64)huge_encode_dev(inode->i_sb->s_dev));
210 p = xdr_encode_hyper(p, (u64) inode->i_ino); 225 p = xdr_encode_hyper(p, (u64) inode->i_ino);
211 p = encode_time3(p, &fhp->fh_post_atime); 226 p = encode_time3(p, &fhp->fh_post_atime);
212 p = encode_time3(p, &fhp->fh_post_mtime); 227 p = encode_time3(p, &fhp->fh_post_mtime);