Skip to content

Commit

Permalink
NFS: Ensure that we break out of read/write_schedule_segment on error
Browse files Browse the repository at this point in the history
Currently we do break out of the for() loop, but we also need to
break out of the enclosing do {} while()...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Fred Isaman <iisaman@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Apr 30, 2012
1 parent 68cd6fa commit 71e8cc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static ssize_t nfs_direct_read_schedule_segment(struct nfs_pageio_descriptor *de
pos += req_len;
count -= req_len;
}
} while (count != 0);
} while (count != 0 && result >= 0);

kfree(pagevec);

Expand Down Expand Up @@ -692,6 +692,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d
nfs_release_request(req);
nfs_direct_release_pages(pagevec + i,
npages - i);
break;
}
pgbase = 0;
bytes -= req_len;
Expand All @@ -700,7 +701,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d
pos += req_len;
count -= req_len;
}
} while (count != 0);
} while (count != 0 && result >= 0);

kfree(pagevec);

Expand Down

0 comments on commit 71e8cc0

Please sign in to comment.