From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [PATCH] fs: block pipe_write() on a frozen filesystem Date: Mon, 1 Oct 2012 17:34:05 +0200 Message-ID: <20121001153405.GD22800@quack.suse.cz> References: <5064752F.5000207@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "linux-fsdevel@vger.kernel.org" , Jan Kara , Fernando Luis Vazquez Cao , Al Viro To: Eric Sandeen Return-path: Received: from cantor2.suse.de ([195.135.220.15]:41478 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751636Ab2JAPeJ (ORCPT ); Mon, 1 Oct 2012 11:34:09 -0400 Content-Disposition: inline In-Reply-To: <5064752F.5000207@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 > --- > > 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 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; > } > >