stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Andy Adamson <andros@netapp.com>,
	Trond Myklebust <trond.myklebust@primarydata.com>
Subject: [PATCH 3.10 27/43] NFSv4.1: Fix an NFSv4.1 state renewal regression
Date: Tue, 28 Oct 2014 11:36:25 +0800	[thread overview]
Message-ID: <20141028033524.573148666@linuxfoundation.org> (raw)
In-Reply-To: <20141028033523.407092670@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Adamson <andros@netapp.com>

commit d1f456b0b9545f1606a54cd17c20775f159bd2ce upstream.

Commit 2f60ea6b8ced ("NFSv4: The NFSv4.0 client must send RENEW calls if it holds a delegation") set the NFS4_RENEW_TIMEOUT flag in nfs4_renew_state, and does
not put an nfs41_proc_async_sequence call, the NFSv4.1 lease renewal heartbeat
call, on the wire to renew the NFSv4.1 state if the flag was not set.

The NFS4_RENEW_TIMEOUT flag is set when "now" is after the last renewal
(cl_last_renewal) plus the lease time divided by 3. This is arbitrary and
sometimes does the following:

In normal operation, the only way a future state renewal call is put on the
wire is via a call to nfs4_schedule_state_renewal, which schedules a
nfs4_renew_state workqueue task. nfs4_renew_state determines if the
NFS4_RENEW_TIMEOUT should be set, and the calls nfs41_proc_async_sequence,
which only gets sent if the NFS4_RENEW_TIMEOUT flag is set.
Then the nfs41_proc_async_sequence rpc_release function schedules
another state remewal via nfs4_schedule_state_renewal.

Without this change we can get into a state where an application stops
accessing the NFSv4.1 share, state renewal calls stop due to the
NFS4_RENEW_TIMEOUT flag _not_ being set. The only way to recover
from this situation is with a clientid re-establishment, once the application
resumes and the server has timed out the lease and so returns
NFS4ERR_BAD_SESSION on the subsequent SEQUENCE operation.

An example application:
open, lock, write a file.

sleep for 6 * lease (could be less)

ulock, close.

In the above example with NFSv4.1 delegations enabled, without this change,
there are no OP_SEQUENCE state renewal calls during the sleep, and the
clientid is recovered due to lease expiration on the close.

This issue does not occur with NFSv4.1 delegations disabled, nor with
NFSv4.0, with or without delegations enabled.

Signed-off-by: Andy Adamson <andros@netapp.com>
Link: http://lkml.kernel.org/r/1411486536-23401-1-git-send-email-andros@netapp.com
Fixes: 2f60ea6b8ced (NFSv4: The NFSv4.0 client must send RENEW calls...)
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/nfs4proc.c   |    2 +-
 fs/nfs/nfs4renewd.c |   12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6067,7 +6067,7 @@ static int nfs41_proc_async_sequence(str
 	int ret = 0;
 
 	if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0)
