From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-fsdevel@vger.kernel.org, viro@ZenIV.linux.org.uk
Subject: Re: [PATCH 3/3] vfs: fix filesystem_sync vs write race on rw=>ro remount v2
Date: Tue, 2 Mar 2010 14:29:11 +0100 [thread overview]
Message-ID: <20100302132911.GB4763@quack.suse.cz> (raw)
In-Reply-To: <1267230349-8192-3-git-send-email-dmonakhov@openvz.org>
On Sat 27-02-10 03:25:49, Dmitry Monakhov wrote:
> +/**
> + * Check whenever is it possible to remount given sb to readonly.
> + * @sb : super block in question
> + *
> + * Caller is responsible to set ST_REMOUNT_RO state before the call.
> + */
> +int fs_may_remount_ro(struct super_block *sb)
> +{
> + struct vfsmount *mnt;
> + int ret = 1;
> + spin_lock(&vfsmount_lock);
> + list_for_each_entry(mnt, &sb->s_vfsmount, mnt_sb_list) {
> + ret = !mnt_check_writers(mnt, 0);
> + if (ret)
> + break;
> + }
> + spin_unlock(&vfsmount_lock);
> + /*
> + * If new writer appears after we have checked all vfsmounts.
> + * Then ST_REMOUNT_RO bit will be cleared.
> + */
> + if (!test_bit(ST_REMOUNT_RO, &sb->s_state))
> + ret = 0;
> + return ret;
> +}
This misses the case when the superblock as unlinked-but-open files.
In such case we have to fail remount RO as well. The original
fs_may_remount_ro checks for that..
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2010-03-02 13:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-27 0:25 [PATCH 1/3] vfs: redesign sb state flags Dmitry Monakhov
2010-02-27 0:25 ` [PATCH 2/3] vfs: per-sb write count preparation stage Dmitry Monakhov
2010-02-27 0:25 ` [PATCH 3/3] vfs: fix filesystem_sync vs write race on rw=>ro remount v2 Dmitry Monakhov
2010-03-02 13:29 ` Jan Kara [this message]
2010-03-02 14:04 ` Dmitry Monakhov
2010-03-02 14:06 ` Jan Kara
2010-03-02 14:24 ` Dmitry Monakhov
2010-03-02 14:35 ` Jan Kara
2010-03-02 15:38 ` Dmitry Monakhov
2010-03-02 15:21 ` Nick Piggin
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=20100302132911.GB4763@quack.suse.cz \
--to=jack@suse.cz \
--cc=dmonakhov@openvz.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/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).