}
static inline u32 *
-encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct dentry *dentry)
+encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
{
- struct inode *inode = dentry->d_inode;
+ struct inode *inode = fhp->fh_dentry->d_inode;
*p++ = htonl(nfs3_ftypes[(inode->i_mode & S_IFMT) >> 12]);
*p++ = htonl((u32) inode->i_mode);
p = xdr_encode_hyper(p, ((u64)inode->i_blocks) << 9);
*p++ = htonl((u32) major(inode->i_rdev));
*p++ = htonl((u32) minor(inode->i_rdev));
- p = xdr_encode_hyper(p, (u64) kdev_t_to_nr(inode->i_dev));
+ if (rqstp->rq_reffh->fh_version == 1
+ && rqstp->rq_reffh->fh_fsid_type == 1
+ && (fhp->fh_export->ex_flags & NFSEXP_FSID))
+ p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
+ else
+ p = xdr_encode_hyper(p, (u64) kdev_t_to_nr(inode->i_dev));
p = xdr_encode_hyper(p, (u64) inode->i_ino);
p = encode_time3(p, inode->i_atime);
p = encode_time3(p, lease_get_mtime(inode));
p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9);
*p++ = htonl((u32) major(fhp->fh_post_rdev));
*p++ = htonl((u32) minor(fhp->fh_post_rdev));
- p = xdr_encode_hyper(p, (u64) kdev_t_to_nr(inode->i_dev));
+ if (rqstp->rq_reffh->fh_version == 1
+ && rqstp->rq_reffh->fh_fsid_type == 1
+ && (fhp->fh_export->ex_flags & NFSEXP_FSID))
+ p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
+ else
+ p = xdr_encode_hyper(p, (u64) kdev_t_to_nr(inode->i_dev));
p = xdr_encode_hyper(p, (u64) inode->i_ino);
p = encode_time3(p, fhp->fh_post_atime);
p = encode_time3(p, fhp->fh_post_mtime);
* handle. In this case, no attributes are returned.
*/
static u32 *
-encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct dentry *dentry)
+encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
{
+ struct dentry *dentry = fhp->fh_dentry;
if (dentry && dentry->d_inode != NULL) {
*p++ = xdr_one; /* attributes follow */
- return encode_fattr3(rqstp, p, dentry);
+ return encode_fattr3(rqstp, p, fhp);
}
*p++ = xdr_zero;
return p;
}
/* no pre- or post-attrs */
*p++ = xdr_zero;
- return encode_post_op_attr(rqstp, p, dentry);
+ return encode_post_op_attr(rqstp, p, fhp);
}
/*
struct nfsd3_attrstat *resp)
{
if (resp->status == 0)
- p = encode_fattr3(rqstp, p, resp->fh.fh_dentry);
+ p = encode_fattr3(rqstp, p, &resp->fh);
return xdr_ressize_check(rqstp, p);
}
{
if (resp->status == 0) {
p = encode_fh(p, &resp->fh);
- p = encode_post_op_attr(rqstp, p, resp->fh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->fh);
}
- p = encode_post_op_attr(rqstp, p, resp->dirfh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->dirfh);
return xdr_ressize_check(rqstp, p);
}
nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_accessres *resp)
{
- p = encode_post_op_attr(rqstp, p, resp->fh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->fh);
if (resp->status == 0)
*p++ = htonl(resp->access);
return xdr_ressize_check(rqstp, p);
nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_readlinkres *resp)
{
- p = encode_post_op_attr(rqstp, p, resp->fh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->fh);
if (resp->status == 0) {
*p++ = htonl(resp->len);
p += XDR_QUADLEN(resp->len);
nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_readres *resp)
{
- p = encode_post_op_attr(rqstp, p, resp->fh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->fh);
if (resp->status == 0) {
*p++ = htonl(resp->count);
*p++ = htonl(resp->eof);
if (resp->status == 0) {
*p++ = xdr_one;
p = encode_fh(p, &resp->fh);
- p = encode_post_op_attr(rqstp, p, resp->fh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->fh);
}
p = encode_wcc_data(rqstp, p, &resp->dirfh);
return xdr_ressize_check(rqstp, p);
nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_linkres *resp)
{
- p = encode_post_op_attr(rqstp, p, resp->fh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->fh);
p = encode_wcc_data(rqstp, p, &resp->tfh);
return xdr_ressize_check(rqstp, p);
}
nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_readdirres *resp)
{
- p = encode_post_op_attr(rqstp, p, resp->fh.fh_dentry);
+ p = encode_post_op_attr(rqstp, p, &resp->fh);
if (resp->status == 0) {
/* stupid readdir cookie */
memcpy(p, resp->verf, 8); p += 2;
goto noexec;
if (fh_compose(&fh, exp, dchild, cd->dirfh) != 0 || !dchild->d_inode)
goto noexec;
- p = encode_post_op_attr(cd->rqstp, p, fh.fh_dentry);
+ p = encode_post_op_attr(cd->rqstp, p, &fh);
*p++ = xdr_one; /* yes, a file handle follows */
p = encode_fh(p, &fh);
fh_put(&fh);
}
static inline u32 *
-encode_fattr(struct svc_rqst *rqstp, u32 *p, struct inode *inode)
+encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp)
{
+ struct inode *inode = fhp->fh_dentry->d_inode;
int type = (inode->i_mode & S_IFMT);
*p++ = htonl(nfs_ftypes[type >> 12]);
else
*p++ = htonl(0xffffffff);
*p++ = htonl((u32) inode->i_blocks);
- *p++ = htonl((u32) kdev_t_to_nr(inode->i_dev));
+ if (rqstp->rq_reffh->fh_version == 1
+ && rqstp->rq_reffh->fh_fsid_type == 1
+ && (fhp->fh_export->ex_flags & NFSEXP_FSID))
+ *p++ = htonl((u32) fhp->fh_export->ex_fsid);
+ else
+ *p++ = htonl((u32) kdev_t_to_nr(inode->i_dev));
*p++ = htonl((u32) inode->i_ino);
*p++ = htonl((u32) inode->i_atime);
*p++ = 0;
nfssvc_encode_attrstat(struct svc_rqst *rqstp, u32 *p,
struct nfsd_attrstat *resp)
{
- p = encode_fattr(rqstp, p, resp->fh.fh_dentry->d_inode);
+ p = encode_fattr(rqstp, p, &resp->fh);
return xdr_ressize_check(rqstp, p);
}
struct nfsd_diropres *resp)
{
p = encode_fh(p, &resp->fh);
- p = encode_fattr(rqstp, p, resp->fh.fh_dentry->d_inode);
+ p = encode_fattr(rqstp, p, &resp->fh);
return xdr_ressize_check(rqstp, p);
}
nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p,
struct nfsd_readres *resp)
{
- p = encode_fattr(rqstp, p, resp->fh.fh_dentry->d_inode);
+ p = encode_fattr(rqstp, p, &resp->fh);
*p++ = htonl(resp->count);
p += XDR_QUADLEN(resp->count);