[PATCH] fs: block pipe_write() on a frozen filesystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

Is this too big a hammer?  file_update_time() is conditional...

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;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux