diff options
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r-- | fs/nfs/write.c | 12 |
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 | ||
1532 | int nfs_set_page_dirty(struct page *page) | 1532 | int 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; |
1558 | out_raced: | ||
1559 | return !TestSetPageDirty(page); | ||
1550 | } | 1560 | } |
1551 | 1561 | ||
1552 | 1562 | ||