linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 23/26] pNFS: Sync the layout state bits in pnfs_cache_lseg_for_layoutreturn
Date: Thu,  1 Dec 2016 17:19:19 -0500	[thread overview]
Message-ID: <20161201221922.15657-24-trond.myklebust@primarydata.com> (raw)
In-Reply-To: <20161201221922.15657-23-trond.myklebust@primarydata.com>

Ensure that the layout state bits are synced when we cache a layout
segment for layoutreturn using an appropriate call to
pnfs_set_plh_return_info.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/pnfs.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a3a51860563c..08acfa49f115 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -306,6 +306,20 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo)
 }
 
 static void
+pnfs_set_plh_return_info(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode,
+			 u32 seq)
+{
+	if (lo->plh_return_iomode != 0 && lo->plh_return_iomode != iomode)
+		iomode = IOMODE_ANY;
+	lo->plh_return_iomode = iomode;
+	set_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags);
+	if (seq != 0) {
+		WARN_ON_ONCE(lo->plh_return_seq != 0 && lo->plh_return_seq != seq);
+		lo->plh_return_seq = seq;
+	}
+}
+
+static void
 pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo)
 {
 	lo->plh_return_iomode = 0;
@@ -456,6 +470,7 @@ pnfs_cache_lseg_for_layoutreturn(struct pnfs_layout_hdr *lo,
 {
 	if (test_and_clear_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags) &&
 	    pnfs_layout_is_valid(lo)) {
+		pnfs_set_plh_return_info(lo, lseg->pls_range.iomode, 0);
 		list_move_tail(&lseg->pls_list, &lo->plh_return_segs);
 		return true;
 	}
@@ -1001,20 +1016,6 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
 
 }
 
-static void
-pnfs_set_plh_return_info(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode,
-			 u32 seq)
-{
-	if (lo->plh_return_iomode != 0 && lo->plh_return_iomode != iomode)
-		iomode = IOMODE_ANY;
-	lo->plh_return_iomode = iomode;
-	set_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags);
-	if (seq != 0) {
-		WARN_ON_ONCE(lo->plh_return_seq != 0 && lo->plh_return_seq != seq);
-		lo->plh_return_seq = seq;
-	}
-}
-
 static bool
 pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo,
 		nfs4_stateid *stateid,
-- 
2.9.3


  reply	other threads:[~2016-12-01 22:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 22:18 [PATCH 00/26] pNFS updates for v4.10 Trond Myklebust
2016-12-01 22:18 ` [PATCH 01/26] pNFS: Fix a deadlock between read resends and layoutreturn Trond Myklebust
2016-12-01 22:18   ` [PATCH 02/26] pNFS: Don't clear the layout stateid if a layout return is outstanding Trond Myklebust
2016-12-01 22:18     ` [PATCH 03/26] pNFS: Clear NFS_LAYOUT_RETURN_REQUESTED when invalidating the layout stateid Trond Myklebust
2016-12-01 22:19       ` [PATCH 04/26] pNFS: Force a retry of LAYOUTGET if the stateid doesn't match our cache Trond Myklebust
2016-12-01 22:19         ` [PATCH 05/26] pNFS: On error, do not send LAYOUTGET until the LAYOUTRETURN has completed Trond Myklebust
2016-12-01 22:19           ` [PATCH 06/26] pNFS: Fix race in pnfs_wait_on_layoutreturn Trond Myklebust
2016-12-01 22:19             ` [PATCH 07/26] pNFS: consolidate the different range intersection tests Trond Myklebust
2016-12-01 22:19               ` [PATCH 08/26] pNFS: Delay getting the layout header in CB_LAYOUTRECALL handlers Trond Myklebust
2016-12-01 22:19                 ` [PATCH 09/26] pNFS: Do not free layout segments that are marked for return Trond Myklebust
2016-12-01 22:19                   ` [PATCH 10/26] NFSv4: Ignore LAYOUTRETURN result if the layout doesn't match or is invalid Trond Myklebust
2016-12-01 22:19                     ` [PATCH 11/26] pNFS: Remove spurious wake up in pnfs_layout_remove_lseg() Trond Myklebust
2016-12-01 22:19                       ` [PATCH 12/26] pNFS: Skip checking for return-on-close if the layout is invalid Trond Myklebust
2016-12-01 22:19                         ` [PATCH 13/26] pNFS: Get rid of unnecessary layout parameter in encode_layoutreturn callback Trond Myklebust
2016-12-01 22:19                           ` [PATCH 14/26] pNFS: Don't mark layout segments invalid on layoutreturn in pnfs_roc Trond Myklebust
2016-12-01 22:19                             ` [PATCH 15/26] NFSv4: Fix missing operation accounting in NFS4_dec_delegreturn_sz Trond Myklebust
2016-12-01 22:19                               ` [PATCH 16/26] NFSv4: Add encode/decode of the layoutreturn op in CLOSE Trond Myklebust
2016-12-01 22:19                                 ` [PATCH 17/26] NFSv4: Add encode/decode of the layoutreturn op in DELEGRETURN Trond Myklebust
2016-12-01 22:19                                   ` [PATCH 18/26] pNFS: Clean up - add a helper to initialise struct layoutreturn_args Trond Myklebust
2016-12-01 22:19                                     ` [PATCH 19/26] pNFS: Enable layoutreturn operation for return-on-close Trond Myklebust
2016-12-01 22:19                                       ` [PATCH 20/26] pNFS: Prevent unnecessary layoutreturns after delegreturn Trond Myklebust
2016-12-01 22:19                                         ` [PATCH 21/26] pNFS: Clear all layout segment state in pnfs_mark_layout_stateid_invalid Trond Myklebust
2016-12-01 22:19                                           ` [PATCH 22/26] pNFS: Fix bugs in _pnfs_return_layout Trond Myklebust
2016-12-01 22:19                                             ` Trond Myklebust [this message]
2016-12-01 22:19                                               ` [PATCH 24/26] pNFS: Don't mark the layout as freed if the last lseg is marked for return Trond Myklebust
2016-12-01 22:19                                                 ` [PATCH 25/26] pNFS: Wait on outstanding layoutreturns to complete in pnfs_roc() Trond Myklebust
2016-12-01 22:19                                                   ` [PATCH 26/26] pNFS: Skip invalid stateids when doing a bulk destroy Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161201221922.15657-24-trond.myklebust@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).