On Tue, 2 Apr 2013 20:57:27 +0100, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > On Tue, Apr 02, 2013 at 04:38:22PM +0400, Dmitry Monakhov wrote: > > On Thu, 27 Sep 2012 10:47:59 -0500, Eric Sandeen <sandeen@xxxxxxxxxx> wrote: > > > I noticed that this can sneak past a frozen filesystem: > > Ping.. any body want to take care about that patch? > > NAK. Note that writing to FIFO that sits on filesystem that is outright > read-only is allowed just fine; blocking it for frozen ones is bogus. > > IOW, it should be treated the same way we treat touch_atime(). Moreover, > it should only be done around file_update_time(). With trylock. Ok fair enough. Please take a look at updated version
>From c01acb73b8dc9e7a891b8f087ad3eb53bb06d270 Mon Sep 17 00:00:00 2001 From: Dmitry Monakhov <dmonakhov@xxxxxxxxxx> Date: Wed, 3 Apr 2013 00:19:15 +0400 Subject: [PATCH] [PATCH] fs: skip mtime update for fifo on a frozen filesystem Eric 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(). If filesystem is frozen we can block pipe_write() but this is not optimal because fifo is special_file so let's skip mtime update as we do with touch_atime() Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx> --- fs/pipe.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/pipe.c b/fs/pipe.c index 2234f3f..62f63d5 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -654,10 +654,11 @@ out: wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); } - if (ret > 0) { + if (ret > 0 && sb_start_write_trylock(inode->i_sb)) { int err = file_update_time(filp); if (err) ret = err; + sb_end_write(inode->i_sb); } return ret; } -- 1.7.1