public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Akinobu Mita <akinobu.mita@gmail.com>,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com,
	Tim Shimmin <xfs-masters@oss.sgi.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] update sb->s_frozen when freezing read-only mounted device, too
Date: Thu, 4 Oct 2007 22:20:04 +0200	[thread overview]
Message-ID: <20071004202004.GA13316@lst.de> (raw)
In-Reply-To: <20070929100912.GB4121@APFDCB5C>

On Sat, Sep 29, 2007 at 07:09:12PM +0900, Akinobu Mita wrote:
> freeze_bdev() with the device which is mounted as read only
> does not change sb->s_frozen from SB_UNFROZEN to SB_FREEZE_TRANS.
> 
> Because of this behavior, xfs_freeze can break read-only XFS filesystem.
> 
> Because xfs_thaw does nothing for the filesystem whose sb->s_frozen is
> SB_UNFROZEN. So freezed readonly XFS filesystem will never be unfreezed.
> Then we cannot do any unmount/remount operations for that filesystem.
> 
> This patch updates sb->s_frozen when freeze_bdev() is called for read-only
> mounted device, too.

I think this fix is valid, but it might be a tad cleaner to just
set s_frozen to SB_FREEZE_TRANS directly in a separate branch, ala:

struct super_block *freeze_bdev(struct block_device *bdev)
{
        struct super_block *sb;

        down(&bdev->bd_mount_sem);
        sb = get_super(bdev);
	if (!sb)
		goto out;

	if (sb->s_flags & MS_RDONLY) {
		sb->s_frozen = SB_FREEZE_TRANS;
		smp_wmb();
		goto out;
	}

	sb->s_frozen = SB_FREEZE_WRITE;
	smp_wmb();

	__fsync_super(sb);

	sb->s_frozen = SB_FREEZE_TRANS
	smp_wmb();

	sync_blockdev(sb->s_bdev);

	if (sb->s_op->write_super_lockfs)
		sb->s_op->write_super_lockfs(sb);

 out:
	sync_blockdev(bdev);
	return sb;      /* thaw_bdev releases s->s_umount and bd_mount_sem */
}

  reply	other threads:[~2007-10-04 20:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-29 10:09 [PATCH] update sb->s_frozen when freezing read-only mounted device, too Akinobu Mita
2007-10-04 20:20 ` Christoph Hellwig [this message]
2007-10-05 13:20   ` Akinobu Mita
2007-10-10 15:20     ` Akinobu Mita

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=20071004202004.GA13316@lst.de \
    --to=hch@lst.de \
    --cc=akinobu.mita@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xfs-masters@oss.sgi.com \
    --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