From: Oleg Nesterov <oleg@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: jack@suse.cz, xfs@oss.sgi.com
Subject: Re: [PATCH 0/2] xfs: kill lockdep false positives from readdir
Date: Wed, 12 Aug 2015 13:43:47 +0200 [thread overview]
Message-ID: <20150812114347.GB3712@redhat.com> (raw)
In-Reply-To: <1439330648-1057-1-git-send-email-david@fromorbit.com>
forgot to show the patch, sorry for double posting...
On 08/12, Dave Chinner wrote:
>
> Oleg and Jan, this patchset should fix the lockdep issues that have
> been seen with the freeze rework. Oleg, can you you try it with your
> current patchset and testing and let me know if there are any issues
> that you see?
Tested-by: Oleg Nesterov <oleg@redhat.com>
To clarify, I tested these patches with
[PATCH v2 0/8] change sb_writers to use percpu_rw_semaphore
I sent yesterday first. Then I applied the additional patch (attached
below) which just restores the lockdep improvements from v1, everything
looks fine:
Ran: generic/068 generic/085 generic/280 generic/311 xfs/011 xfs/119 xfs/297
Passed all 7 tests
nothing interesting in dmesg.
Thanks Dave!
Oleg.
--- a/fs/super.c
+++ b/fs/super.c
@@ -1215,25 +1215,31 @@ EXPORT_SYMBOL(__sb_start_write);
static void sb_wait_write(struct super_block *sb, int level)
{
percpu_down_write(sb->s_writers.rw_sem + level-1);
- /*
- * 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.
- */
- percpu_rwsem_release(sb->s_writers.rw_sem + level-1, 0, _THIS_IP_);
}
-static void sb_freeze_unlock(struct super_block *sb)
+/*
+ * We are going to return to userspace and forget about these locks, the
+ * ownership goes to the caller of thaw_super()->sb_freeze_acquire().
+ */
+static void sb_freeze_release(struct super_block *sb)
+{
+ int level;
+
+ for (level = SB_FREEZE_LEVELS; --level >= 0; )
+ percpu_rwsem_release(sb->s_writers.rw_sem + level, 0, _THIS_IP_);
+}
+
+static void sb_freeze_acquire(struct super_block *sb)
{
int level;
for (level = 0; level < SB_FREEZE_LEVELS; ++level)
percpu_rwsem_acquire(sb->s_writers.rw_sem + level, 0, _THIS_IP_);
+}
+
+static void sb_freeze_unlock(struct super_block *sb)
+{
+ int level;
for (level = SB_FREEZE_LEVELS; --level >= 0; )
percpu_up_write(sb->s_writers.rw_sem + level);
@@ -1329,6 +1335,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;
}
@@ -1355,11 +1362,14 @@ int thaw_super(struct super_block *sb)
goto out;
}
+ sb_freeze_acquire(sb);
+
if (sb->s_op->unfreeze_fs) {
error = sb->s_op->unfreeze_fs(sb);
if (error) {
printk(KERN_ERR
"VFS:Filesystem thaw failed\n");
+ sb_freeze_release(sb);
up_write(&sb->s_umount);
return error;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2015-08-12 11:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 22:04 [PATCH 0/2] xfs: kill lockdep false positives from readdir Dave Chinner
2015-08-11 22:04 ` [PATCH 1/2] xfs: clean up inode lockdep annotations Dave Chinner
2015-08-14 19:41 ` Brian Foster
2015-08-11 22:04 ` [PATCH 2/2] xfs: stop holding ILOCK over filldir callbacks Dave Chinner
2015-08-14 19:41 ` Brian Foster
2015-08-14 22:39 ` Dave Chinner
2015-08-15 13:01 ` Brian Foster
2015-08-15 22:56 ` Dave Chinner
2015-08-12 11:42 ` [PATCH 0/2] xfs: kill lockdep false positives from readdir Oleg Nesterov
2015-08-12 11:43 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150812114347.GB3712@redhat.com \
--to=oleg@redhat.com \
--cc=david@fromorbit.com \
--cc=jack@suse.cz \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox