linux-kernel.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, Benjamin Coddington <bcodding@redhat.com>,
	Jeff Layton <jlayton@redhat.com>,
	Anna Schumaker <Anna.Schumaker@Netapp.com>
Subject: [PATCH 4.12 11/31] NFSv4.1: Fix a race where CB_NOTIFY_LOCK fails to wake a waiter
Date: Thu,  3 Aug 2017 16:17:41 -0700	[thread overview]
Message-ID: <20170803231737.707358716@linuxfoundation.org> (raw)
In-Reply-To: <20170803231737.202188456@linuxfoundation.org>

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

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

From: Benjamin Coddington <bcodding@redhat.com>

commit b7dbcc0e433f0f61acb89ed9861ec996be4f2b38 upstream.

nfs4_retry_setlk() sets the task's state to TASK_INTERRUPTIBLE within the
same region protected by the wait_queue's lock after checking for a
notification from CB_NOTIFY_LOCK callback.  However, after releasing that
lock, a wakeup for that task may race in before the call to
freezable_schedule_timeout_interruptible() and set TASK_WAKING, then
freezable_schedule_timeout_interruptible() will set the state back to
TASK_INTERRUPTIBLE before the task will sleep.  The result is that the task
will sleep for the entire duration of the timeout.

Since we've already set TASK_INTERRUPTIBLE in the locked section, just use
freezable_schedule_timout() instead.

Fixes: a1d617d8f134 ("nfs: allow blocking locks to be awoken by lock callbacks")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/nfs4proc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6441,7 +6441,7 @@ nfs4_retry_setlk(struct nfs4_state *stat
 		set_current_state(TASK_INTERRUPTIBLE);
 		spin_unlock_irqrestore(&q->lock, flags);
 
-		freezable_schedule_timeout_interruptible(NFS4_LOCK_MAXTIMEOUT);
+		freezable_schedule_timeout(NFS4_LOCK_MAXTIMEOUT);
 	}
 
 	finish_wait(q, &wait);

  parent reply	other threads:[~2017-08-03 23:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03 23:17 [PATCH 4.12 00/31] 4.12.5-stable review Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 01/31] jfs: Dont clear SGID when inheriting ACLs Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 03/31] ALSA: hda - Add missing NVIDIA GPU codec IDs to patch table Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 04/31] ALSA: hda - Add mute led support for HP ProBook 440 G4 Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 05/31] parisc: Prevent TLB speculation on flushed pages on CPUs that only support equivalent aliases Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 06/31] parisc: Extend disabled preemption in copy_user_page Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 07/31] parisc: Suspend lockup detectors before system halt Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 08/31] powerpc/pseries: Fix of_node_put() underflow during reconfig remove Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 09/31] mmc: sunxi: Keep default timing phase settings for new timing mode Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 10/31] NFS: invalidate file size when taking a lock Greg Kroah-Hartman
2017-08-03 23:17 ` Greg Kroah-Hartman [this message]
2017-08-03 23:17 ` [PATCH 4.12 12/31] scripts/dtc: dtx_diff - update include dts paths to match build Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 13/31] crypto: brcm - Fix SHA3-512 algorithm failure Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 14/31] crypto: brcm - remove BCM_PDC_MBOX dependency in Kconfig Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 15/31] crypto: authencesn - Fix digest_null crash Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 16/31] KVM: PPC: Book3S HV: Enable TM before accessing TM registers Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 17/31] KVM: PPC: Book3S HV: Fix host crash on changing HPT size Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 18/31] dm integrity: fix inefficient allocation of journal space Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 19/31] dm integrity: test for corrupted disk format during table load Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 20/31] md: remove idx from struct resync_pages Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 21/31] md/raid1: fix writebehind bio clone Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 22/31] md/raid5: add thread_group worker async_tx_issue_pending_all Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 23/31] drm/vmwgfx: Fix gcc-7.1.1 warning Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 24/31] drm/vmwgfx: Limit max desktop dimensions to 8Kx8K Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 25/31] drm/nouveau/disp/nv50-: bump max chans to 21 Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 26/31] drm/nouveau/bar/gf100: fix access to upper half of BAR2 Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 28/31] isdn/i4l: fix buffer overflow Greg Kroah-Hartman
2017-08-03 23:17 ` [PATCH 4.12 29/31] ipmi/watchdog: fix watchdog timeout set on reboot Greg Kroah-Hartman
2017-08-03 23:18 ` [PATCH 4.12 30/31] dentry name snapshots Greg Kroah-Hartman
2017-08-03 23:18 ` [PATCH 4.12 31/31] mmc: tmio-mmc: fix bad pointer math Greg Kroah-Hartman
2017-08-04  4:53 ` [PATCH 4.12 00/31] 4.12.5-stable review Guenter Roeck
2017-08-04 16:27   ` Greg Kroah-Hartman
2017-08-04 20:55 ` Shuah Khan
2017-08-04 21:46   ` Greg Kroah-Hartman

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=20170803231737.707358716@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=Anna.Schumaker@Netapp.com \
    --cc=bcodding@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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).