Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1205285 > unrolled thread
| Started by | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| First post | 2015-08-11 19:10 +0200 |
| Last post | 2015-08-13 12:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 3/8] document rwsem_release() in sb_wait_write() Oleg Nesterov <oleg@redhat.com> - 2015-08-11 19:10 +0200
Re: [PATCH v2 3/8] document rwsem_release() in sb_wait_write() Jan Kara <jack@suse.cz> - 2015-08-13 12:30 +0200
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Date | 2015-08-11 19:10 +0200 |
| Subject | [PATCH v2 3/8] document rwsem_release() in sb_wait_write() |
| Message-ID | <pWldM-30G-17@gated-at.bofh.it> |
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>
---
fs/super.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/super.c b/fs/super.c
index d0fdd49..89b58fb 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1236,11 +1236,17 @@ static void sb_wait_write(struct super_block *sb, int level)
{
s64 writers;
+ rwsem_acquire(&sb->s_writers.lock_map[level-1], 0, 0, _THIS_IP_);
/*
- * We just cycle-through lockdep here so that it does not complain
- * about returning with lock to userspace
+ * 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_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 {
--
1.5.5.1
--
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/
[toc] | [next] | [standalone]
| From | Jan Kara <jack@suse.cz> |
|---|---|
| Date | 2015-08-13 12:30 +0200 |
| Message-ID | <pWXVL-uO-1@gated-at.bofh.it> |
| In reply to | #1205285 |
On Tue 11-08-15 19:04:04, Oleg Nesterov wrote:
> 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>
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.com>
Honza
> ---
> fs/super.c | 12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/fs/super.c b/fs/super.c
> index d0fdd49..89b58fb 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -1236,11 +1236,17 @@ static void sb_wait_write(struct super_block *sb, int level)
> {
> s64 writers;
>
> + rwsem_acquire(&sb->s_writers.lock_map[level-1], 0, 0, _THIS_IP_);
> /*
> - * We just cycle-through lockdep here so that it does not complain
> - * about returning with lock to userspace
> + * 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_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 {
> --
> 1.5.5.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web