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>
This commit is contained in:
parent
6993f74a5b
commit
2a1bb13853
@ -2366,6 +2366,23 @@ cifs_readdata_release(struct kref *refcount)
|
|||||||
kfree(rdata);
|
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
|
static ssize_t
|
||||||
cifs_iovec_read(struct file *file, const struct iovec *iov,
|
cifs_iovec_read(struct file *file, const struct iovec *iov,
|
||||||
unsigned long nr_segs, loff_t *poffset)
|
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;
|
rdata->marshal_iov = cifs_readpages_marshal_iov;
|
||||||
list_splice_init(&tmplist, &rdata->pages);
|
list_splice_init(&tmplist, &rdata->pages);
|
||||||
|
|
||||||
do {
|
rc = cifs_retry_async_readv(rdata);
|
||||||
if (open_file->invalidHandle) {
|
|
||||||
rc = cifs_reopen_file(open_file, true);
|
|
||||||
if (rc != 0)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
rc = cifs_async_readv(rdata);
|
|
||||||
} while (rc == -EAGAIN);
|
|
||||||
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
list_for_each_entry_safe(page, tpage, &rdata->pages,
|
list_for_each_entry_safe(page, tpage, &rdata->pages,
|
||||||
lru) {
|
lru) {
|
||||||
|
Loading…
Reference in New Issue
Block a user