diff options
| -rw-r--r-- | fs/nfs/pagelist.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index a12c45b65dd4..29d9d36cd5f4 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
| @@ -112,12 +112,10 @@ void nfs_unlock_request(struct nfs_page *req) | |||
| 112 | */ | 112 | */ |
| 113 | int nfs_set_page_tag_locked(struct nfs_page *req) | 113 | int nfs_set_page_tag_locked(struct nfs_page *req) |
| 114 | { | 114 | { |
| 115 | struct nfs_inode *nfsi = NFS_I(req->wb_context->path.dentry->d_inode); | ||
| 116 | |||
| 117 | if (!nfs_lock_request_dontget(req)) | 115 | if (!nfs_lock_request_dontget(req)) |
| 118 | return 0; | 116 | return 0; |
| 119 | if (req->wb_page != NULL) | 117 | if (req->wb_page != NULL) |
| 120 | radix_tree_tag_set(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); | 118 | radix_tree_tag_set(&NFS_I(req->wb_context->path.dentry->d_inode)->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); |
| 121 | return 1; | 119 | return 1; |
| 122 | } | 120 | } |
| 123 | 121 | ||
| @@ -126,10 +124,10 @@ int nfs_set_page_tag_locked(struct nfs_page *req) | |||
| 126 | */ | 124 | */ |
| 127 | void nfs_clear_page_tag_locked(struct nfs_page *req) | 125 | void nfs_clear_page_tag_locked(struct nfs_page *req) |
| 128 | { | 126 | { |
| 129 | struct inode *inode = req->wb_context->path.dentry->d_inode; | ||
| 130 | struct nfs_inode *nfsi = NFS_I(inode); | ||
| 131 | |||
| 132 | if (req->wb_page != NULL) { | 127 | if (req->wb_page != NULL) { |
| 128 | struct inode *inode = req->wb_context->path.dentry->d_inode; | ||
| 129 | struct nfs_inode *nfsi = NFS_I(inode); | ||
| 130 | |||
| 133 | spin_lock(&inode->i_lock); | 131 | spin_lock(&inode->i_lock); |
| 134 | radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); | 132 | radix_tree_tag_clear(&nfsi->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); |
| 135 | nfs_unlock_request(req); | 133 | nfs_unlock_request(req); |
| @@ -142,16 +140,22 @@ void nfs_clear_page_tag_locked(struct nfs_page *req) | |||
| 142 | * nfs_clear_request - Free up all resources allocated to the request | 140 | * nfs_clear_request - Free up all resources allocated to the request |
| 143 | * @req: | 141 | * @req: |
| 144 | * | 142 | * |
| 145 | * Release page resources associated with a write request after it | 143 | * Release page and open context resources associated with a read/write |
| 146 | * has completed. | 144 | * request after it has completed. |
| 147 | */ | 145 | */ |
| 148 | void nfs_clear_request(struct nfs_page *req) | 146 | void nfs_clear_request(struct nfs_page *req) |
| 149 | { | 147 | { |
| 150 | struct page *page = req->wb_page; | 148 | struct page *page = req->wb_page; |
| 149 | struct nfs_open_context *ctx = req->wb_context; | ||
| 150 | |||
| 151 | if (page != NULL) { | 151 | if (page != NULL) { |
| 152 | page_cache_release(page); | 152 | page_cache_release(page); |
| 153 | req->wb_page = NULL; | 153 | req->wb_page = NULL; |
| 154 | } | 154 | } |
| 155 | if (ctx != NULL) { | ||
| 156 | put_nfs_open_context(ctx); | ||
| 157 | req->wb_context = NULL; | ||
| 158 | } | ||
| 155 | } | 159 | } |
| 156 | 160 | ||
| 157 | 161 | ||
| @@ -165,9 +169,8 @@ static void nfs_free_request(struct kref *kref) | |||
| 165 | { | 169 | { |
| 166 | struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref); | 170 | struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref); |
| 167 | 171 | ||
| 168 | /* Release struct file or cached credential */ | 172 | /* Release struct file and open context */ |
| 169 | nfs_clear_request(req); | 173 | nfs_clear_request(req); |
| 170 | put_nfs_open_context(req->wb_context); | ||
| 171 | nfs_page_free(req); | 174 | nfs_page_free(req); |
| 172 | } | 175 | } |
| 173 | 176 | ||
