Commit d585158b authored by Trond Myklebust's avatar Trond Myklebust

NFS: Fix nfs_set_page_dirty()

Be more careful about testing page->mapping.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent dc87c398
...@@ -1531,10 +1531,18 @@ int nfs_wb_page(struct inode *inode, struct page* page) ...@@ -1531,10 +1531,18 @@ int nfs_wb_page(struct inode *inode, struct page* page)
int nfs_set_page_dirty(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; struct nfs_page *req;
int ret; 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); spin_lock(req_lock);
req = nfs_page_find_request_locked(page); req = nfs_page_find_request_locked(page);
if (req != NULL) { if (req != NULL) {
...@@ -1547,6 +1555,8 @@ int nfs_set_page_dirty(struct page *page) ...@@ -1547,6 +1555,8 @@ int nfs_set_page_dirty(struct page *page)
ret = __set_page_dirty_nobuffers(page); ret = __set_page_dirty_nobuffers(page);
spin_unlock(req_lock); spin_unlock(req_lock);
return ret; return ret;
out_raced:
return !TestSetPageDirty(page);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment