Messages in this thread Patch in this message | | | Date | Mon, 13 Jul 2015 23:25:55 +0200 | From | Oleg Nesterov <> | Subject | [PATCH 3/4] introduce sb_lockdep_release() |
| |
Move the "fool the lockdep" code from sb_wait_write() into the new simple helper, sb_lockdep_release().
This makes sense in any case afaics, this way s_op->freeze_fs(sb) is called with these write locks held as it seen by lockdep. --- fs/super.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/fs/super.c b/fs/super.c index c23bafc..94303fc 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1229,12 +1229,7 @@ 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_); - rwsem_release(&sb->s_writers.lock_map[level-1], 1, _THIS_IP_); do { DEFINE_WAIT(wait); @@ -1254,6 +1249,16 @@ static void sb_wait_write(struct super_block *sb, int level) } while (writers); } +/* Avoid the warning from lockdep_sys_exit() */ +static void sb_lockdep_release(struct super_block *sb) +{ + int level; + + for (level = 0; level < SB_FREEZE_LEVELS; ++level) { + rwsem_release(&sb->s_writers.lock_map[level-1], 1, _THIS_IP_); + } +} + static void sb_unlock_frozen(struct super_block *sb) { smp_wmb(); @@ -1356,6 +1361,7 @@ int freeze_super(struct super_block *sb) * sees write activity when frozen is set to SB_FREEZE_COMPLETE. */ sb->s_writers.frozen = SB_FREEZE_COMPLETE; + sb_lockdep_release(sb); up_write(&sb->s_umount); return 0; } -- 1.5.5.1
| |