diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-05-16 07:13:17 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2012-05-16 21:13:30 -0400 |
commit | 2a1bb13853300bbb5a58eab006189d2c0dc215a0 (patch) | |
tree | aac510510cd175bfabd50dd7f3bb5d799ec1fa4a /fs | |
parent | 6993f74a5bf836210e7f253d5ad3f76d73a95f51 (diff) |
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')
-rw-r--r-- | fs/cifs/file.c | 27 |
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) | |||
2366 | kfree(rdata); | 2366 | kfree(rdata); |
2367 | } | 2367 | } |
2368 | 2368 | ||
2369 | static int | ||
2370 | cifs_retry_async_readv(struct cifs_readdata *rdata) | ||
2371 | { | ||
2372 | int rc; | ||
2373 | |||
2374 | do { | ||
2375 | if (rdata->cfile->invalidHandle) { | ||
2376 | rc = cifs_reopen_file(rdata->cfile, true); | ||
2377 | if (rc != 0) | ||
2378 | continue; | ||
2379 | } | ||
2380 | rc = cifs_async_readv(rdata); | ||
2381 | } while (rc == -EAGAIN); | ||
2382 | |||
2383 | return rc; | ||
2384 | } | ||
2385 | |||
2369 | static ssize_t | 2386 | static ssize_t |
2370 | cifs_iovec_read(struct file *file, const struct iovec *iov, | 2387 | cifs_iovec_read(struct file *file, const struct iovec *iov, |
2371 | unsigned long nr_segs, loff_t *poffset) | 2388 | unsigned long nr_segs, loff_t *poffset) |
@@ -2852,15 +2869,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
2852 | rdata->marshal_iov = cifs_readpages_marshal_iov; | 2869 | rdata->marshal_iov = cifs_readpages_marshal_iov; |
2853 | list_splice_init(&tmplist, &rdata->pages); | 2870 | list_splice_init(&tmplist, &rdata->pages); |
2854 | 2871 | ||
2855 | do { | 2872 | rc = cifs_retry_async_readv(rdata); |
2856 | if (open_file->invalidHandle) { | ||
2857 | rc = cifs_reopen_file(open_file, true); | ||
2858 | if (rc != 0) | ||
2859 | continue; | ||
2860 | } | ||
2861 | rc = cifs_async_readv(rdata); | ||
2862 | } while (rc == -EAGAIN); | ||
2863 | |||
2864 | if (rc != 0) { | 2873 | if (rc != 0) { |
2865 | list_for_each_entry_safe(page, tpage, &rdata->pages, | 2874 | list_for_each_entry_safe(page, tpage, &rdata->pages, |
2866 | lru) { | 2875 | lru) { |