Commit 2a21e37e authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: tone down ext4_da_writepages warnings

If the filesystem has errors, ext4_da_writepages() will return a *lot*
of errors, including lots and lots of stack dumps.  While it's true
that we are dropping user data on the floor, which is unfortunate, the
stack dumps aren't helpful, and they tend to obscure the true original
root cause of the problem.  So in the case where the filesystem has
aborted, return an EROFS right away.
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 97df5d15
...@@ -2397,6 +2397,20 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2397,6 +2397,20 @@ static int ext4_da_writepages(struct address_space *mapping,
*/ */
if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
return 0; return 0;
/*
* If the filesystem has aborted, it is read-only, so return
* right away instead of dumping stack traces later on that
* will obscure the real source of the problem. We test
* EXT4_MOUNT_ABORT instead of sb->s_flag's MS_RDONLY because
* the latter could be true if the filesystem is mounted
* read-only, and in that case, ext4_da_writepages should
* *never* be called, so if that ever happens, we would want
* the stack trace.
*/
if (unlikely(sbi->s_mount_opt & EXT4_MOUNT_ABORT))
return -EROFS;
/* /*
* Make sure nr_to_write is >= sbi->s_mb_stream_request * Make sure nr_to_write is >= sbi->s_mb_stream_request
* This make sure small files blocks are allocated in * This make sure small files blocks are allocated in
...@@ -2441,7 +2455,7 @@ static int ext4_da_writepages(struct address_space *mapping, ...@@ -2441,7 +2455,7 @@ static int ext4_da_writepages(struct address_space *mapping,
handle = ext4_journal_start(inode, needed_blocks); handle = ext4_journal_start(inode, needed_blocks);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
printk(KERN_EMERG "%s: jbd2_start: " printk(KERN_CRIT "%s: jbd2_start: "
"%ld pages, ino %lu; err %d\n", __func__, "%ld pages, ino %lu; err %d\n", __func__,
wbc->nr_to_write, inode->i_ino, ret); wbc->nr_to_write, inode->i_ino, ret);
dump_stack(); dump_stack();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment