summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-06-18 10:45:01 -0400
committerJ. Bruce Fields <bfields@redhat.com>2015-06-22 14:15:04 -0400
commit96bcad506457cfa0c26680446eedefb616c6b079 (patch)
treea1a5b4c1124d23eb5c0dccf58c4e532548fd230d /fs/nfsd/nfs4xdr.c
parentaf90f707fa6d54dbb725c4b919c976cd23cd07f2 (diff)
nfsd: fput rd_file from XDR encode context
Remove the hack where we fput the read-specific file in generic code. Instead we can do it in nfsd4_encode_read as that gets called for all error cases as well. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 3b3b3fbd9319..ca09fec7a4bf 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -33,6 +33,7 @@
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36#include <linux/file.h>
36#include <linux/slab.h> 37#include <linux/slab.h>
37#include <linux/namei.h> 38#include <linux/namei.h>
38#include <linux/statfs.h> 39#include <linux/statfs.h>
@@ -3420,19 +3421,20 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
3420 int starting_len = xdr->buf->len; 3421 int starting_len = xdr->buf->len;
3421 struct raparms *ra = NULL; 3422 struct raparms *ra = NULL;
3422 __be32 *p; 3423 __be32 *p;
3423 __be32 err;
3424 3424
3425 if (nfserr) 3425 if (nfserr)
3426 return nfserr; 3426 goto out;
3427 3427
3428 p = xdr_reserve_space(xdr, 8); /* eof flag and byte count */ 3428 p = xdr_reserve_space(xdr, 8); /* eof flag and byte count */
3429 if (!p) { 3429 if (!p) {
3430 WARN_ON_ONCE(test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)); 3430 WARN_ON_ONCE(test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags));
3431 return nfserr_resource; 3431 nfserr = nfserr_resource;
3432 goto out;
3432 } 3433 }
3433 if (resp->xdr.buf->page_len && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) { 3434 if (resp->xdr.buf->page_len && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) {
3434 WARN_ON_ONCE(1); 3435 WARN_ON_ONCE(1);
3435 return nfserr_resource; 3436 nfserr = nfserr_resource;
3437 goto out;
3436 } 3438 }
3437 xdr_commit_encode(xdr); 3439 xdr_commit_encode(xdr);
3438 3440
@@ -3444,16 +3446,20 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
3444 ra = nfsd_init_raparms(file); 3446 ra = nfsd_init_raparms(file);
3445 3447
3446 if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) 3448 if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags))
3447 err = nfsd4_encode_splice_read(resp, read, file, maxcount); 3449 nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount);
3448 else 3450 else
3449 err = nfsd4_encode_readv(resp, read, file, maxcount); 3451 nfserr = nfsd4_encode_readv(resp, read, file, maxcount);
3450 3452
3451 if (ra) 3453 if (ra)
3452 nfsd_put_raparams(file, ra); 3454 nfsd_put_raparams(file, ra);
3453 3455
3454 if (err) 3456 if (nfserr)
3455 xdr_truncate_encode(xdr, starting_len); 3457 xdr_truncate_encode(xdr, starting_len);
3456 return err; 3458
3459out:
3460 if (file)
3461 fput(file);
3462 return nfserr;
3457} 3463}
3458 3464
3459static __be32 3465static __be32