summaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-05-16 07:13:17 -0400
committerSteve French <sfrench@us.ibm.com>2012-05-16 20:13:30 -0500
commit2a1bb13853300bbb5a58eab006189d2c0dc215a0 (patch)
treeaac510510cd175bfabd50dd7f3bb5d799ec1fa4a /fs/cifs/file.c
parent6993f74a5bf836210e7f253d5ad3f76d73a95f51 (diff)
downloadlinux-2a1bb13853300bbb5a58eab006189d2c0dc215a0.tar.bz2
cifs: add wrapper for cifs_async_readv to retry opening file
We'll need this same bit of code for the uncached case. Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ae285e0cf67b..d2a4259408e6 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2366,6 +2366,23 @@ cifs_readdata_release(struct kref *refcount)
kfree(rdata);
}
+static int
+cifs_retry_async_readv(struct cifs_readdata *rdata)
+{
+ int rc;
+
+ do {
+ if (rdata->cfile->invalidHandle) {
+ rc = cifs_reopen_file(rdata->cfile, true);
+ if (rc != 0)
+ continue;
+ }
+ rc = cifs_async_readv(rdata);
+ } while (rc == -EAGAIN);
+
+ return rc;
+}
+
static ssize_t
cifs_iovec_read(struct file *file, const struct iovec *iov,
unsigned long nr_segs, loff_t *poffset)
@@ -2852,15 +2869,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
rdata->marshal_iov = cifs_readpages_marshal_iov;
list_splice_init(&tmplist, &rdata->pages);
- do {
- if (open_file->invalidHandle) {
- rc = cifs_reopen_file(open_file, true);
- if (rc != 0)
- continue;
- }
- rc = cifs_async_readv(rdata);
- } while (rc == -EAGAIN);
-
+ rc = cifs_retry_async_readv(rdata);
if (rc != 0) {
list_for_each_entry_safe(page, tpage, &rdata->pages,
lru) {