Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1703537

[PATCH 4.12 11/31] NFSv4.1: Fix a race where CB_NOTIFY_LOCK fails to wake a waiter

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.12 11/31] NFSv4.1: Fix a race where CB_NOTIFY_LOCK fails to wake a waiter
Date 2017-08-04 01:30 +0200
Message-ID <uaxJ2-76G-63@gated-at.bofh.it> (permalink)
References <uaxzk-72m-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.12 00/31] 4.12.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 13/31] crypto: brcm - Fix SHA3-512 algorithm failure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 15/31] crypto: authencesn - Fix digest_null crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 14/31] crypto: brcm - remove BCM_PDC_MBOX dependency in Kconfig Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 05/31] parisc: Prevent TLB speculation on flushed pages on CPUs that only support equivalent aliases Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 26/31] drm/nouveau/bar/gf100: fix access to upper half of BAR2 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 08/31] powerpc/pseries: Fix of_node_put() underflow during reconfig remove Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 19/31] dm integrity: test for corrupted disk format during table load Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 28/31] isdn/i4l: fix buffer overflow Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 01/31] jfs: Dont clear SGID when inheriting ACLs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 04/31] ALSA: hda - Add mute led support for HP ProBook 440 G4 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 18/31] dm integrity: fix inefficient allocation of journal space Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 24/31] drm/vmwgfx: Limit max desktop dimensions to 8Kx8K Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 07/31] parisc: Suspend lockup detectors before system halt Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 22/31] md/raid5: add thread_group worker async_tx_issue_pending_all Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 17/31] KVM: PPC: Book3S HV: Fix host crash on changing HPT size Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 23/31] drm/vmwgfx: Fix gcc-7.1.1 warning Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 06/31] parisc: Extend disabled preemption in copy_user_page Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  [PATCH 4.12 11/31] NFSv4.1: Fix a race where CB_NOTIFY_LOCK fails to wake a waiter Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 01:30 +0200
  Re: [PATCH 4.12 00/31] 4.12.5-stable review Guenter Roeck <linux@roeck-us.net> - 2017-08-04 07:00 +0200
    Re: [PATCH 4.12 00/31] 4.12.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 18:30 +0200
  Re: [PATCH 4.12 00/31] 4.12.5-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-08-04 23:00 +0200
    Re: [PATCH 4.12 00/31] 4.12.5-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-04 23:50 +0200

csiph-web