Another bug? linux/fs/nfs/write.c

Trond Myklebust (trond.myklebust@fys.uio.no)
Mon, 21 May 2001 15:38:06 +0200


Linus,
The following mail from Matt describes a problem in the NFS
read/write code that can cause a vicious hang. Obvious patch to fix it
is attached...

Cheers,
Trond

>>>>> " " == Matt Chapman <matthewc@cse.unsw.edu.au> writes:

> Trond, Here's another bug which seems to be causing crashes.

> nfs_update_request keeps calling nfs_wait_on_request until the
> request can be locked. Presumably it's relying on
> nfs_wait_on_request to schedule, and hence run rpciod to
> retransmit any lost requests. However, if the fs is mounted
> with the intr option and a signal has arrived, then
> nfs_wait_on_request (ultimately, wait_event_interruptible)
> returns immediately with -ERESTARTSYS, and the loop spins.

> Presumably nfs_update_request needs to check the return value
> of nfs_wait_on_request and return right up the chain on
> -ERESTARTSYS. However, since I don't know this code very well,
> I'd prefer it if you had a look at it and gave some advice.

diff -u --recursive --new-file linux-2.4.5-fixes/fs/nfs/write.c linux-2.4.5-write/fs/nfs/write.c
--- linux-2.4.5-fixes/fs/nfs/write.c Mon May 21 11:34:51 2001
+++ linux-2.4.5-write/fs/nfs/write.c Mon May 21 13:18:47 2001
@@ -863,9 +863,12 @@
req = _nfs_find_request(inode, page);
if (req) {
if (!nfs_lock_request(req)) {
+ int error;
spin_unlock(&nfs_wreq_lock);
- nfs_wait_on_request(req);
+ error = nfs_wait_on_request(req);
nfs_release_request(req);
+ if (error < 0)
+ return ERR_PTR(error);
continue;
}
spin_unlock(&nfs_wreq_lock);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/