Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1206811
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 2/8] fix the broken lockdep logic in __sb_start_write() |
| Date | 2015-08-13 15:30 +0200 |
| Message-ID | <pX0JY-4yj-5@gated-at.bofh.it> (permalink) |
| References | <pWldM-30G-19@gated-at.bofh.it> <pWldN-30G-53@gated-at.bofh.it> <pWXCr-7m-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 08/13, Jan Kara wrote: > > On Tue 11-08-15 19:04:01, Oleg Nesterov wrote: > > 1. wait_event(frozen < level) without rwsem_acquire_read() is just > > wrong from lockdep perspective. If we are going to deadlock > > because the caller is buggy, lockdep detect this problem. > > > > 2. __sb_start_write() can race with thaw_super() + freeze_super(), > > and after "goto retry" the 2nd acquire_freeze_lock() is wrong. > > > > 3. The "tell lockdep we are doing trylock" hack doesn't look nice. > > > > I think this is correct, but this logic should be more explicit. > > Yes, the recursive read_lock() is fine if we hold the lock on a > > higher level. But we do not need to fool lockdep. If we can not > > deadlock in this case then try-lock must not fail and we can use > > use wait == F throughout this code. > > > > Note: as Dave Chinner explains, the "trylock" hack and the fat comment > > can be probably removed. But this needs a separate change and it will > > be trivial: just kill __sb_start_write() and rename do_sb_start_write() > > back to __sb_start_write(). > > > > Signed-off-by: Oleg Nesterov <oleg@redhat.com> > > Just a nit below... > > > + if (wait) > > + rwsem_acquire_read(&sb->s_writers.lock_map[level-1], 0, 0, ip); > > If we provided also __sb_writers_acquire() helper (in addition to _nowait) > variant, we could use these helpers in __sb_start_write() / > __sb_end_write() as well which would look better to me when we already have > them. Why? This code goes away after 8/8. Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 2/8] fix the broken lockdep logic in __sb_start_write() Oleg Nesterov <oleg@redhat.com> - 2015-08-11 19:10 +0200
Re: [PATCH v2 2/8] fix the broken lockdep logic in __sb_start_write() Jan Kara <jack@suse.cz> - 2015-08-13 12:10 +0200
Re: [PATCH v2 2/8] fix the broken lockdep logic in __sb_start_write() Jan Kara <jack@suse.cz> - 2015-08-13 15:30 +0200
Re: [PATCH v2 2/8] fix the broken lockdep logic in __sb_start_write() Oleg Nesterov <oleg@redhat.com> - 2015-08-13 15:30 +0200
csiph-web