From: Jan Kara <jack@suse.cz>
To: reiserfs-devel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Jan Kara <"jack@suse.cz>,
stable"@vger.kernel.org#>,
=@suse.cz, 3.0@suse.cz
Subject: [PATCH 2/4] reiserfs: Protect reiserfs_quota_on() with write lock
Date: Fri, 16 Nov 2012 12:33:38 +0100 [thread overview]
Message-ID: <1353065620-27279-3-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1353065620-27279-1-git-send-email-jack@suse.cz>
In reiserfs_quota_on() we do quite some work - for example unpacking
tail of a quota file. Thus we have to hold write lock until a moment
we call back into the quota code.
CC: stable@vger.kernel.org # >= 3.0
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/reiserfs/super.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 5372980..e59d6dd 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2216,8 +2216,11 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
struct reiserfs_transaction_handle th;
int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA;
- if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt)))
- return -EINVAL;
+ reiserfs_write_lock(sb);
+ if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) {
+ err = -EINVAL;
+ goto out;
+ }
/* Quotafile not on the same filesystem? */
if (path->dentry->d_sb != sb) {
@@ -2259,8 +2262,10 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
if (err)
goto out;
}
- err = dquot_quota_on(sb, type, format_id, path);
+ reiserfs_write_unlock(sb);
+ return dquot_quota_on(sb, type, format_id, path);
out:
+ reiserfs_write_unlock(sb);
return err;
}
--
1.7.1
next prev parent reply other threads:[~2012-11-16 11:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-16 11:33 [PATCH 0/4] Fix reiserfs deadlocks with quotas Jan Kara
2012-11-16 11:33 ` [PATCH 1/4] reiserfs: Fix lock ordering during remount Jan Kara
2012-11-16 11:33 ` Jan Kara [this message]
2012-11-16 11:33 ` [PATCH 3/4] reiserfs: Protect reiserfs_quota_write() with write lock Jan Kara
2012-11-16 11:33 ` [PATCH 4/4] reiserfs: Move quota calls out of " Jan Kara
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=1353065620-27279-3-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc="jack@suse.cz>, stable"@vger.kernel.org# \
--cc=3.0@suse.cz \
--cc==@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=reiserfs-devel@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).