diff options
author | Andy Adamson <andros@netapp.com> | 2012-06-20 15:03:33 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-07-16 14:37:25 -0400 |
commit | 366d50521c57939e61e25dc27f009367447563e6 (patch) | |
tree | d69e02a6fad26e4d746710a7b8dd2caa0047efed /fs/nfs/pnfs.c | |
parent | baf6c2a44af02cf6f7cec1ff177189c78fc30f9a (diff) |
NFSv4.1 mark layout when already returned
When the file layout driver is fencing a DS, _pnfs_return_layout can be
called mulitple times per inode due to in-flight i/o referencing lsegs on it's
plh_segs list.
Remember that LAYOUTRETURN has been called, and do not call it again.
Allow LAYOUTRETURNs after a subsequent LAYOUTGET.
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 2617831afd39..3ad768f2cef4 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -662,11 +662,11 @@ _pnfs_return_layout(struct inode *ino) | |||
662 | nfs4_stateid stateid; | 662 | nfs4_stateid stateid; |
663 | int status = 0; | 663 | int status = 0; |
664 | 664 | ||
665 | dprintk("--> %s\n", __func__); | 665 | dprintk("NFS: %s for inode %lu\n", __func__, ino->i_ino); |
666 | 666 | ||
667 | spin_lock(&ino->i_lock); | 667 | spin_lock(&ino->i_lock); |
668 | lo = nfsi->layout; | 668 | lo = nfsi->layout; |
669 | if (!lo) { | 669 | if (!lo || pnfs_test_layout_returned(lo)) { |
670 | spin_unlock(&ino->i_lock); | 670 | spin_unlock(&ino->i_lock); |
671 | dprintk("%s: no layout to return\n", __func__); | 671 | dprintk("%s: no layout to return\n", __func__); |
672 | return status; | 672 | return status; |
@@ -676,6 +676,7 @@ _pnfs_return_layout(struct inode *ino) | |||
676 | get_layout_hdr(lo); | 676 | get_layout_hdr(lo); |
677 | mark_matching_lsegs_invalid(lo, &tmp_list, NULL); | 677 | mark_matching_lsegs_invalid(lo, &tmp_list, NULL); |
678 | lo->plh_block_lgets++; | 678 | lo->plh_block_lgets++; |
679 | pnfs_mark_layout_returned(lo); | ||
679 | spin_unlock(&ino->i_lock); | 680 | spin_unlock(&ino->i_lock); |
680 | pnfs_free_lseg_list(&tmp_list); | 681 | pnfs_free_lseg_list(&tmp_list); |
681 | 682 | ||
@@ -686,6 +687,7 @@ _pnfs_return_layout(struct inode *ino) | |||
686 | status = -ENOMEM; | 687 | status = -ENOMEM; |
687 | set_bit(NFS_LAYOUT_RW_FAILED, &lo->plh_flags); | 688 | set_bit(NFS_LAYOUT_RW_FAILED, &lo->plh_flags); |
688 | set_bit(NFS_LAYOUT_RO_FAILED, &lo->plh_flags); | 689 | set_bit(NFS_LAYOUT_RO_FAILED, &lo->plh_flags); |
690 | pnfs_clear_layout_returned(lo); | ||
689 | put_layout_hdr(lo); | 691 | put_layout_hdr(lo); |
690 | goto out; | 692 | goto out; |
691 | } | 693 | } |
@@ -1075,6 +1077,10 @@ pnfs_update_layout(struct inode *ino, | |||
1075 | get_layout_hdr(lo); | 1077 | get_layout_hdr(lo); |
1076 | if (list_empty(&lo->plh_segs)) | 1078 | if (list_empty(&lo->plh_segs)) |
1077 | first = true; | 1079 | first = true; |
1080 | |||
1081 | /* Enable LAYOUTRETURNs */ | ||
1082 | pnfs_clear_layout_returned(lo); | ||
1083 | |||
1078 | spin_unlock(&ino->i_lock); | 1084 | spin_unlock(&ino->i_lock); |
1079 | if (first) { | 1085 | if (first) { |
1080 | /* The lo must be on the clp list if there is any | 1086 | /* The lo must be on the clp list if there is any |