linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] freezer,NFS: add an unsafe schedule_timeout_interruptable freezable helper for NFS
@ 2019-08-28 12:52 Benjamin Coddington
  2019-08-29 11:02 ` kbuild test robot
  2019-08-29 20:23 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Coddington @ 2019-08-28 12:52 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker, rjw, pavel, len.brown
  Cc: linux-kernel, linux-nfs

After commit 0688e64bc600 ("NFS: Allow signal interruption of NFS4ERR_DELAYed
operations") my NFS client dumps lockdep warnings:

	====================================
	WARNING: dir_create.sh/1911 still has locks held!
	5.3.0-rc6.47364e5cdc #1 Not tainted
	------------------------------------
	1 lock held by dir_create.sh/1911:
	 #0: 000000005345f559 (sb_writers#21){.+.+}, at: mnt_want_write+0x20/0x50

	stack backtrace:
	CPU: 1 PID: 1911 Comm: dir_create.sh Not tainted 5.3.0-rc6.47364e5cdc #1
	Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-2.fc27 04/01/2014
	Call Trace:
	 dump_stack+0x85/0xcb
	 nfs4_handle_exception+0x1df/0x250 [nfsv4]
	 nfs4_do_open+0x38b/0x850 [nfsv4]
	 ? __filemap_fdatawrite_range+0xc1/0x100
	 nfs4_atomic_open+0xe7/0x100 [nfsv4]
	 nfs4_file_open+0x103/0x260 [nfsv4]
	 ? nfs42_remap_file_range+0x220/0x220 [nfsv4]
	 do_dentry_open+0x205/0x3c0
	 path_openat+0x2ba/0xc80
	 do_filp_open+0x9b/0x110
	 ? kvm_sched_clock_read+0x14/0x30
	 ? sched_clock+0x5/0x10
	 ? sched_clock_cpu+0xc/0xc0
	 ? _raw_spin_unlock+0x24/0x30
	 ? do_sys_open+0x1bd/0x260
	 do_sys_open+0x1bd/0x260
	 do_syscall_64+0x75/0x320
	 ? trace_hardirqs_off_thunk+0x1a/0x20
	 entry_SYSCALL_64_after_hwframe+0x49/0xbe
	RIP: 0033:0x7fd49b2535ce

This patch follows prior art in commit 416ad3c9c006 ("freezer: add unsafe
versions of freezable helpers for NFS") to skip lock dependency checks for
NFS.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfs/nfs4proc.c       |  2 +-
 include/linux/freezer.h | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1406858bae6c..b9c46373da25 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -415,7 +415,7 @@ static int nfs4_delay_interruptible(long *timeout)
 {
 	might_sleep();
 
-	freezable_schedule_timeout_interruptible(nfs4_update_delay(timeout));
+	freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
 	if (!signal_pending(current))
 		return 0;
 	return __fatal_signal_pending(current) ? -EINTR :-ERESTARTSYS;
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 21f5aa0b217f..53e66eec837a 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -217,6 +217,16 @@ static inline long freezable_schedule_timeout_killable(long timeout)
 	return __retval;
 }
 
+/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
+static inline long freezable_schedule_timeout_interruptible_unsafe(long timeout)
+{
+	long __retval;
+	freezer_do_not_count();
+	__retval = schedule_timeout_interruptible(timeout);
+	freezer_count_unsafe();
+	return __retval;
+}
+
 /* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */
 static inline long freezable_schedule_timeout_killable_unsafe(long timeout)
 {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] freezer,NFS: add an unsafe schedule_timeout_interruptable freezable helper for NFS
  2019-08-28 12:52 [PATCH] freezer,NFS: add an unsafe schedule_timeout_interruptable freezable helper for NFS Benjamin Coddington
@ 2019-08-29 11:02 ` kbuild test robot
  2019-08-29 15:30   ` Benjamin Coddington
  2019-08-29 20:23 ` kbuild test robot
  1 sibling, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2019-08-29 11:02 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: kbuild-all, trond.myklebust, anna.schumaker, rjw, pavel,
	len.brown, linux-kernel, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 1773 bytes --]

Hi Benjamin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190828]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/freezer-NFS-add-an-unsafe-schedule_timeout_interruptable-freezable-helper-for-NFS/20190829-161623
config: x86_64-randconfig-f004-201934 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   fs/nfs/nfs4proc.c: In function 'nfs4_delay_interruptible':
>> fs/nfs/nfs4proc.c:418:2: error: implicit declaration of function 'freezable_schedule_timeout_interruptible_unsafe'; did you mean 'freezable_schedule_timeout_interruptible'? [-Werror=implicit-function-declaration]
     freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     freezable_schedule_timeout_interruptible
   cc1: some warnings being treated as errors

