summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@fys.uio.no>2005-01-16 03:53:47 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-16 03:53:47 -0800
commite69a5406739ca2d756ff8ceb8353f39ecbdc006b (patch)
treea16ee2b890feb831d5455e8b577b879b1a241a84
parentfa20e5cb932be026074cad124995c2f05803c510 (diff)
[PATCH] Fix an Oopsable condition in the NFS locking
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/nfs/file.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index ee039022cd5c..a6860e1f7bff 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -347,8 +347,10 @@ static int do_unlk(struct file *filp, int cmd, struct file_lock *fl)
static int do_setlk(struct file *filp, int cmd, struct file_lock *fl)
{
struct inode *inode = filp->f_mapping->host;
+ sigset_t oldset;
int status;
+ rpc_clnt_sigmask(NFS_CLIENT(inode), &oldset);
/*
* Flush all pending writes before doing anything
* with locks..
@@ -362,7 +364,7 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl)
status = filemap_fdatawait(filp->f_mapping);
}
if (status < 0)
- return status;
+ goto out;
lock_kernel();
/* Use local locking if mounted with "-onolock" */
@@ -375,12 +377,12 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl)
* the process exits.
*/
if (status == -EINTR || status == -ERESTARTSYS)
- posix_lock_file(filp, fl);
+ posix_lock_file_wait(filp, fl);
} else
status = posix_lock_file_wait(filp, fl);
unlock_kernel();
if (status < 0)
- return status;
+ goto out;
/*
* Make sure we clear the cache whenever we try to get the lock.
* This makes locking act as a cache coherency point.
@@ -391,7 +393,9 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl)
up(&inode->i_sem);
filemap_fdatawait(filp->f_mapping);
nfs_zap_caches(inode);
- return 0;
+out:
+ rpc_clnt_sigunmask(NFS_CLIENT(inode), &oldset);
+ return status;
}
/*