diff options
Diffstat (limited to 'fs/nfsd/nfs3xdr.c')
-rw-r--r-- | fs/nfsd/nfs3xdr.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 08c6e36ab2eb..43f46cd9edea 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, | |||
803 | return p; | 803 | return p; |
804 | } | 804 | } |
805 | 805 | ||
806 | static int | 806 | static __be32 |
807 | compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | 807 | compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, |
808 | const char *name, int namlen) | 808 | const char *name, int namlen) |
809 | { | 809 | { |
810 | struct svc_export *exp; | 810 | struct svc_export *exp; |
811 | struct dentry *dparent, *dchild; | 811 | struct dentry *dparent, *dchild; |
812 | int rv = 0; | 812 | __be32 rv = nfserr_noent; |
813 | 813 | ||
814 | dparent = cd->fh.fh_dentry; | 814 | dparent = cd->fh.fh_dentry; |
815 | exp = cd->fh.fh_export; | 815 | exp = cd->fh.fh_export; |
@@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, | |||
817 | if (isdotent(name, namlen)) { | 817 | if (isdotent(name, namlen)) { |
818 | if (namlen == 2) { | 818 | if (namlen == 2) { |
819 | dchild = dget_parent(dparent); | 819 | dchild = dget_parent(dparent); |
820 | if (dchild == dparent) { | 820 | /* filesystem root - cannot return filehandle for ".." */ |
821 | /* filesystem root - cannot return filehandle for ".." */ | 821 | if (dchild == dparent) |
822 | dput(dchild); | 822 | goto out; |
823 | return -ENOENT; | ||
824 | } | ||
825 | } else | 823 | } else |
826 | dchild = dget(dparent); | 824 | dchild = dget(dparent); |
827 | } else | 825 | } else |
828 | dchild = lookup_one_len(name, dparent, namlen); | 826 | dchild = lookup_one_len(name, dparent, namlen); |
829 | if (IS_ERR(dchild)) | 827 | if (IS_ERR(dchild)) |
830 | return -ENOENT; | 828 | return rv; |
831 | rv = -ENOENT; | ||
832 | if (d_mountpoint(dchild)) | 829 | if (d_mountpoint(dchild)) |
833 | goto out; | 830 | goto out; |
834 | rv = fh_compose(fhp, exp, dchild, &cd->fh); | ||
835 | if (rv) | ||
836 | goto out; | ||
837 | if (!dchild->d_inode) | 831 | if (!dchild->d_inode) |
838 | goto out; | 832 | goto out; |
839 | rv = 0; | 833 | rv = fh_compose(fhp, exp, dchild, &cd->fh); |
840 | out: | 834 | out: |
841 | dput(dchild); | 835 | dput(dchild); |
842 | return rv; | 836 | return rv; |
@@ -845,7 +839,7 @@ out: | |||
845 | static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) | 839 | static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) |
846 | { | 840 | { |
847 | struct svc_fh fh; | 841 | struct svc_fh fh; |
848 | int err; | 842 | __be32 err; |
849 | 843 | ||
850 | fh_init(&fh, NFS3_FHSIZE); | 844 | fh_init(&fh, NFS3_FHSIZE); |
851 | err = compose_entry_fh(cd, &fh, name, namlen); | 845 | err = compose_entry_fh(cd, &fh, name, namlen); |