document rwsem_release() in sb_wait_write()
Not only we need to avoid the warning from lockdep_sys_exit(), the caller of freeze_super() can never release this lock. Another thread can do this, so there is another reason for rwsem_release(). Plus the comment should explain why we have to fool lockdep. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reviewed-by: Jan Kara <jack@suse.com>
This commit is contained in:
parent
f4b554af99
commit
0e28e01f1e
1 changed files with 10 additions and 4 deletions
14
fs/super.c
14
fs/super.c
|
@ -1236,11 +1236,17 @@ static void sb_wait_write(struct super_block *sb, int level)
|
|||
{
|
||||
s64 writers;
|
||||
|
||||
/*
|
||||
* We just cycle-through lockdep here so that it does not complain
|
||||
* about returning with lock to userspace
|
||||
*/
|
||||
rwsem_acquire(&sb->s_writers.lock_map[level-1], 0, 0, _THIS_IP_);
|
||||
/*
|
||||
* We are going to return to userspace and forget about this lock, the
|
||||
* ownership goes to the caller of thaw_super() which does unlock.
|
||||
*
|
||||
* FIXME: we should do this before return from freeze_super() after we
|
||||
* called sync_filesystem(sb) and s_op->freeze_fs(sb), and thaw_super()
|
||||
* should re-acquire these locks before s_op->unfreeze_fs(sb). However
|
||||
* this leads to lockdep false-positives, so currently we do the early
|
||||
* release right after acquire.
|
||||
*/
|
||||
rwsem_release(&sb->s_writers.lock_map[level-1], 1, _THIS_IP_);
|
||||
|
||||
do {
|
||||
|
|
Loading…
Reference in a new issue