summaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-04-30 22:17:02 -0700
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-04-30 22:17:02 -0700
commitd585158b608248a6ba8ae75e234672e048d3fde9 (patch)
tree2e3e94f5887346eabc61ac0063b849461f98bd1a /fs/nfs/write.c
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
downloadlinux-stable-d585158b608248a6ba8ae75e234672e048d3fde9.tar.gz
linux-stable-d585158b608248a6ba8ae75e234672e048d3fde9.tar.bz2
linux-stable-d585158b608248a6ba8ae75e234672e048d3fde9.zip
NFS: Fix nfs_set_page_dirty()
Be more careful about testing page->mapping. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 797558941745..8593965a35ef 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1531,10 +1531,18 @@ int nfs_wb_page(struct inode *inode, struct page* page)
int nfs_set_page_dirty(struct page *page)
{
- spinlock_t *req_lock = &NFS_I(page->mapping->host)->req_lock;
+ struct address_space *mapping = page->mapping;
+ struct inode *inode;
+ spinlock_t *req_lock;
struct nfs_page *req;
int ret;
+ if (!mapping)
+ goto out_raced;
+ inode = mapping->host;
+ if (!inode)
+ goto out_raced;
+ req_lock = &NFS_I(inode)->req_lock;
spin_lock(req_lock);
req = nfs_page_find_request_locked(page);
if (req != NULL) {
@@ -1547,6 +1555,8 @@ int nfs_set_page_dirty(struct page *page)
ret = __set_page_dirty_nobuffers(page);
spin_unlock(req_lock);
return ret;
+out_raced:
+ return !TestSetPageDirty(page);
}