-		return 0;
+		return -EAGAIN;
 	task = _nfs41_proc_sequence(clp, cred, false);
 	if (IS_ERR(task))
 		ret = PTR_ERR(task);
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -88,10 +88,18 @@ nfs4_renew_state(struct work_struct *wor
 			}
 			nfs_expire_all_delegations(clp);
 		} else {
+			int ret;
+
 			/* Queue an asynchronous RENEW. */
-			ops->sched_state_renewal(clp, cred, renew_flags);
+			ret = ops->sched_state_renewal(clp, cred, renew_flags);
 			put_rpccred(cred);
-			goto out_exp;
+			switch (ret) {
+			default:
+				goto out_exp;
+			case -EAGAIN:
+			case -ENOMEM:
+				break;
+			}
 		}
 	} else {
 		dprintk("%s: failed to call renewd. Reason: lease not expired \n",



  parent reply	other threads:[~2014-10-28  3:36 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28  3:35 [PATCH 3.10 00/43] 3.10.59-stable review Greg Kroah-Hartman
2014-10-28  3:35 ` [PATCH 3.10 01/43] Btrfs: try not to ENOSPC on log replay Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 02/43] Btrfs: fix build_backref_tree issue with multiple shared blocks Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 03/43] Btrfs: fix race in WAIT_SYNC ioctl Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 04/43] fs: Add a missing permission check to do_umount Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 05/43] kvm: x86: fix stale mmio cache bug Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 06/43] KVM: s390: unintended fallthrough for external call Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 07/43] kvm: dont take vcpu mutex for obviously invalid vcpu ioctls Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 08/43] x86/intel/quark: Switch off CR4.PGE so TLB flush uses CR3 instead Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 09/43] spi: dw-mid: respect 8 bit mode Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 10/43] spi: dw-mid: check that DMA was inited before exit Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 11/43] regmap: debugfs: fix possbile NULL pointer dereference Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 12/43] regmap: fix NULL pointer dereference in _regmap_write/read Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 13/43] be2iscsi: check ip buffer before copying Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 14/43] mptfusion: enable no_write_same for vmware scsi disks Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 15/43] qla2xxx: Use correct offset to req-q-out for reserve calculation Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 16/43] firmware_class: make sure fw requests contain a name Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 17/43] Drivers: hv: vmbus: Cleanup vmbus_post_msg() Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 18/43] Drivers: hv: vmbus: Cleanup vmbus_teardown_gpadl() Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 19/43] Drivers: hv: vmbus: Cleanup vmbus_establish_gpadl() Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 20/43] Drivers: hv: vmbus: Fix a bug in vmbus_open() Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 21/43] m68k: Disable/restore interrupts in hwreg_present()/hwreg_write() Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 22/43] Documentation: lzo: document part of the encoding Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 23/43] Revert "lzo: properly check for overruns" Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 24/43] lzo: check for length overrun in variable length encoding Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 25/43] NFSv4: Fix lock recovery when CREATE_SESSION/SETCLIENTID_CONFIRM fails Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 26/43] NFSv4: fix open/lock state recovery error handling Greg Kroah-Hartman
2014-10-28  3:36 ` Greg Kroah-Hartman [this message]
2014-10-28  3:36 ` [PATCH 3.10 28/43] iwlwifi: Add missing PCI IDs for the 7260 series Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 29/43] PCI: Increase IBM ipr SAS Crocodile BARs to at least system page size Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 30/43] PCI: Generate uppercase hex for modalias interface class Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 31/43] rt2800: correct BBP1_TX_POWER_CTRL mask Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 32/43] Bluetooth: Fix HCI H5 corrupted ack value Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 33/43] Bluetooth: Fix issue with USB suspend in btusb driver Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 34/43] mm: clear __GFP_FS when PF_MEMALLOC_NOIO is set Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 36/43] kernel: add support for gcc 5 Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 37/43] spi: dw-mid: terminate ongoing transfers at exit Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 38/43] arm64: compat: fix compat types affecting struct compat_elf_prpsinfo Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 39/43] ALSA: pcm: use the same dma mmap codepath both for arm and arm64 Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 40/43] ALSA: emu10k1: Fix deadlock in synth voice lookup Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 41/43] ALSA: usb-audio: Add support for Steinberg UR22 USB interface Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 42/43] ARM: at91/PMC: dont forget to write PMC_PCDR register to disable clocks Greg Kroah-Hartman
2014-10-28  3:36 ` [PATCH 3.10 43/43] ecryptfs: avoid to access NULL pointer when write metadata in xattr Greg Kroah-Hartman
2014-10-28  4:43 ` [PATCH 3.10 00/43] 3.10.59-stable review Guenter Roeck
2014-10-28  6:02   ` Greg Kroah-Hartman
2014-10-28 16:16 ` Shuah Khan

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=20141028033524.573148666@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=andros@netapp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /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).