aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4filelayout.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4filelayout.c')
-rw-r--r--fs/nfs/nfs4filelayout.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 53f94d915bd1..52d847212066 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -190,8 +190,6 @@ static int filelayout_async_handle_error(struct rpc_task *task,
190 * i/o and all i/o waiting on the slot table to the MDS until 190 * i/o and all i/o waiting on the slot table to the MDS until
191 * layout is destroyed and a new valid layout is obtained. 191 * layout is destroyed and a new valid layout is obtained.
192 */ 192 */
193 set_bit(NFS_LAYOUT_INVALID,
194 &NFS_I(inode)->layout->plh_flags);
195 pnfs_destroy_layout(NFS_I(inode)); 193 pnfs_destroy_layout(NFS_I(inode));
196 rpc_wake_up(&tbl->slot_tbl_waitq); 194 rpc_wake_up(&tbl->slot_tbl_waitq);
197 goto reset; 195 goto reset;
@@ -205,7 +203,7 @@ static int filelayout_async_handle_error(struct rpc_task *task,
205 case -EPIPE: 203 case -EPIPE:
206 dprintk("%s DS connection error %d\n", __func__, 204 dprintk("%s DS connection error %d\n", __func__,
207 task->tk_status); 205 task->tk_status);
208 filelayout_mark_devid_invalid(devid); 206 nfs4_mark_deviceid_unavailable(devid);
209 clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags); 207 clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(inode)->flags);
210 _pnfs_return_layout(inode); 208 _pnfs_return_layout(inode);
211 rpc_wake_up(&tbl->slot_tbl_waitq); 209 rpc_wake_up(&tbl->slot_tbl_waitq);
@@ -269,6 +267,21 @@ filelayout_set_layoutcommit(struct nfs_write_data *wdata)
269 (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb); 267 (unsigned long) NFS_I(hdr->inode)->layout->plh_lwb);
270} 268}
271 269
270bool
271filelayout_test_devid_unavailable(struct nfs4_deviceid_node *node)
272{
273 return filelayout_test_devid_invalid(node) ||
274 nfs4_test_deviceid_unavailable(node);
275}
276
277static bool
278filelayout_reset_to_mds(struct pnfs_layout_segment *lseg)
279{
280 struct nfs4_deviceid_node *node = FILELAYOUT_DEVID_NODE(lseg);
281
282 return filelayout_test_devid_unavailable(node);
283}
284
272/* 285/*
273 * Call ops for the async read/write cases 286 * Call ops for the async read/write cases
274 * In the case of dense layouts, the offset needs to be reset to its 287 * In the case of dense layouts, the offset needs to be reset to its
@@ -453,7 +466,7 @@ static void filelayout_commit_release(void *calldata)
453 struct nfs_commit_data *data = calldata; 466 struct nfs_commit_data *data = calldata;
454 467
455 data->completion_ops->completion(data); 468 data->completion_ops->completion(data);
456 put_lseg(data->lseg); 469 pnfs_put_lseg(data->lseg);
457 nfs_put_client(data->ds_clp); 470 nfs_put_client(data->ds_clp);
458 nfs_commitdata_release(data); 471 nfs_commitdata_release(data);
459} 472}
@@ -608,13 +621,13 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo,
608 d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode)->pnfs_curr_ld, 621 d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode)->pnfs_curr_ld,
609 NFS_SERVER(lo->plh_inode)->nfs_client, id); 622 NFS_SERVER(lo->plh_inode)->nfs_client, id);
610 if (d == NULL) { 623 if (d == NULL) {
611 dsaddr = get_device_info(lo->plh_inode, id, gfp_flags); 624 dsaddr = filelayout_get_device_info(lo->plh_inode, id, gfp_flags);
612 if (dsaddr == NULL) 625 if (dsaddr == NULL)
613 goto out; 626 goto out;
614 } else 627 } else
615 dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node); 628 dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
616 /* Found deviceid is being reaped */ 629 /* Found deviceid is unavailable */
617 if (test_bit(NFS_DEVICEID_INVALID, &dsaddr->id_node.flags)) 630 if (filelayout_test_devid_unavailable(&dsaddr->id_node))
618 goto out_put; 631 goto out_put;
619 632
620 fl->dsaddr = dsaddr; 633 fl->dsaddr = dsaddr;
@@ -931,7 +944,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
931 nfs_init_cinfo(&cinfo, pgio->pg_inode, pgio->pg_dreq); 944 nfs_init_cinfo(&cinfo, pgio->pg_inode, pgio->pg_dreq);
932 status = filelayout_alloc_commit_info(pgio->pg_lseg, &cinfo, GFP_NOFS); 945 status = filelayout_alloc_commit_info(pgio->pg_lseg, &cinfo, GFP_NOFS);
933 if (status < 0) { 946 if (status < 0) {
934 put_lseg(pgio->pg_lseg); 947 pnfs_put_lseg(pgio->pg_lseg);
935 pgio->pg_lseg = NULL; 948 pgio->pg_lseg = NULL;
936 goto out_mds; 949 goto out_mds;
937 } 950 }
@@ -985,7 +998,7 @@ filelayout_clear_request_commit(struct nfs_page *req,
985out: 998out:
986 nfs_request_remove_commit_list(req, cinfo); 999 nfs_request_remove_commit_list(req, cinfo);
987 spin_unlock(cinfo->lock); 1000 spin_unlock(cinfo->lock);
988 put_lseg(freeme); 1001 pnfs_put_lseg(freeme);
989} 1002}
990 1003
991static struct list_head * 1004static struct list_head *
@@ -1018,7 +1031,7 @@ filelayout_choose_commit_list(struct nfs_page *req,
1018 * off due to a rewrite, in which case it will be done in 1031 * off due to a rewrite, in which case it will be done in
1019 * filelayout_clear_request_commit 1032 * filelayout_clear_request_commit
1020 */ 1033 */
1021 buckets[i].wlseg = get_lseg(lseg); 1034 buckets[i].wlseg = pnfs_get_lseg(lseg);
1022 } 1035 }
1023 set_bit(PG_COMMIT_TO_DS, &req->wb_flags); 1036 set_bit(PG_COMMIT_TO_DS, &req->wb_flags);
1024 cinfo->ds->nwritten++; 1037 cinfo->ds->nwritten++;
@@ -1128,7 +1141,7 @@ filelayout_scan_ds_commit_list(struct pnfs_commit_bucket *bucket,
1128 if (list_empty(src)) 1141 if (list_empty(src))
1129 bucket->wlseg = NULL; 1142 bucket->wlseg = NULL;
1130 else 1143 else
1131 get_lseg(bucket->clseg); 1144 pnfs_get_lseg(bucket->clseg);
1132 } 1145 }
1133 return ret; 1146 return ret;
1134} 1147}
@@ -1159,12 +1172,12 @@ static void filelayout_recover_commit_reqs(struct list_head *dst,
1159 1172
1160 /* NOTE cinfo->lock is NOT held, relying on fact that this is 1173 /* NOTE cinfo->lock is NOT held, relying on fact that this is
1161 * only called on single thread per dreq. 1174 * only called on single thread per dreq.
1162 * Can't take the lock because need to do put_lseg 1175 * Can't take the lock because need to do pnfs_put_lseg
1163 */ 1176 */
1164 for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) { 1177 for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) {
1165 if (transfer_commit_list(&b->written, dst, cinfo, 0)) { 1178 if (transfer_commit_list(&b->written, dst, cinfo, 0)) {
1166 BUG_ON(!list_empty(&b->written)); 1179 BUG_ON(!list_empty(&b->written));
1167 put_lseg(b->wlseg); 1180 pnfs_put_lseg(b->wlseg);
1168 b->wlseg = NULL; 1181 b->wlseg = NULL;
1169 } 1182 }
1170 } 1183 }
@@ -1200,7 +1213,7 @@ alloc_ds_commits(struct nfs_commit_info *cinfo, struct list_head *list)
1200 if (list_empty(&bucket->committing)) 1213 if (list_empty(&bucket->committing))
1201 continue; 1214 continue;
1202 nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo); 1215 nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo);
1203 put_lseg(bucket->clseg); 1216 pnfs_put_lseg(bucket->clseg);
1204 bucket->clseg = NULL; 1217 bucket->clseg = NULL;
1205 } 1218 }
1206 /* Caller will clean up entries put on list */ 1219 /* Caller will clean up entries put on list */