summaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2015-08-11 10:28:29 -0400
committerOleg Nesterov <oleg@redhat.com>2015-08-15 07:52:09 -0400
commit0e28e01f1e73015d8e1b8fa1cda071d0bd9a2600 (patch)
treeae83a5c9f212e85db4dbd00279880a6ce24f575d /fs/super.c
parentf4b554af9931585174d4913b482eacab75858964 (diff)
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>
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/super.c b/fs/super.c
index 24a76bcd62a5..8aa3cbc571d1 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1236,11 +1236,17 @@ static void sb_wait_write(struct super_block *sb, int level)
1236{ 1236{
1237 s64 writers; 1237 s64 writers;
1238 1238
1239 rwsem_acquire(&sb->s_writers.lock_map[level-1], 0, 0, _THIS_IP_);
1239 /* 1240 /*
1240 * We just cycle-through lockdep here so that it does not complain 1241 * We are going to return to userspace and forget about this lock, the
1241 * about returning with lock to userspace 1242 * ownership goes to the caller of thaw_super() which does unlock.
1243 *
1244 * FIXME: we should do this before return from freeze_super() after we
1245 * called sync_filesystem(sb) and s_op->freeze_fs(sb), and thaw_super()
1246 * should re-acquire these locks before s_op->unfreeze_fs(sb). However
1247 * this leads to lockdep false-positives, so currently we do the early
1248 * release right after acquire.
1242 */ 1249 */
1243 rwsem_acquire(&sb->s_writers.lock_map[level-1], 0, 0, _THIS_IP_);
1244 rwsem_release(&sb->s_writers.lock_map[level-1], 1, _THIS_IP_); 1250 rwsem_release(&sb->s_writers.lock_map[level-1], 1, _THIS_IP_);
1245 1251
1246 do { 1252 do {