Skip to content

Commit

Permalink
NFS: Fix nfs_set_page_dirty()
Browse files Browse the repository at this point in the history
Be more careful about testing page->mapping.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed May 1, 2007
1 parent dc87c39 commit d585158
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}


Expand Down

0 comments on commit d585158

Please sign in to comment.