vim +418 fs/nfs/nfs4proc.c

   413	
   414	static int nfs4_delay_interruptible(long *timeout)
   415	{
   416		might_sleep();
   417	
 > 418		freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
   419		if (!signal_pending(current))
   420			return 0;
   421		return __fatal_signal_pending(current) ? -EINTR :-ERESTARTSYS;
   422	}
   423	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28713 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] freezer,NFS: add an unsafe schedule_timeout_interruptable freezable helper for NFS
  2019-08-29 11:02 ` kbuild test robot
@ 2019-08-29 15:30   ` Benjamin Coddington
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Coddington @ 2019-08-29 15:30 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, trond.myklebust, anna.schumaker, rjw, pavel,
	len.brown, linux-kernel, linux-nfs

Thanks robot!

I'll send a v2 that works with !CONFIG_FREEZER.

Ben

On 29 Aug 2019, at 7:02, kbuild test robot wrote:

> Hi Benjamin,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on linus/master]
> [cannot apply to v5.3-rc6 next-20190828]
> [if your patch is applied to the wrong git tree, please drop us a note 
> to help improve the system]
>
> url:    
> https://github.com/0day-ci/linux/commits/Benjamin-Coddington/freezer-NFS-add-an-unsafe-schedule_timeout_interruptable-freezable-helper-for-NFS/20190829-161623
> config: x86_64-randconfig-f004-201934 (attached as .config)
> compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All errors (new ones prefixed by >>):
>
>    fs/nfs/nfs4proc.c: In function 'nfs4_delay_interruptible':
>>> fs/nfs/nfs4proc.c:418:2: error: implicit declaration of function 
>>> 'freezable_schedule_timeout_interruptible_unsafe'; did you mean 
>>> 'freezable_schedule_timeout_interruptible'? 
>>> [-Werror=implicit-function-declaration]
>      freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      freezable_schedule_timeout_interruptible
>    cc1: some warnings being treated as errors
>
> vim +418 fs/nfs/nfs4proc.c
>
>    413	
>    414	static int nfs4_delay_interruptible(long *timeout)
>    415	{
>    416		might_sleep();
>    417	
>> 418		freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
>    419		if (!signal_pending(current))
>    420			return 0;
>    421		return __fatal_signal_pending(current) ? -EINTR :-ERESTARTSYS;
>    422	}
>    423	
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology 
> Center
> https://lists.01.org/pipermail/kbuild-all                   Intel 
> Corporation

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] freezer,NFS: add an unsafe schedule_timeout_interruptable freezable helper for NFS
  2019-08-28 12:52 [PATCH] freezer,NFS: add an unsafe schedule_timeout_interruptable freezable helper for NFS Benjamin Coddington
  2019-08-29 11:02 ` kbuild test robot
@ 2019-08-29 20:23 ` kbuild test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2019-08-29 20:23 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: kbuild-all, trond.myklebust, anna.schumaker, rjw, pavel,
	len.brown, linux-kernel, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 8720 bytes --]

