Commit 4035c248 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Fix list manipulation snafus in fs/nfs/direct.c

Fix 2 bugs in nfs_direct_write_reschedule:

 - The request needs to be removed from the 'reqs' list before it can
   be added to 'failed'.
 - Fix an infinite loop if the 'failed' list is non-empty.
Reported-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 6b16351a
...@@ -484,6 +484,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) ...@@ -484,6 +484,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
list_for_each_entry_safe(req, tmp, &reqs, wb_list) { list_for_each_entry_safe(req, tmp, &reqs, wb_list) {
if (!nfs_pageio_add_request(&desc, req)) { if (!nfs_pageio_add_request(&desc, req)) {
nfs_list_remove_request(req);
nfs_list_add_request(req, &failed); nfs_list_add_request(req, &failed);
spin_lock(cinfo.lock); spin_lock(cinfo.lock);
dreq->flags = 0; dreq->flags = 0;
...@@ -494,8 +495,11 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) ...@@ -494,8 +495,11 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
} }
nfs_pageio_complete(&desc); nfs_pageio_complete(&desc);
while (!list_empty(&failed)) while (!list_empty(&failed)) {
req = nfs_list_entry(failed.next);
nfs_list_remove_request(req);
nfs_unlock_and_release_request(req); nfs_unlock_and_release_request(req);
}
if (put_dreq(dreq)) if (put_dreq(dreq))
nfs_direct_write_complete(dreq, dreq->inode); nfs_direct_write_complete(dreq, dreq->inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment