Commit a0fb7913 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: correct symlink related error returns.

From: NeilBrown <neilb@cse.unsw.edu.au>

unlike v2/v3, nfsv4 returns nfserr_inval when attempting to read, write,
commit or test lock a symlink.  nfsv4 does return nfserr_symlink on lookup
and open, so a simple fix in fh_verify() will not work.
parent 237df83a
......@@ -224,11 +224,16 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc
static inline int
nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit)
{
int status;
u32 *p = (u32 *)commit->co_verf.data;
*p++ = nfssvc_boot.tv_sec;
*p++ = nfssvc_boot.tv_usec;
return nfsd_commit(rqstp, current_fh, commit->co_offset, commit->co_count);
status = nfsd_commit(rqstp, current_fh, commit->co_offset, commit->co_count);
if (status == nfserr_symlink)
status = nfserr_inval;
return status;
}
static inline int
......@@ -558,9 +563,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
*p++ = nfssvc_boot.tv_sec;
*p++ = nfssvc_boot.tv_usec;
return (nfsd_write(rqstp, current_fh, write->wr_offset,
status = nfsd_write(rqstp, current_fh, write->wr_offset,
write->wr_vec, write->wr_vlen, write->wr_buflen,
&write->wr_how_written));
&write->wr_how_written);
if (status == nfserr_symlink)
status = nfserr_inval;
return status;
out:
nfs4_unlock_state();
return status;
......
......@@ -1974,6 +1974,8 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0))) {
printk("NFSD: nfsd4_lockt: fh_verify() failed!\n");
if (status == nfserr_symlink)
status = nfserr_inval;
goto out;
}
......
......@@ -2005,6 +2005,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_read
read->rd_offset,
read->rd_iov, read->rd_vlen,
&maxcount);
if (nfserr == nfserr_symlink)
nfserr = nfserr_inval;
if (nfserr)
return nfserr;
eof = (read->rd_offset + maxcount >= read->rd_fhp->fh_dentry->d_inode->i_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment