From: Frank Sorenson <sorenson@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: dwysocha@redhat.com, lvaz@redhat.com
Subject: [PATCH 2/5] fs/block_dev.c: simplify freeze_bdev() and thaw_bdev() exit handling
Date: Wed, 2 Mar 2016 13:01:56 -0600 [thread overview]
Message-ID: <1456945319-16283-3-git-send-email-sorenson@redhat.com> (raw)
In-Reply-To: <1456945319-16283-1-git-send-email-sorenson@redhat.com>
Change freeze_bdev() and thaw_bdev() to have a common exit
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
fs/block_dev.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 826b164..1207f40 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -237,8 +237,7 @@ struct super_block *freeze_bdev(struct block_device *bdev)
*/
sb = get_super(bdev);
drop_super(sb);
- mutex_unlock(&bdev->bd_fsfreeze_mutex);
- return sb;
+ goto out_unlock;
}
sb = get_active_super(bdev);
@@ -251,12 +250,13 @@ struct super_block *freeze_bdev(struct block_device *bdev)
if (error) {
deactivate_super(sb);
bdev->bd_fsfreeze_count--;
- mutex_unlock(&bdev->bd_fsfreeze_mutex);
- return ERR_PTR(error);
+ sb = ERR_PTR(error);
+ goto out_unlock;
}
deactivate_super(sb);
- out:
+out:
sync_blockdev(bdev);
+out_unlock:
mutex_unlock(&bdev->bd_fsfreeze_mutex);
return sb; /* thaw_bdev releases s->s_umount */
}
@@ -288,14 +288,11 @@ int thaw_bdev(struct block_device *bdev, struct super_block *sb)
error = sb->s_op->thaw_super(sb);
else
error = thaw_super(sb);
- if (error) {
+ if (error)
bdev->bd_fsfreeze_count++;
- mutex_unlock(&bdev->bd_fsfreeze_mutex);
- return error;
- }
out:
mutex_unlock(&bdev->bd_fsfreeze_mutex);
- return 0;
+ return error;
}
EXPORT_SYMBOL(thaw_bdev);
--
1.8.3.1
next prev parent reply other threads:[~2016-03-02 19:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 19:01 [PATCH 0/5] Add trace events for filesystem freeze/thaw events Frank Sorenson
2016-03-02 19:01 ` [PATCH 1/5] fs: simplify freeze_super()/thaw_super() exit handling Frank Sorenson
2016-03-02 20:06 ` Al Viro
2016-03-02 19:01 ` Frank Sorenson [this message]
2016-03-02 19:01 ` [PATCH 3/5] fs: add trace events for freeze_super() and thaw_super() Frank Sorenson
2016-03-02 20:12 ` Al Viro
2016-03-02 19:01 ` [PATCH 4/5] fs/block_dev.c: add trace events for freeze_bdev() and thaw_bdev() Frank Sorenson
2016-03-02 19:01 ` [PATCH 5/5] fs: enable filesystem freeze/thaw events Frank Sorenson
2016-03-02 20:15 ` Al Viro
2016-03-02 21:47 ` [PATCH 0/5] Add trace events for " Al Viro
2016-03-02 22:47 ` Dave Chinner
2016-03-02 23:22 ` Al Viro
2016-03-02 23:52 ` Dave Chinner
2016-03-03 11:18 ` Dave Wysochanski
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=1456945319-16283-3-git-send-email-sorenson@redhat.com \
--to=sorenson@redhat.com \
--cc=dwysocha@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lvaz@redhat.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;
as well as URLs for NNTP newsgroup(s).