Hi Benjamin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190829]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/freezer-NFS-add-an-unsafe-schedule_timeout_interruptable-freezable-helper-for-NFS/20190829-161623
config: i386-randconfig-a002-201934 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.2-10+deb8u1) 4.9.2
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   fs/nfs/nfs4proc.c: In function 'nfs4_delay_interruptible':
>> fs/nfs/nfs4proc.c:418:2: error: implicit declaration of function 'freezable_schedule_timeout_interruptible_unsafe' [-Werror=implicit-function-declaration]
     freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
     ^
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
   Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:arch_set_bit
   Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:arch_clear_bit
   Cyclomatic Complexity 2 arch/x86/include/asm/bitops.h:arch_test_and_clear_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:variable_test_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/asm-generic/bitops-instrumented.h:set_bit
   Cyclomatic Complexity 1 include/asm-generic/bitops-instrumented.h:clear_bit
   Cyclomatic Complexity 1 include/asm-generic/bitops-instrumented.h:test_and_clear_bit
   Cyclomatic Complexity 2 include/asm-generic/bitops-instrumented.h:test_bit
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 1 arch/x86/include/asm/current.h:get_current
   Cyclomatic Complexity 68 include/asm-generic/getorder.h:get_order
   Cyclomatic Complexity 2 arch/x86/include/asm/jump_label.h:arch_static_branch
   Cyclomatic Complexity 1 include/linux/jump_label.h:static_key_false
   Cyclomatic Complexity 1 include/linux/cpumask.h:cpu_max_bits_warn
   Cyclomatic Complexity 1 include/linux/cpumask.h:cpumask_check
   Cyclomatic Complexity 1 include/linux/cpumask.h:cpumask_test_cpu
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_set
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_inc
   Cyclomatic Complexity 2 arch/x86/include/asm/atomic.h:arch_atomic_dec_and_test
   Cyclomatic Complexity 2 arch/x86/include/asm/atomic.h:arch_atomic_try_cmpxchg
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic64_32.h:arch_atomic64_set
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic64_32.h:arch_atomic64_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_set
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_inc
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_try_cmpxchg
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_dec_and_test
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic64_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic64_set
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 1 include/linux/err.h:ERR_CAST
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:native_save_fl
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:native_restore_fl
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:native_irq_disable
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_local_save_flags
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_local_irq_restore
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_local_irq_disable
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_local_irq_save
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_irqs_disabled_flags
   Cyclomatic Complexity 1 arch/x86/include/asm/processor.h:rep_nop
   Cyclomatic Complexity 1 arch/x86/include/asm/processor.h:cpu_relax
   Cyclomatic Complexity 1 include/linux/thread_info.h:test_ti_thread_flag
   Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_add
   Cyclomatic Complexity 5 arch/x86/include/asm/preempt.h:__preempt_count_sub
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_lock
   Cyclomatic Complexity 1 include/linux/spinlock.h:spin_unlock
   Cyclomatic Complexity 2 include/linux/seqlock.h:seqcount_lockdep_reader_access
   Cyclomatic Complexity 2 include/linux/seqlock.h:__read_seqcount_begin
   Cyclomatic Complexity 1 include/linux/seqlock.h:raw_read_seqcount_begin
   Cyclomatic Complexity 1 include/linux/seqlock.h:read_seqcount_begin
   Cyclomatic Complexity 1 include/linux/seqlock.h:raw_seqcount_begin
   Cyclomatic Complexity 1 include/linux/seqlock.h:__read_seqcount_retry
   Cyclomatic Complexity 1 include/linux/seqlock.h:read_seqcount_retry
   Cyclomatic Complexity 1 include/linux/seqlock.h:raw_write_seqcount_begin
   Cyclomatic Complexity 1 include/linux/seqlock.h:raw_write_seqcount_end
   Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqcount_begin_nested
   Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqcount_begin
   Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqcount_end
   Cyclomatic Complexity 1 include/linux/seqlock.h:write_seqlock
   Cyclomatic Complexity 1 include/linux/seqlock.h:write_sequnlock
   Cyclomatic Complexity 1 include/linux/rcupdate.h:__rcu_read_lock
   Cyclomatic Complexity 1 include/linux/rcupdate.h:__rcu_read_unlock
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_lock_acquire
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_lock_release
   Cyclomatic Complexity 4 include/linux/rcupdate.h:rcu_read_lock
   Cyclomatic Complexity 4 include/linux/rcupdate.h:rcu_read_unlock
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_read_lock_sched_notrace
   Cyclomatic Complexity 1 include/linux/rcupdate.h:rcu_read_unlock_sched_notrace
   Cyclomatic Complexity 1 include/linux/ktime.h:ktime_to_ns
   Cyclomatic Complexity 2 include/linux/page-flags.h:compound_head
   Cyclomatic Complexity 1 include/linux/gfp.h:alloc_pages
   Cyclomatic Complexity 2 include/linux/page_ref.h:page_ref_dec_and_test
   Cyclomatic Complexity 1 include/linux/refcount.h:refcount_set
   Cyclomatic Complexity 1 include/linux/refcount.h:refcount_read
   Cyclomatic Complexity 1 arch/x86/include/asm/refcount.h:refcount_inc
   Cyclomatic Complexity 3 arch/x86/include/asm/refcount.h:refcount_dec_and_test
   Cyclomatic Complexity 5 arch/x86/include/asm/refcount.h:refcount_add_not_zero
   Cyclomatic Complexity 1 arch/x86/include/asm/refcount.h:refcount_inc_not_zero
   Cyclomatic Complexity 1 arch/x86/include/asm/signal.h:__const_sigismember
   Cyclomatic Complexity 1 include/linux/sched.h:task_thread_info
   Cyclomatic Complexity 1 include/linux/sched.h:test_tsk_thread_flag
   Cyclomatic Complexity 2 include/linux/dcache.h:dget
   Cyclomatic Complexity 1 include/linux/dcache.h:d_really_is_negative
   Cyclomatic Complexity 1 include/linux/dcache.h:d_really_is_positive
   Cyclomatic Complexity 1 include/linux/dcache.h:d_inode
   Cyclomatic Complexity 2 include/linux/fs.h:i_size_read
   Cyclomatic Complexity 1 include/linux/fs.h:file_inode
   Cyclomatic Complexity 1 include/linux/mm.h:put_page_testzero
   Cyclomatic Complexity 1 include/linux/mm.h:put_devmap_managed_page

vim +/freezable_schedule_timeout_interruptible_unsafe +418 fs/nfs/nfs4proc.c

   413	
   414	static int nfs4_delay_interruptible(long *timeout)
   415	{
   416		might_sleep();
   417	
 > 418		freezable_schedule_timeout_interruptible_unsafe(nfs4_update_delay(timeout));
   419		if (!signal_pending(current))
   420			return 0;
   421		return __fatal_signal_pending(current) ? -EINTR :-ERESTARTSYS;
   422	}
   423	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29420 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-29 20:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28 12:52 [PATCH] freezer,NFS: add an unsafe schedule_timeout_interruptable freezable helper for NFS Benjamin Coddington
2019-08-29 11:02 ` kbuild test robot
2019-08-29 15:30   ` Benjamin Coddington
2019-08-29 20:23 ` kbuild test robot

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