aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-05-01 01:17:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-05-01 01:17:02 -0400
commitd585158b608248a6ba8ae75e234672e048d3fde9 (patch)
tree2e3e94f5887346eabc61ac0063b849461f98bd1a /fs
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
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')
-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)
1531 1531
1532int nfs_set_page_dirty(struct page *page) 1532int nfs_set_page_dirty(struct page *page)
1533{ 1533{
1534 spinlock_t *req_lock = &NFS_I(page->mapping->host)->req_lock; 1534 struct address_space *mapping = page->mapping;
1535 struct inode *inode;
1536 spinlock_t *req_lock;
1535 struct nfs_page *req; 1537 struct nfs_page *req;
1536 int ret; 1538 int ret;
1537 1539
1540 if (!mapping)
1541 goto out_raced;
1542 inode = mapping->host;
1543 if (!inode)
1544 goto out_raced;
1545 req_lock = &NFS_I(inode)->req_lock;
1538 spin_lock(req_lock); 1546 spin_lock(req_lock);
1539 req = nfs_page_find_request_locked(page); 1547 req = nfs_page_find_request_locked(page);
1540 if (req != NULL) { 1548 if (req != NULL) {
@@ -1547,6 +1555,8 @@ int nfs_set_page_dirty(struct page *page)
1547 ret = __set_page_dirty_nobuffers(page); 1555 ret = __set_page_dirty_nobuffers(page);
1548 spin_unlock(req_lock); 1556 spin_unlock(req_lock);
1549 return ret; 1557 return ret;
1558out_raced:
1559 return !TestSetPageDirty(page);
1550} 1560}
1551 1561
1552 1562