linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Eric Sandeen <sandeen@redhat.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Jan Kara <jack@suse.cz>,
	Fernando Luis Vazquez Cao <fernando_b1@lab.ntt.co.jp>,
	Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH] fs: block pipe_write() on a frozen filesystem
Date: Mon, 1 Oct 2012 17:34:05 +0200	[thread overview]
Message-ID: <20121001153405.GD22800@quack.suse.cz> (raw)
In-Reply-To: <5064752F.5000207@redhat.com>

On Thu 27-09-12 10:47:59, Eric Sandeen wrote:
> I noticed that this can sneak past a frozen filesystem:
> 
> # mkfifo /mnt/test/fifo
> # echo foo > /mnt/test/fifo &
> # fsfreeze -f /mnt/test
> # cat /mnt/test/fifo
> 
> and we get a warning that jbd2 has entered a transaction while frozen:
> 
> WARNING: at fs/ext4/super.c:240 ext4_journal_start_sb+0xce/0xe0 [ext4]() (Not tainted)
> 
> which is: WARN_ON(sb->s_writers.frozen == SB_FREEZE_COMPLETE);
> 
> and we get there via the file_update_time() path in pipe_write().
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> Is this too big a hammer?  file_update_time() is conditional...
  I think your patch is fine. Just skipping update of mtime could cause
userspace issues (although they seem rather unlikely to me). So you can add
  Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> 
> diff --git a/fs/pipe.c b/fs/pipe.c
> index 8d85d70..d19a709 100644
> --- a/fs/pipe.c
> +++ b/fs/pipe.c
> @@ -501,6 +501,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
>  
>  	do_wakeup = 0;
>  	ret = 0;
> +	sb_start_write(inode->i_sb);
>  	mutex_lock(&inode->i_mutex);
>  	pipe = inode->i_pipe;
>  
> @@ -659,6 +660,7 @@ out:
>  		if (err)
>  			ret = err;
>  	}
> +	sb_end_write(inode->i_sb);
>  	return ret;
>  }
>  
> 

  reply	other threads:[~2012-10-01 15:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 15:47 [PATCH] fs: block pipe_write() on a frozen filesystem Eric Sandeen
2012-10-01 15:34 ` Jan Kara [this message]
2013-04-02 12:38 ` [PATCH] fs: block pipe_write() on a frozen filesystem PING Dmitry Monakhov
2013-04-02 19:57   ` Al Viro
2013-04-02 20:30     ` Dmitry Monakhov

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=20121001153405.GD22800@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=fernando_b1@lab.ntt.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --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).