Merge branch 'stable/for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / fs / nfsd / nfs3xdr.c
index 39c5eb3ad33ad76be9d92302bf6bfadb308dbab4..e4b2b4322553d05e44d17719f33ab3938b57c0d1 100644 (file)
@@ -146,7 +146,7 @@ static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
        default:
        case FSIDSOURCE_DEV:
                p = xdr_encode_hyper(p, (u64)huge_encode_dev
-                                    (fhp->fh_dentry->d_inode->i_sb->s_dev));
+                                    (d_inode(fhp->fh_dentry)->i_sb->s_dev));
                break;
        case FSIDSOURCE_FSID:
                p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
@@ -203,14 +203,14 @@ static __be32 *
 encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
 {
        struct dentry *dentry = fhp->fh_dentry;
-       if (dentry && dentry->d_inode) {
+       if (dentry && d_really_is_positive(dentry)) {
                __be32 err;
                struct kstat stat;
 
                err = fh_getattr(fhp, &stat);
                if (!err) {
                        *p++ = xdr_one;         /* attributes follow */
-                       lease_get_mtime(dentry->d_inode, &stat.mtime);
+                       lease_get_mtime(d_inode(dentry), &stat.mtime);
                        return encode_fattr3(rqstp, p, fhp, &stat);
                }
        }
@@ -233,7 +233,7 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
 {
        struct dentry   *dentry = fhp->fh_dentry;
 
-       if (dentry && dentry->d_inode && fhp->fh_post_saved) {
+       if (dentry && d_really_is_positive(dentry) && fhp->fh_post_saved) {
                if (fhp->fh_pre_saved) {
                        *p++ = xdr_one;
                        p = xdr_encode_hyper(p, (u64) fhp->fh_pre_size);
@@ -260,11 +260,11 @@ void fill_post_wcc(struct svc_fh *fhp)
                printk("nfsd: inode locked twice during operation.\n");
 
        err = fh_getattr(fhp, &fhp->fh_post_attr);
-       fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version;
+       fhp->fh_post_change = d_inode(fhp->fh_dentry)->i_version;
        if (err) {
                fhp->fh_post_saved = 0;
                /* Grab the ctime anyway - set_change_info might use it */
-               fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime;
+               fhp->fh_post_attr.ctime = d_inode(fhp->fh_dentry)->i_ctime;
        } else
                fhp->fh_post_saved = 1;
 }
@@ -628,7 +628,7 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p,
                                        struct nfsd3_attrstat *resp)
 {
        if (resp->status == 0) {
-               lease_get_mtime(resp->fh.fh_dentry->d_inode,
+               lease_get_mtime(d_inode(resp->fh.fh_dentry),
                                &resp->stat.mtime);
                p = encode_fattr3(rqstp, p, &resp->fh, &resp->stat);
        }
@@ -828,7 +828,7 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
                return rv;
        if (d_mountpoint(dchild))
                goto out;
-       if (!dchild->d_inode)
+       if (d_really_is_negative(dchild))
                goto out;
        rv = fh_compose(fhp, exp, dchild, &cd->fh);
 out: