Skip to content

Commit

Permalink
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jack/linux-fs

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  ext2/3/4: delete unneeded includes of module.h
  ext{3,4}: Fix potential race when setversion ioctl updates inode
  udf: Mark LVID buffer as uptodate before marking it dirty
  ext3: Don't warn from writepage when readonly inode is spotted after error
  jbd: Remove j_barrier mutex
  reiserfs: Force inode evictions before umount to avoid crash
  reiserfs: Fix quota mount option parsing
  udf: Treat symlink component of type 2 as /
  udf: Fix deadlock when converting file from in-ICB one to normal one
  udf: Cleanup calling convention of inode_getblk()
  ext2: Fix error handling on inode bitmap corruption
  ext3: Fix error handling on inode bitmap corruption
  ext3: replace ll_rw_block with other functions
  ext3: NULL dereference in ext3_evict_inode()
  jbd: clear revoked flag on buffers before a new transaction started
  ext3: call ext3_mark_recovery_complete() when recovery is really needed
  • Loading branch information
torvalds committed Jan 9, 2012
2 parents 9e20393 + 302bf2f commit ac69e09
Show file tree
Hide file tree
Showing 35 changed files with 201 additions and 111 deletions.
7 changes: 5 additions & 2 deletions fs/ext2/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,11 @@ struct inode *ext2_new_inode(struct inode *dir, umode_t mode,
inode->i_generation = sbi->s_next_generation++;
spin_unlock(&sbi->s_next_gen_lock);
if (insert_inode_locked(inode) < 0) {
err = -EINVAL;
goto fail_drop;
ext2_error(sb, "ext2_new_inode",
"inode number already in use - inode=%lu",
(unsigned long) ino);
err = -EIO;
goto fail;
}

dquot_initialize(inode);
Expand Down
5 changes: 0 additions & 5 deletions fs/ext2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <linux/highuid.h>
#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/module.h>
#include <linux/writeback.h>
#include <linux/buffer_head.h>
#include <linux/mpage.h>
Expand All @@ -36,10 +35,6 @@
#include "acl.h"
#include "xip.h"

MODULE_AUTHOR("Remy Card and others");
MODULE_DESCRIPTION("Second Extended Filesystem");
MODULE_LICENSE("GPL");

static int __ext2_write_inode(struct inode *inode, int do_sync);

/*
Expand Down
3 changes: 3 additions & 0 deletions fs/ext2/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1520,5 +1520,8 @@ static void __exit exit_ext2_fs(void)
exit_ext2_xattr();
}

MODULE_AUTHOR("Remy Card and others");
MODULE_DESCRIPTION("Second Extended Filesystem");
MODULE_LICENSE("GPL");
module_init(init_ext2_fs)
module_exit(exit_ext2_fs)
1 change: 0 additions & 1 deletion fs/ext2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
*/

#include <linux/buffer_head.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/mbcache.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext2/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Handler for storing security labels as extended attributes.
*/

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/fs.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext2/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Copyright (C) 2003 by Andreas Gruenbacher, <[email protected]>
*/

#include <linux/module.h>
#include <linux/string.h>
#include <linux/capability.h>
#include <linux/fs.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext2/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

#include <linux/init.h>
#include <linux/module.h>
#include <linux/string.h>
#include "ext2.h"
#include "xattr.h"
Expand Down
8 changes: 6 additions & 2 deletions fs/ext3/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,12 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir,
if (IS_DIRSYNC(inode))
handle->h_sync = 1;
if (insert_inode_locked(inode) < 0) {
err = -EINVAL;
goto fail_drop;
/*
* Likely a bitmap corruption causing inode to be allocated
* twice.
*/
err = -EIO;
goto fail;
}
spin_lock(&sbi->s_next_gen_lock);
inode->i_generation = sbi->s_next_generation++;
Expand Down
43 changes: 32 additions & 11 deletions fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* Assorted race fixes, rewrite of ext3_get_block() by Al Viro, 2000
*/

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/ext3_jbd.h>
Expand Down Expand Up @@ -223,8 +222,12 @@ void ext3_evict_inode (struct inode *inode)
*
* Note that directories do not have this problem because they don't
* use page cache.
*
* The s_journal check handles the case when ext3_get_journal() fails
* and puts the journal inode.
*/
if (inode->i_nlink && ext3_should_journal_data(inode) &&
EXT3_SB(inode->i_sb)->s_journal &&
(S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
tid_t commit_tid = atomic_read(&ei->i_datasync_tid);
journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
Expand Down Expand Up @@ -1132,9 +1135,11 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode,
bh = ext3_getblk(handle, inode, block, create, err);
if (!bh)
return bh;
if (buffer_uptodate(bh))
if (bh_uptodate_or_lock(bh))
return bh;
ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
submit_bh(READ | REQ_META | REQ_PRIO, bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
Expand Down Expand Up @@ -1617,7 +1622,13 @@ static int ext3_ordered_writepage(struct page *page,
int err;

J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/*
* We don't want to warn for emergency remount. The condition is
* ordered to avoid dereferencing inode->i_sb in non-error case to
* avoid slow-downs.
*/
WARN_ON_ONCE(IS_RDONLY(inode) &&
!(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));

/*
* We give up here if we're reentered, because it might be for a
Expand Down Expand Up @@ -1692,7 +1703,13 @@ static int ext3_writeback_writepage(struct page *page,
int err;

J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/*
* We don't want to warn for emergency remount. The condition is
* ordered to avoid dereferencing inode->i_sb in non-error case to
* avoid slow-downs.
*/
WARN_ON_ONCE(IS_RDONLY(inode) &&
!(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));

if (ext3_journal_current_handle())
goto out_fail;
Expand Down Expand Up @@ -1735,7 +1752,13 @@ static int ext3_journalled_writepage(struct page *page,
int err;

J_ASSERT(PageLocked(page));
WARN_ON_ONCE(IS_RDONLY(inode));
/*
* We don't want to warn for emergency remount. The condition is
* ordered to avoid dereferencing inode->i_sb in non-error case to
* avoid slow-downs.
*/
WARN_ON_ONCE(IS_RDONLY(inode) &&
!(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));

if (ext3_journal_current_handle())
goto no_write;
Expand Down Expand Up @@ -2064,12 +2087,10 @@ static int ext3_block_truncate_page(struct inode *inode, loff_t from)
if (PageUptodate(page))
set_buffer_uptodate(bh);

if (!buffer_uptodate(bh)) {
err = -EIO;
ll_rw_block(READ, 1, &bh);
wait_on_buffer(bh);
if (!bh_uptodate_or_lock(bh)) {
err = bh_submit_read(bh);
/* Uhhuh. Read error. Complain and punt. */
if (!buffer_uptodate(bh))
if (err)
goto unlock;
}

Expand Down
6 changes: 5 additions & 1 deletion fs/ext3/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
goto setversion_out;
}

mutex_lock(&inode->i_mutex);
handle = ext3_journal_start(inode, 1);
if (IS_ERR(handle)) {
err = PTR_ERR(handle);
goto setversion_out;
goto unlock_out;
}
err = ext3_reserve_inode_write(handle, inode, &iloc);
if (err == 0) {
Expand All @@ -146,6 +147,9 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
err = ext3_mark_iloc_dirty(handle, inode, &iloc);
}
ext3_journal_stop(handle);

unlock_out:
mutex_unlock(&inode->i_mutex);
setversion_out:
mnt_drop_write_file(filp);
return err;
Expand Down
9 changes: 6 additions & 3 deletions fs/ext3/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,12 @@ static struct buffer_head *ext3_find_entry(struct inode *dir,
num++;
bh = ext3_getblk(NULL, dir, b++, 0, &err);
bh_use[ra_max] = bh;
if (bh)
ll_rw_block(READ | REQ_META | REQ_PRIO,
1, &bh);
if (bh && !bh_uptodate_or_lock(bh)) {
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
submit_bh(READ | REQ_META | REQ_PRIO,
bh);
}
}
}
if ((bh = bh_use[ra_ptr++]) == NULL)
Expand Down
15 changes: 8 additions & 7 deletions fs/ext3/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2059,9 +2059,10 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS;
ext3_orphan_cleanup(sb, es);
EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS;
if (needs_recovery)
if (needs_recovery) {
ext3_mark_recovery_complete(sb, es);
ext3_msg(sb, KERN_INFO, "recovery complete");
ext3_mark_recovery_complete(sb, es);
}
ext3_msg(sb, KERN_INFO, "mounted filesystem with %s data mode",
test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal":
test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered":
Expand Down Expand Up @@ -2229,11 +2230,11 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
goto out_bdev;
}
journal->j_private = sb;
ll_rw_block(READ, 1, &journal->j_sb_buffer);
wait_on_buffer(journal->j_sb_buffer);
if (!buffer_uptodate(journal->j_sb_buffer)) {
ext3_msg(sb, KERN_ERR, "I/O error on journal device");
goto out_journal;
if (!bh_uptodate_or_lock(journal->j_sb_buffer)) {
if (bh_submit_read(journal->j_sb_buffer)) {
ext3_msg(sb, KERN_ERR, "I/O error on journal device");
goto out_journal;
}
}
if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
ext3_msg(sb, KERN_ERR,
Expand Down
1 change: 0 additions & 1 deletion fs/ext3/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Handler for storing security labels as extended attributes.
*/

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/fs.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext3/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Copyright (C) 2003 by Andreas Gruenbacher, <[email protected]>
*/

#include <linux/module.h>
#include <linux/string.h>
#include <linux/capability.h>
#include <linux/fs.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext3/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Copyright (C) 2001 by Andreas Gruenbacher, <[email protected]>
*/

#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/ext3_jbd.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext4/block_validity.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/namei.h>
#include <linux/quotaops.h>
#include <linux/buffer_head.h>
#include <linux/module.h>
#include <linux/swap.h>
#include <linux/pagemap.h>
#include <linux/blkdev.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* - smart tree reduction
*/

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/jbd2.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext4/indirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* ([email protected]), 1993, 1998
*/

#include <linux/module.h>
#include "ext4_jbd2.h"
#include "truncate.h"

Expand Down
1 change: 0 additions & 1 deletion fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000
*/

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/jbd2.h>
Expand Down
6 changes: 5 additions & 1 deletion fs/ext4/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
goto setversion_out;
}

mutex_lock(&inode->i_mutex);
handle = ext4_journal_start(inode, 1);
if (IS_ERR(handle)) {
err = PTR_ERR(handle);
goto setversion_out;
goto unlock_out;
}
err = ext4_reserve_inode_write(handle, inode, &iloc);
if (err == 0) {
Expand All @@ -170,6 +171,9 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
err = ext4_mark_iloc_dirty(handle, inode, &iloc);
}
ext4_journal_stop(handle);

unlock_out:
mutex_unlock(&inode->i_mutex);
setversion_out:
mnt_drop_write_file(filp);
return err;
Expand Down
1 change: 0 additions & 1 deletion fs/ext4/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*
*/

#include <linux/module.h>
#include <linux/slab.h>
#include "ext4_jbd2.h"

Expand Down
1 change: 0 additions & 1 deletion fs/ext4/page-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Written by Theodore Ts'o, 2010.
*/

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/jbd2.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext4/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Handler for storing security labels as extended attributes.
*/

#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/security.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext4/xattr_trusted.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Copyright (C) 2003 by Andreas Gruenbacher, <[email protected]>
*/

#include <linux/module.h>
#include <linux/string.h>
#include <linux/capability.h>
#include <linux/fs.h>
Expand Down
1 change: 0 additions & 1 deletion fs/ext4/xattr_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Copyright (C) 2001 by Andreas Gruenbacher, <[email protected]>
*/

#include <linux/module.h>
#include <linux/string.h>
#include <linux/fs.h>
#include "ext4_jbd2.h"
Expand Down
6 changes: 6 additions & 0 deletions fs/jbd/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ void journal_commit_transaction(journal_t *journal)

jbd_debug (3, "JBD: commit phase 1\n");

/*
* Clear revoked flag to reflect there is no revoked buffers
* in the next transaction which is going to be started.
*/
journal_clear_buffer_revoked_flags(journal);

/*
* Switch to a new revoke table.
*/
Expand Down
1 change: 0 additions & 1 deletion fs/jbd/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ static journal_t * journal_init_common (void)
init_waitqueue_head(&journal->j_wait_checkpoint);
init_waitqueue_head(&journal->j_wait_commit);
init_waitqueue_head(&journal->j_wait_updates);
mutex_init(&journal->j_barrier);
mutex_init(&journal->j_checkpoint_mutex);
spin_lock_init(&journal->j_revoke_lock);
spin_lock_init(&journal->j_list_lock);
Expand Down
Loading

0 comments on commit ac69e09

Please sign in to comment.