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


Groups > linux.kernel > #1714378

Re: [PATCH v2] blktrace: Fix potentail deadlock between delete & sysfs ops

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] blktrace: Fix potentail deadlock between delete & sysfs ops
Date 2017-08-17 23:00 +0200
Message-ID <ufA3w-1Eh-29@gated-at.bofh.it> (permalink)
References <ufdqh-3mR-1@gated-at.bofh.it> <uftbH-5uW-3@gated-at.bofh.it> <ufvQd-7mK-5@gated-at.bofh.it> <ufzKa-1uX-11@gated-at.bofh.it> <ufzTQ-1Ak-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 17 Aug 2017 20:41:10 +0000
Bart Van Assche <Bart.VanAssche@wdc.com> wrote:

> On Thu, 2017-08-17 at 16:30 -0400, Steven Rostedt wrote:
> > On Thu, 17 Aug 2017 12:24:39 -0400
> > Waiman Long <longman@redhat.com> wrote:
> >   
> > > On 08/17/2017 09:34 AM, Steven Rostedt wrote:  
> > > > On Wed, 16 Aug 2017 16:40:40 -0400
> > > > Waiman Long <longman@redhat.com> wrote:
> > > >    
> > > > > The lockdep code had reported the following unsafe locking scenario:
> > > > > 
> > > > >        CPU0                    CPU1
> > > > >        ----                    ----
> > > > >   lock(s_active#228);
> > > > >                                lock(&bdev->bd_mutex/1);
> > > > >                                lock(s_active#228);
> > > > >   lock(&bdev->bd_mutex);    
> > > > 
> > > > Can you show the exact locations of these locks. I have no idea where
> > > > this "s_active" is.    
> > > 
> > > The s_active isn't an actual lock. It is a reference count (kn->count)
> > > on the sysfs (kernfs) file. Removal of a sysfs file, however, require
> > > a wait until all the references are gone. The reference count is
> > > treated like a rwsem using lockdep instrumentation code.  
> > 
> > Which kernel is this? I don't see any lockdep annotation around
> > kn->count (doing a git grep, I find it referenced in fs/kernfs/dir.c)  
> 
> As far as I know the s_active lockdep annotations were introduced in 2007
> through commit 0ab66088c855 ("sysfs: implement sysfs_dirent active reference
> and immediate disconnect"). Today these annotations exist in kernfs:
> $ git grep -nHw dep_map fs/kernfs
> fs/kernfs/dir.c:421:		rwsem_acquire_read(&kn->dep_map, 0, 1, _RET_IP_);
> fs/kernfs/dir.c:441:		rwsem_release(&kn->dep_map, 1, _RET_IP_);
> fs/kernfs/dir.c:468:		rwsem_acquire(&kn->dep_map, 0, 0, _RET_IP_);
> fs/kernfs/dir.c:470:			lock_contended(&kn->dep_map, _RET_IP_);
> fs/kernfs/dir.c:478:		lock_acquired(&kn->dep_map, _RET_IP_);
> fs/kernfs/dir.c:479:		rwsem_release(&kn->dep_map, 1, _RET_IP_);
> fs/kernfs/dir.c:1385:		rwsem_acquire(&kn->dep_map, 0, 1, _RET_IP_);
> fs/kernfs/file.c:1000:		lockdep_init_map(&kn->dep_map, "s_active", key, 0);
> 

Ah thanks. I was searching for the wrong thing. :-/

-- Steve

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


Thread

[PATCH v2] blktrace: Fix potentail deadlock between delete & sysfs ops Waiman Long <longman@redhat.com> - 2017-08-16 22:50 +0200
  Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-17 15:40 +0200
    Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-08-17 18:30 +0200
      Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-17 22:40 +0200
        Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Bart Van Assche <Bart.VanAssche@wdc.com> - 2017-08-17 22:50 +0200
          Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-17 23:00 +0200
      Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-17 23:20 +0200
        Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-08-17 23:30 +0200
          Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-18 00:20 +0200
            Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-18 01:30 +0200
              Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-08-18 15:50 +0200
          Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-18 00:20 +0200
        Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-17 23:40 +0200
          Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-08-18 16:00 +0200
            Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Bart Van Assche <Bart.VanAssche@wdc.com> - 2017-08-18 18:30 +0200
              Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Waiman Long <longman@redhat.com> - 2017-08-18 19:30 +0200
              Re: [PATCH v2] blktrace: Fix potentail deadlock between delete &  sysfs ops Steven Rostedt <rostedt@goodmis.org> - 2017-08-18 19:30 +0200

csiph-web