From: Oleg Drokin <green@namesys.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] [2.6] reiserfs: fix locking in reiserfs_remount
Date: Wed, 6 Aug 2003 13:38:58 +0400 [thread overview]
Message-ID: <20030806093858.GF14457@namesys.com> (raw)
Hello!
Since reiserfs_remount can be called without BKL held, we better take BKL in there.
Please apply the below patch. It is against 2.6.0-test2
Bye,
Oleg
===== fs/reiserfs/super.c 1.66 vs edited =====
--- 1.66/fs/reiserfs/super.c Sat Jun 21 00:16:06 2003
+++ edited/fs/reiserfs/super.c Tue Aug 5 12:22:10 2003
@@ -761,6 +761,7 @@
if (!reiserfs_parse_options(s, arg, &mount_options, &blocks, NULL))
return -EINVAL;
+ reiserfs_write_lock(s);
handle_attrs(s);
/* Add options that are safe here */
@@ -778,17 +779,22 @@
if(blocks) {
int rc = reiserfs_resize(s, blocks);
- if (rc != 0)
+ if (rc != 0) {
+ reiserfs_write_unlock(s);
return rc;
+ }
}
if (*mount_flags & MS_RDONLY) {
/* remount read-only */
- if (s->s_flags & MS_RDONLY)
+ if (s->s_flags & MS_RDONLY) {
/* it is read-only already */
+ reiserfs_write_unlock(s);
return 0;
+ }
/* try to remount file system with read-only permissions */
if (sb_umount_state(rs) == REISERFS_VALID_FS || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) {
+ reiserfs_write_unlock(s);
return 0;
}
@@ -800,8 +806,10 @@
s->s_dirt = 0;
} else {
/* remount read-write */
- if (!(s->s_flags & MS_RDONLY))
+ if (!(s->s_flags & MS_RDONLY)) {
+ reiserfs_write_unlock(s);
return 0; /* We are read-write already */
+ }
REISERFS_SB(s)->s_mount_state = sb_umount_state(rs) ;
s->s_flags &= ~MS_RDONLY ; /* now it is safe to call journal_begin */
@@ -824,6 +832,7 @@
if (!( *mount_flags & MS_RDONLY ) )
finish_unfinished( s );
+ reiserfs_write_unlock(s);
return 0;
}
next reply other threads:[~2003-08-06 9:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-06 9:38 Oleg Drokin [this message]
2003-08-06 17:28 ` [PATCH] [2.6] reiserfs: fix locking in reiserfs_remount Mike Fedyk
2003-08-06 17:31 ` Oleg Drokin
2003-08-07 13:24 ` Hans Reiser
2003-08-07 13:33 ` Oleg Drokin
2003-08-07 15:24 ` Andrew Morton
2003-08-07 15:27 ` Oleg Drokin
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=20030806093858.GF14457@namesys.com \
--to=green@namesys.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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).