aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-08-15 18:39:32 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-08-26 18:22:50 -0400
commit75c096f753b273b59f1b9a0745e9e4b5d911a312 (patch)
treee447160f8c299cbdc20718d56c8a995bc17dd381
parente281d8100995133dc65e00b1dec8f84b91b6e8c3 (diff)
nfsd4: it's OK to return nfserr_symlink
The nfsd4 code has a bunch of special exceptions for error returns which map nfserr_symlink to other errors. In fact, the spec makes it clear that nfserr_symlink is to be preferred over less specific errors where possible. The patch that introduced it back in 2.6.4 is "kNFSd: correct symlink related error returns.", which claims that these special exceptions are represent an NFSv4 break from v2/v3 tradition--when in fact the symlink error was introduced with v4. I suspect what happened was pynfs tests were written that were overly faithful to the (known-incomplete) rfc3530 error return lists, and then code was fixed up mindlessly to make the tests pass. Delete these unnecessary exceptions. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4proc.c15
-rw-r--r--fs/nfsd/nfs4state.c6
-rw-r--r--fs/nfsd/nfs4xdr.c4
3 files changed, 2 insertions, 23 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index d784ceb81a62..479ffb185df9 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -488,17 +488,12 @@ static __be32
488nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 488nfsd4_commit(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
489 struct nfsd4_commit *commit) 489 struct nfsd4_commit *commit)
490{ 490{
491 __be32 status;
492
493 u32 *p = (u32 *)commit->co_verf.data; 491 u32 *p = (u32 *)commit->co_verf.data;
494 *p++ = nfssvc_boot.tv_sec; 492 *p++ = nfssvc_boot.tv_sec;
495 *p++ = nfssvc_boot.tv_usec; 493 *p++ = nfssvc_boot.tv_usec;
496 494
497 status = nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset, 495 return nfsd_commit(rqstp, &cstate->current_fh, commit->co_offset,
498 commit->co_count); 496 commit->co_count);
499 if (status == nfserr_symlink)
500 status = nfserr_inval;
501 return status;
502} 497}
503 498
504static __be32 499static __be32
@@ -513,8 +508,6 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
513 508
514 status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, 509 status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR,
515 NFSD_MAY_CREATE); 510 NFSD_MAY_CREATE);
516 if (status == nfserr_symlink)
517 status = nfserr_notdir;
518 if (status) 511 if (status)
519 return status; 512 return status;
520 513
@@ -740,8 +733,6 @@ nfsd4_remove(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
740 return nfserr_grace; 733 return nfserr_grace;
741 status = nfsd_unlink(rqstp, &cstate->current_fh, 0, 734 status = nfsd_unlink(rqstp, &cstate->current_fh, 0,
742 remove->rm_name, remove->rm_namelen); 735 remove->rm_name, remove->rm_namelen);
743 if (status == nfserr_symlink)
744 return nfserr_notdir;
745 if (!status) { 736 if (!status) {
746 fh_unlock(&cstate->current_fh); 737 fh_unlock(&cstate->current_fh);
747 set_change_info(&remove->rm_cinfo, &cstate->current_fh); 738 set_change_info(&remove->rm_cinfo, &cstate->current_fh);
@@ -772,8 +763,6 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
772 (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mode) && 763 (S_ISDIR(cstate->save_fh.fh_dentry->d_inode->i_mode) &&
773 S_ISDIR(cstate->current_fh.fh_dentry->d_inode->i_mode))) 764 S_ISDIR(cstate->current_fh.fh_dentry->d_inode->i_mode)))
774 status = nfserr_exist; 765 status = nfserr_exist;
775 else if (status == nfserr_symlink)
776 status = nfserr_notdir;
777 766
778 if (!status) { 767 if (!status) {
779 set_change_info(&rename->rn_sinfo, &cstate->current_fh); 768 set_change_info(&rename->rn_sinfo, &cstate->current_fh);
@@ -913,8 +902,6 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
913 902
914 write->wr_bytes_written = cnt; 903 write->wr_bytes_written = cnt;
915 904
916 if (status == nfserr_symlink)
917 status = nfserr_inval;
918 return status; 905 return status;
919} 906}
920 907
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 3787ec117400..aa0a36e3b09e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4179,12 +4179,8 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4179 if (!nfsd4_has_session(cstate) && STALE_CLIENTID(&lockt->lt_clientid)) 4179 if (!nfsd4_has_session(cstate) && STALE_CLIENTID(&lockt->lt_clientid))
4180 goto out; 4180 goto out;
4181 4181
4182 if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) { 4182 if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0)))
4183 dprintk("NFSD: nfsd4_lockt: fh_verify() failed!\n");
4184 if (status == nfserr_symlink)
4185 status = nfserr_inval;
4186 goto out; 4183 goto out;
4187 }
4188 4184
4189 inode = cstate->current_fh.fh_dentry->d_inode; 4185 inode = cstate->current_fh.fh_dentry->d_inode;
4190 locks_init_lock(&file_lock); 4186 locks_init_lock(&file_lock);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 51ec1f274501..78c792fb59a8 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2778,8 +2778,6 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
2778 read->rd_offset, resp->rqstp->rq_vec, read->rd_vlen, 2778 read->rd_offset, resp->rqstp->rq_vec, read->rd_vlen,
2779 &maxcount); 2779 &maxcount);
2780 2780
2781 if (nfserr == nfserr_symlink)
2782 nfserr = nfserr_inval;
2783 if (nfserr) 2781 if (nfserr)
2784 return nfserr; 2782 return nfserr;
2785 eof = (read->rd_offset + maxcount >= 2783 eof = (read->rd_offset + maxcount >=
@@ -2905,8 +2903,6 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4
2905 readdir->common.err == nfserr_toosmall && 2903 readdir->common.err == nfserr_toosmall &&
2906 readdir->buffer == page) 2904 readdir->buffer == page)
2907 nfserr = nfserr_toosmall; 2905 nfserr = nfserr_toosmall;
2908 if (nfserr == nfserr_symlink)
2909 nfserr = nfserr_notdir;
2910 if (nfserr) 2906 if (nfserr)
2911 goto err_no_verf; 2907 goto err_no_verf;
2912 2908