Skip to contentSkip to conversation

Patch "NFSv4: Recovery of recalled read delegations is broken" has been added to the 4.2-stable tree

PATCH [email protected] 1 participant 1 message Oct 17, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

NFSv4: Recovery of recalled read delegations is broken

to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
nfsv4-recovery-of-recalled-read-delegations-is-broken.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 24311f884189d42d40354a6f38ca218eb9aeb811 Mon Sep 17 00:00:00 2001

From: Trond Myklebust <[email protected]>
Date: Sun, 20 Sep 2015 10:50:17 -0400
Subject: NFSv4: Recovery of recalled read delegations is broken

From: Trond Myklebust <[email protected]>

commit 24311f884189d42d40354a6f38ca218eb9aeb811 upstream.

When a read delegation is being recalled, and we're reclaiming the cached opens, we need to make sure that we only reclaim read-only modes.
A previous attempt to do this, relied on retrieving the delegation type from the nfs4_opendata structure. Unfortunately, as Kinglong pointed out, this field can only be set when performing reboot recovery.

Furthermore, if we call nfs4_open_recover(), then we end up clobbering the state->flags for all modes that we're not recovering...

The fix is to have the delegation recall code pass this information to the recovery call, and then refactor the recovery code so that nfs4_open_delegation_recall() does not need to call nfs4_open_recover().

Fixes 39f897fdbd46 ("NFSv4: When returning a delegation, don't...")
Cc NeilBrown <[email protected]>
---
 fs/nfs/delegation.c |    8 +++--
 fs/nfs/delegation.h |    2 -
 fs/nfs/nfs4proc.c   |   81 ++++++++++++++++++++++++++++++----------------------
 3 files changed, 53 insertions(+), 38 deletions(-)
fs/nfs/delegation.c +5 -3
@@ -113,7 +113,8 @@ out:
 	return status;
 }
 
-static int nfs_delegation_claim_opens(struct inode *inode, const nfs4_stateid *stateid)
+static int nfs_delegation_claim_opens(struct inode *inode,
+		const nfs4_stateid *stateid, fmode_t type)
 {
 	struct nfs_inode *nfsi = NFS_I(inode);
 	struct nfs_open_context *ctx;
@@ -140,7 +141,7 @@ again:
 		/* Block nfs4_proc_unlck */
 		mutex_lock(&sp->so_delegreturn_mutex);
 		seq = raw_seqcount_begin(&sp->so_reclaim_seqcount);
-		err = nfs4_open_delegation_recall(ctx, state, stateid);
+		err = nfs4_open_delegation_recall(ctx, state, stateid, type);
 		if (!err)
 			err = nfs_delegation_claim_locks(ctx, state, stateid);
 		if (!err && read_seqcount_retry(&sp->so_reclaim_seqcount, seq))
@@ -411,7 +412,8 @@ static int nfs_end_delegation_return(str
 	do {
 		if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags))
 			break;
-		err = nfs_delegation_claim_opens(inode, &delegation->stateid);
+		err = nfs_delegation_claim_opens(inode, &delegation->stateid,
+				delegation->type);
 		if (!issync || err != -EAGAIN)
 			break;
 		/*
fs/nfs/delegation.h +1 -1
@@ -54,7 +54,7 @@ void nfs_delegation_reap_unclaimed(struc
 
 /* NFSv4 delegation-related procedures */
 int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid, int issync);
-int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid);
+int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid, fmode_t type);
 int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, const nfs4_stateid *stateid);
 bool nfs4_copy_delegation_stateid(nfs4_stateid *dst, struct inode *inode, fmode_t flags);
 
fs/nfs/nfs4proc.c +47 -34

129 lines not on this page · raw message

Patches currently in stable-queue which might be from [email protected] are

queue-4.2/nfs-fix-pg_test-page-count-calculation.patch queue-4.2/nfs-do-cleanup-before-resetting-pageio-read-write-to-mds.patch queue-4.2/nfs-fix-a-write-performance-regression.patch queue-4.2/nfsv4-recovery-of-recalled-read-delegations-is-broken.patch queue-4.2/nfs-fix-v4.2-seek-on-files-over-2-gigs.patch