On Mon 20-07-15 19:01:06, Oleg Nesterov wrote: > Move the "fool the lockdep" code from sb_wait_write() into the new > simple helper, sb_lockdep_release(), called once before return from > freeze_super(). > > This is preparation, but imo this makes sense in any case. This way > we do not hide from lockdep the "write" locks we hold when we call > s_op->freeze_fs(sb). > > Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> Good. You can add: Reviewed-by: Jan Kara <jack@xxxxxxxx> Honza > --- > fs/super.c | 16 ++++++++++------ > 1 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/fs/super.c b/fs/super.c > index d0fdd49..e7ea9f1 100644 > --- a/fs/super.c > +++ b/fs/super.c > @@ -1236,16 +1236,10 @@ 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); > - > /* > * We use a barrier in prepare_to_wait() to separate setting > * of frozen and checking of the counter > @@ -1261,6 +1255,14 @@ static void sb_wait_write(struct super_block *sb, int level) > } while (writers); > } > > +static void sb_freeze_release(struct super_block *sb) > +{ > + int level; > + /* Avoid the warning from lockdep_sys_exit() */ > + for (level = 0; level < SB_FREEZE_LEVELS; ++level) > + rwsem_release(sb->s_writers.lock_map + level, 1, _THIS_IP_); > +} > + > /** > * freeze_super - lock the filesystem and force it into a consistent state > * @sb: the super to lock > @@ -1349,6 +1351,7 @@ int freeze_super(struct super_block *sb) > sb->s_writers.frozen = SB_UNFROZEN; > smp_wmb(); > wake_up(&sb->s_writers.wait_unfrozen); > + sb_freeze_release(sb); > deactivate_locked_super(sb); > return ret; > } > @@ -1358,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_freeze_release(sb); > up_write(&sb->s_umount); > return 0; > } > -- > 1.5.5.1 > -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html