diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2011-02-18 14:46:19 -0500 |
---|---|---|
committer | Nicolas Pitre <nicolas.pitre@linaro.org> | 2011-02-18 14:46:19 -0500 |
commit | c49f87aa34f7fa4850b8838a945475e4062bad61 (patch) | |
tree | e2d8af4d57671aa35798c1ddca503974ba40fff0 /fs/nfs/direct.c | |
parent | a12fc999485eb5d9ecad74554f0baac9688d28e2 (diff) | |
parent | 69ad303ab8321656d6144d13b2444a5595bb6581 (diff) |
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r-- | fs/nfs/direct.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 84d3c8b9020..e0e9d49773b 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -407,15 +407,18 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, pos += vec->iov_len; } + /* + * If no bytes were started, return the error, and let the + * generic layer handle the completion. + */ + if (requested_bytes == 0) { + nfs_direct_req_release(dreq); + return result < 0 ? result : -EIO; + } + if (put_dreq(dreq)) nfs_direct_complete(dreq); - - if (requested_bytes != 0) - return 0; - - if (result < 0) - return result; - return -EIO; + return 0; } static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, @@ -841,15 +844,18 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, pos += vec->iov_len; } + /* + * If no bytes were started, return the error, and let the + * generic layer handle the completion. + */ + if (requested_bytes == 0) { + nfs_direct_req_release(dreq); + return result < 0 ? result : -EIO; + } + if (put_dreq(dreq)) nfs_direct_write_complete(dreq, dreq->inode); - - if (requested_bytes != 0) - return 0; - - if (result < 0) - return result; - return -EIO; + return 0; } static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, |