diff options
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 2357ee343f4a..20436a5e76cd 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -321,10 +321,12 @@ lo_seg_intersecting(struct pnfs_layout_range *l1, | |||
321 | } | 321 | } |
322 | 322 | ||
323 | static bool | 323 | static bool |
324 | should_free_lseg(u32 lseg_iomode, u32 recall_iomode) | 324 | should_free_lseg(struct pnfs_layout_range *lseg_range, |
325 | struct pnfs_layout_range *recall_range) | ||
325 | { | 326 | { |
326 | return (recall_iomode == IOMODE_ANY || | 327 | return (recall_range->iomode == IOMODE_ANY || |
327 | lseg_iomode == recall_iomode); | 328 | lseg_range->iomode == recall_range->iomode) && |
329 | lo_seg_intersecting(lseg_range, recall_range); | ||
328 | } | 330 | } |
329 | 331 | ||
330 | /* Returns 1 if lseg is removed from list, 0 otherwise */ | 332 | /* Returns 1 if lseg is removed from list, 0 otherwise */ |
@@ -355,7 +357,7 @@ static int mark_lseg_invalid(struct pnfs_layout_segment *lseg, | |||
355 | int | 357 | int |
356 | mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, | 358 | mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, |
357 | struct list_head *tmp_list, | 359 | struct list_head *tmp_list, |
358 | u32 iomode) | 360 | struct pnfs_layout_range *recall_range) |
359 | { | 361 | { |
360 | struct pnfs_layout_segment *lseg, *next; | 362 | struct pnfs_layout_segment *lseg, *next; |
361 | int invalid = 0, removed = 0; | 363 | int invalid = 0, removed = 0; |
@@ -368,7 +370,8 @@ mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo, | |||
368 | return 0; | 370 | return 0; |
369 | } | 371 | } |
370 | list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) | 372 | list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) |
371 | if (should_free_lseg(lseg->pls_range.iomode, iomode)) { | 373 | if (!recall_range || |
374 | should_free_lseg(&lseg->pls_range, recall_range)) { | ||
372 | dprintk("%s: freeing lseg %p iomode %d " | 375 | dprintk("%s: freeing lseg %p iomode %d " |
373 | "offset %llu length %llu\n", __func__, | 376 | "offset %llu length %llu\n", __func__, |
374 | lseg, lseg->pls_range.iomode, lseg->pls_range.offset, | 377 | lseg, lseg->pls_range.iomode, lseg->pls_range.offset, |
@@ -417,7 +420,7 @@ pnfs_destroy_layout(struct nfs_inode *nfsi) | |||
417 | lo = nfsi->layout; | 420 | lo = nfsi->layout; |
418 | if (lo) { | 421 | if (lo) { |
419 | lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */ | 422 | lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */ |
420 | mark_matching_lsegs_invalid(lo, &tmp_list, IOMODE_ANY); | 423 | mark_matching_lsegs_invalid(lo, &tmp_list, NULL); |
421 | } | 424 | } |
422 | spin_unlock(&nfsi->vfs_inode.i_lock); | 425 | spin_unlock(&nfsi->vfs_inode.i_lock); |
423 | pnfs_free_lseg_list(&tmp_list); | 426 | pnfs_free_lseg_list(&tmp_list); |