summaryrefslogtreecommitdiff
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
authorAndy Adamson <andros@netapp.com>2012-06-20 23:03:33 +0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-16 22:37:25 +0400
commit366d50521c57939e61e25dc27f009367447563e6 (patch)
treed69e02a6fad26e4d746710a7b8dd2caa0047efed /fs/nfs/pnfs.c
parentbaf6c2a44af02cf6f7cec1ff177189c78fc30f9a (diff)
downloadlinux-366d50521c57939e61e25dc27f009367447563e6.tar.xz
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.c10
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)
nfs4_stateid stateid;
int status = 0;
- dprintk("--> %s\n", __func__);
+ dprintk("NFS: %s for inode %lu\n", __func__, ino->i_ino);
spin_lock(&ino->i_lock);
lo = nfsi->layout;
- if (!lo) {
+ if (!lo || pnfs_test_layout_returned(lo)) {
spin_unlock(&ino->i_lock);
dprintk("%s: no layout to return\n", __func__);
return status;
@@ -676,6 +676,7 @@ _pnfs_return_layout(struct inode *ino)
get_layout_hdr(lo);
mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
lo->plh_block_lgets++;
+ pnfs_mark_layout_returned(lo);
spin_unlock(&ino->i_lock);
pnfs_free_lseg_list(&tmp_list);
@@ -686,6 +687,7 @@ _pnfs_return_layout(struct inode *ino)
status = -ENOMEM;
set_bit(NFS_LAYOUT_RW_FAILED, &lo->plh_flags);
set_bit(NFS_LAYOUT_RO_FAILED, &lo->plh_flags);
+ pnfs_clear_layout_returned(lo);
put_layout_hdr(lo);
goto out;
}
@@ -1075,6 +1077,10 @@ pnfs_update_layout(struct inode *ino,
get_layout_hdr(lo);
if (list_empty(&lo->plh_segs))
first = true;
+
+ /* Enable LAYOUTRETURNs */
+ pnfs_clear_layout_returned(lo);
+
spin_unlock(&ino->i_lock);
if (first) {
/* The lo must be on the clp list if there is any