summaryrefslogtreecommitdiffstats
path: root/fs/nfs/file.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-11-23 02:00:47 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-11-23 02:00:47 +0000
commit06615f62b17d7de6e12d2f5ec6b88cf30af08413 (patch)
tree8766f208847d4876a6db619aebbf54d53b76eb44 /fs/nfs/file.c
parentfa9bdb574f4febb751848a685d9a9017e04e1d53 (diff)
Merge with Linux 2.4.0-test10.
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r--fs/nfs/file.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 21ae090a3..c30fc5062 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -176,11 +176,16 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offse
*/
static int nfs_sync_page(struct page *page)
{
- struct inode *inode = (struct inode *)page->mapping->host;
+ struct address_space *mapping;
+ struct inode *inode;
unsigned long index = page_index(page);
unsigned int rpages, wpages;
int result;
+ mapping = page->mapping;
+ if (!mapping)
+ return 0;
+ inode = (struct inode *)mapping->host;
if (!inode)
return 0;
@@ -281,7 +286,9 @@ nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
* Flush all pending writes before doing anything
* with locks..
*/
+ down(&filp->f_dentry->d_inode->i_sem);
status = nfs_wb_all(inode);
+ up(&filp->f_dentry->d_inode->i_sem);
if (status < 0)
return status;
@@ -296,8 +303,10 @@ nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
*/
out_ok:
if ((cmd == F_SETLK || cmd == F_SETLKW) && fl->fl_type != F_UNLCK) {
+ down(&filp->f_dentry->d_inode->i_sem);
nfs_wb_all(inode); /* we may have slept */
nfs_zap_caches(inode);
+ up(&filp->f_dentry->d_inode->i_sem);
}
return status;
}