Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/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

+200 -110
+5 -2
fs/ext2/ialloc.c
··· 573 573 inode->i_generation = sbi->s_next_generation++; 574 574 spin_unlock(&sbi->s_next_gen_lock); 575 575 if (insert_inode_locked(inode) < 0) { 576 - err = -EINVAL; 577 - goto fail_drop; 576 + ext2_error(sb, "ext2_new_inode", 577 + "inode number already in use - inode=%lu", 578 + (unsigned long) ino); 579 + err = -EIO; 580 + goto fail; 578 581 } 579 582 580 583 dquot_initialize(inode);
-5
fs/ext2/inode.c
··· 26 26 #include <linux/highuid.h> 27 27 #include <linux/pagemap.h> 28 28 #include <linux/quotaops.h> 29 - #include <linux/module.h> 30 29 #include <linux/writeback.h> 31 30 #include <linux/buffer_head.h> 32 31 #include <linux/mpage.h> ··· 34 35 #include "ext2.h" 35 36 #include "acl.h" 36 37 #include "xip.h" 37 - 38 - MODULE_AUTHOR("Remy Card and others"); 39 - MODULE_DESCRIPTION("Second Extended Filesystem"); 40 - MODULE_LICENSE("GPL"); 41 38 42 39 static int __ext2_write_inode(struct inode *inode, int do_sync); 43 40
+3
fs/ext2/super.c
··· 1520 1520 exit_ext2_xattr(); 1521 1521 } 1522 1522 1523 + MODULE_AUTHOR("Remy Card and others"); 1524 + MODULE_DESCRIPTION("Second Extended Filesystem"); 1525 + MODULE_LICENSE("GPL"); 1523 1526 module_init(init_ext2_fs) 1524 1527 module_exit(exit_ext2_fs)
-1
fs/ext2/xattr.c
··· 54 54 */ 55 55 56 56 #include <linux/buffer_head.h> 57 - #include <linux/module.h> 58 57 #include <linux/init.h> 59 58 #include <linux/slab.h> 60 59 #include <linux/mbcache.h>
-1
fs/ext2/xattr_security.c
··· 3 3 * Handler for storing security labels as extended attributes. 4 4 */ 5 5 6 - #include <linux/module.h> 7 6 #include <linux/slab.h> 8 7 #include <linux/string.h> 9 8 #include <linux/fs.h>
-1
fs/ext2/xattr_trusted.c
··· 5 5 * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 6 6 */ 7 7 8 - #include <linux/module.h> 9 8 #include <linux/string.h> 10 9 #include <linux/capability.h> 11 10 #include <linux/fs.h>
-1
fs/ext2/xattr_user.c
··· 6 6 */ 7 7 8 8 #include <linux/init.h> 9 - #include <linux/module.h> 10 9 #include <linux/string.h> 11 10 #include "ext2.h" 12 11 #include "xattr.h"
+6 -2
fs/ext3/ialloc.c
··· 525 525 if (IS_DIRSYNC(inode)) 526 526 handle->h_sync = 1; 527 527 if (insert_inode_locked(inode) < 0) { 528 - err = -EINVAL; 529 - goto fail_drop; 528 + /* 529 + * Likely a bitmap corruption causing inode to be allocated 530 + * twice. 531 + */ 532 + err = -EIO; 533 + goto fail; 530 534 } 531 535 spin_lock(&sbi->s_next_gen_lock); 532 536 inode->i_generation = sbi->s_next_generation++;
+32 -11
fs/ext3/inode.c
··· 22 22 * Assorted race fixes, rewrite of ext3_get_block() by Al Viro, 2000 23 23 */ 24 24 25 - #include <linux/module.h> 26 25 #include <linux/fs.h> 27 26 #include <linux/time.h> 28 27 #include <linux/ext3_jbd.h> ··· 222 223 * 223 224 * Note that directories do not have this problem because they don't 224 225 * use page cache. 226 + * 227 + * The s_journal check handles the case when ext3_get_journal() fails 228 + * and puts the journal inode. 225 229 */ 226 230 if (inode->i_nlink && ext3_should_journal_data(inode) && 231 + EXT3_SB(inode->i_sb)->s_journal && 227 232 (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { 228 233 tid_t commit_tid = atomic_read(&ei->i_datasync_tid); 229 234 journal_t *journal = EXT3_SB(inode->i_sb)->s_journal; ··· 1135 1132 bh = ext3_getblk(handle, inode, block, create, err); 1136 1133 if (!bh) 1137 1134 return bh; 1138 - if (buffer_uptodate(bh)) 1135 + if (bh_uptodate_or_lock(bh)) 1139 1136 return bh; 1140 - ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh); 1137 + get_bh(bh); 1138 + bh->b_end_io = end_buffer_read_sync; 1139 + submit_bh(READ | REQ_META | REQ_PRIO, bh); 1141 1140 wait_on_buffer(bh); 1142 1141 if (buffer_uptodate(bh)) 1143 1142 return bh; ··· 1622 1617 int err; 1623 1618 1624 1619 J_ASSERT(PageLocked(page)); 1625 - WARN_ON_ONCE(IS_RDONLY(inode)); 1620 + /* 1621 + * We don't want to warn for emergency remount. The condition is 1622 + * ordered to avoid dereferencing inode->i_sb in non-error case to 1623 + * avoid slow-downs. 1624 + */ 1625 + WARN_ON_ONCE(IS_RDONLY(inode) && 1626 + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); 1626 1627 1627 1628 /* 1628 1629 * We give up here if we're reentered, because it might be for a ··· 1703 1692 int err; 1704 1693 1705 1694 J_ASSERT(PageLocked(page)); 1706 - WARN_ON_ONCE(IS_RDONLY(inode)); 1695 + /* 1696 + * We don't want to warn for emergency remount. The condition is 1697 + * ordered to avoid dereferencing inode->i_sb in non-error case to 1698 + * avoid slow-downs. 1699 + */ 1700 + WARN_ON_ONCE(IS_RDONLY(inode) && 1701 + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); 1707 1702 1708 1703 if (ext3_journal_current_handle()) 1709 1704 goto out_fail; ··· 1752 1735 int err; 1753 1736 1754 1737 J_ASSERT(PageLocked(page)); 1755 - WARN_ON_ONCE(IS_RDONLY(inode)); 1738 + /* 1739 + * We don't want to warn for emergency remount. The condition is 1740 + * ordered to avoid dereferencing inode->i_sb in non-error case to 1741 + * avoid slow-downs. 1742 + */ 1743 + WARN_ON_ONCE(IS_RDONLY(inode) && 1744 + !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); 1756 1745 1757 1746 if (ext3_journal_current_handle()) 1758 1747 goto no_write; ··· 2087 2064 if (PageUptodate(page)) 2088 2065 set_buffer_uptodate(bh); 2089 2066 2090 - if (!buffer_uptodate(bh)) { 2091 - err = -EIO; 2092 - ll_rw_block(READ, 1, &bh); 2093 - wait_on_buffer(bh); 2067 + if (!bh_uptodate_or_lock(bh)) { 2068 + err = bh_submit_read(bh); 2094 2069 /* Uhhuh. Read error. Complain and punt. */ 2095 - if (!buffer_uptodate(bh)) 2070 + if (err) 2096 2071 goto unlock; 2097 2072 } 2098 2073
+5 -1
fs/ext3/ioctl.c
··· 134 134 goto setversion_out; 135 135 } 136 136 137 + mutex_lock(&inode->i_mutex); 137 138 handle = ext3_journal_start(inode, 1); 138 139 if (IS_ERR(handle)) { 139 140 err = PTR_ERR(handle); 140 - goto setversion_out; 141 + goto unlock_out; 141 142 } 142 143 err = ext3_reserve_inode_write(handle, inode, &iloc); 143 144 if (err == 0) { ··· 147 146 err = ext3_mark_iloc_dirty(handle, inode, &iloc); 148 147 } 149 148 ext3_journal_stop(handle); 149 + 150 + unlock_out: 151 + mutex_unlock(&inode->i_mutex); 150 152 setversion_out: 151 153 mnt_drop_write_file(filp); 152 154 return err;
+6 -3
fs/ext3/namei.c
··· 921 921 num++; 922 922 bh = ext3_getblk(NULL, dir, b++, 0, &err); 923 923 bh_use[ra_max] = bh; 924 - if (bh) 925 - ll_rw_block(READ | REQ_META | REQ_PRIO, 926 - 1, &bh); 924 + if (bh && !bh_uptodate_or_lock(bh)) { 925 + get_bh(bh); 926 + bh->b_end_io = end_buffer_read_sync; 927 + submit_bh(READ | REQ_META | REQ_PRIO, 928 + bh); 929 + } 927 930 } 928 931 } 929 932 if ((bh = bh_use[ra_ptr++]) == NULL)
+8 -7
fs/ext3/super.c
··· 2059 2059 EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; 2060 2060 ext3_orphan_cleanup(sb, es); 2061 2061 EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; 2062 - if (needs_recovery) 2062 + if (needs_recovery) { 2063 + ext3_mark_recovery_complete(sb, es); 2063 2064 ext3_msg(sb, KERN_INFO, "recovery complete"); 2064 - ext3_mark_recovery_complete(sb, es); 2065 + } 2065 2066 ext3_msg(sb, KERN_INFO, "mounted filesystem with %s data mode", 2066 2067 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal": 2067 2068 test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": ··· 2230 2229 goto out_bdev; 2231 2230 } 2232 2231 journal->j_private = sb; 2233 - ll_rw_block(READ, 1, &journal->j_sb_buffer); 2234 - wait_on_buffer(journal->j_sb_buffer); 2235 - if (!buffer_uptodate(journal->j_sb_buffer)) { 2236 - ext3_msg(sb, KERN_ERR, "I/O error on journal device"); 2237 - goto out_journal; 2232 + if (!bh_uptodate_or_lock(journal->j_sb_buffer)) { 2233 + if (bh_submit_read(journal->j_sb_buffer)) { 2234 + ext3_msg(sb, KERN_ERR, "I/O error on journal device"); 2235 + goto out_journal; 2236 + } 2238 2237 } 2239 2238 if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { 2240 2239 ext3_msg(sb, KERN_ERR,
-1
fs/ext3/xattr_security.c
··· 3 3 * Handler for storing security labels as extended attributes. 4 4 */ 5 5 6 - #include <linux/module.h> 7 6 #include <linux/slab.h> 8 7 #include <linux/string.h> 9 8 #include <linux/fs.h>
-1
fs/ext3/xattr_trusted.c
··· 5 5 * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 6 6 */ 7 7 8 - #include <linux/module.h> 9 8 #include <linux/string.h> 10 9 #include <linux/capability.h> 11 10 #include <linux/fs.h>
-1
fs/ext3/xattr_user.c
··· 5 5 * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 6 6 */ 7 7 8 - #include <linux/module.h> 9 8 #include <linux/string.h> 10 9 #include <linux/fs.h> 11 10 #include <linux/ext3_jbd.h>
-1
fs/ext4/block_validity.c
··· 13 13 #include <linux/namei.h> 14 14 #include <linux/quotaops.h> 15 15 #include <linux/buffer_head.h> 16 - #include <linux/module.h> 17 16 #include <linux/swap.h> 18 17 #include <linux/pagemap.h> 19 18 #include <linux/blkdev.h>
-1
fs/ext4/extents.c
··· 29 29 * - smart tree reduction 30 30 */ 31 31 32 - #include <linux/module.h> 33 32 #include <linux/fs.h> 34 33 #include <linux/time.h> 35 34 #include <linux/jbd2.h>
-1
fs/ext4/indirect.c
··· 20 20 * (sct@redhat.com), 1993, 1998 21 21 */ 22 22 23 - #include <linux/module.h> 24 23 #include "ext4_jbd2.h" 25 24 #include "truncate.h" 26 25
-1
fs/ext4/inode.c
··· 18 18 * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000 19 19 */ 20 20 21 - #include <linux/module.h> 22 21 #include <linux/fs.h> 23 22 #include <linux/time.h> 24 23 #include <linux/jbd2.h>
+5 -1
fs/ext4/ioctl.c
··· 158 158 goto setversion_out; 159 159 } 160 160 161 + mutex_lock(&inode->i_mutex); 161 162 handle = ext4_journal_start(inode, 1); 162 163 if (IS_ERR(handle)) { 163 164 err = PTR_ERR(handle); 164 - goto setversion_out; 165 + goto unlock_out; 165 166 } 166 167 err = ext4_reserve_inode_write(handle, inode, &iloc); 167 168 if (err == 0) { ··· 171 170 err = ext4_mark_iloc_dirty(handle, inode, &iloc); 172 171 } 173 172 ext4_journal_stop(handle); 173 + 174 + unlock_out: 175 + mutex_unlock(&inode->i_mutex); 174 176 setversion_out: 175 177 mnt_drop_write_file(filp); 176 178 return err;
-1
fs/ext4/migrate.c
··· 12 12 * 13 13 */ 14 14 15 - #include <linux/module.h> 16 15 #include <linux/slab.h> 17 16 #include "ext4_jbd2.h" 18 17
-1
fs/ext4/page-io.c
··· 6 6 * Written by Theodore Ts'o, 2010. 7 7 */ 8 8 9 - #include <linux/module.h> 10 9 #include <linux/fs.h> 11 10 #include <linux/time.h> 12 11 #include <linux/jbd2.h>
-1
fs/ext4/xattr_security.c
··· 3 3 * Handler for storing security labels as extended attributes. 4 4 */ 5 5 6 - #include <linux/module.h> 7 6 #include <linux/string.h> 8 7 #include <linux/fs.h> 9 8 #include <linux/security.h>
-1
fs/ext4/xattr_trusted.c
··· 5 5 * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 6 6 */ 7 7 8 - #include <linux/module.h> 9 8 #include <linux/string.h> 10 9 #include <linux/capability.h> 11 10 #include <linux/fs.h>
-1
fs/ext4/xattr_user.c
··· 5 5 * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 6 6 */ 7 7 8 - #include <linux/module.h> 9 8 #include <linux/string.h> 10 9 #include <linux/fs.h> 11 10 #include "ext4_jbd2.h"
+6
fs/jbd/commit.c
··· 392 392 jbd_debug (3, "JBD: commit phase 1\n"); 393 393 394 394 /* 395 + * Clear revoked flag to reflect there is no revoked buffers 396 + * in the next transaction which is going to be started. 397 + */ 398 + journal_clear_buffer_revoked_flags(journal); 399 + 400 + /* 395 401 * Switch to a new revoke table. 396 402 */ 397 403 journal_switch_revoke_table(journal);
-1
fs/jbd/journal.c
··· 721 721 init_waitqueue_head(&journal->j_wait_checkpoint); 722 722 init_waitqueue_head(&journal->j_wait_commit); 723 723 init_waitqueue_head(&journal->j_wait_updates); 724 - mutex_init(&journal->j_barrier); 725 724 mutex_init(&journal->j_checkpoint_mutex); 726 725 spin_lock_init(&journal->j_revoke_lock); 727 726 spin_lock_init(&journal->j_list_lock);
+34
fs/jbd/revoke.c
··· 47 47 * overwriting the new data. We don't even need to clear the revoke 48 48 * bit here. 49 49 * 50 + * We cache revoke status of a buffer in the current transaction in b_states 51 + * bits. As the name says, revokevalid flag indicates that the cached revoke 52 + * status of a buffer is valid and we can rely on the cached status. 53 + * 50 54 * Revoke information on buffers is a tri-state value: 51 55 * 52 56 * RevokeValid clear: no cached revoke status, need to look it up ··· 481 477 } 482 478 } 483 479 return did_revoke; 480 + } 481 + 482 + /* 483 + * journal_clear_revoked_flags clears revoked flag of buffers in 484 + * revoke table to reflect there is no revoked buffer in the next 485 + * transaction which is going to be started. 486 + */ 487 + void journal_clear_buffer_revoked_flags(journal_t *journal) 488 + { 489 + struct jbd_revoke_table_s *revoke = journal->j_revoke; 490 + int i = 0; 491 + 492 + for (i = 0; i < revoke->hash_size; i++) { 493 + struct list_head *hash_list; 494 + struct list_head *list_entry; 495 + hash_list = &revoke->hash_table[i]; 496 + 497 + list_for_each(list_entry, hash_list) { 498 + struct jbd_revoke_record_s *record; 499 + struct buffer_head *bh; 500 + record = (struct jbd_revoke_record_s *)list_entry; 501 + bh = __find_get_block(journal->j_fs_dev, 502 + record->blocknr, 503 + journal->j_blocksize); 504 + if (bh) { 505 + clear_buffer_revoked(bh); 506 + __brelse(bh); 507 + } 508 + } 509 + } 484 510 } 485 511 486 512 /* journal_switch_revoke table select j_revoke for next transaction
+21 -15
fs/jbd/transaction.c
··· 426 426 * void journal_lock_updates () - establish a transaction barrier. 427 427 * @journal: Journal to establish a barrier on. 428 428 * 429 - * This locks out any further updates from being started, and blocks 430 - * until all existing updates have completed, returning only once the 431 - * journal is in a quiescent state with no updates running. 429 + * This locks out any further updates from being started, and blocks until all 430 + * existing updates have completed, returning only once the journal is in a 431 + * quiescent state with no updates running. 432 432 * 433 - * The journal lock should not be held on entry. 433 + * We do not use simple mutex for synchronization as there are syscalls which 434 + * want to return with filesystem locked and that trips up lockdep. Also 435 + * hibernate needs to lock filesystem but locked mutex then blocks hibernation. 436 + * Since locking filesystem is rare operation, we use simple counter and 437 + * waitqueue for locking. 434 438 */ 435 439 void journal_lock_updates(journal_t *journal) 436 440 { 437 441 DEFINE_WAIT(wait); 438 442 443 + wait: 444 + /* Wait for previous locked operation to finish */ 445 + wait_event(journal->j_wait_transaction_locked, 446 + journal->j_barrier_count == 0); 447 + 439 448 spin_lock(&journal->j_state_lock); 449 + /* 450 + * Check reliably under the lock whether we are the ones winning the race 451 + * and locking the journal 452 + */ 453 + if (journal->j_barrier_count > 0) { 454 + spin_unlock(&journal->j_state_lock); 455 + goto wait; 456 + } 440 457 ++journal->j_barrier_count; 441 458 442 459 /* Wait until there are no running updates */ ··· 477 460 spin_lock(&journal->j_state_lock); 478 461 } 479 462 spin_unlock(&journal->j_state_lock); 480 - 481 - /* 482 - * We have now established a barrier against other normal updates, but 483 - * we also need to barrier against other journal_lock_updates() calls 484 - * to make sure that we serialise special journal-locked operations 485 - * too. 486 - */ 487 - mutex_lock(&journal->j_barrier); 488 463 } 489 464 490 465 /** ··· 484 475 * @journal: Journal to release the barrier on. 485 476 * 486 477 * Release a transaction barrier obtained with journal_lock_updates(). 487 - * 488 - * Should be called without the journal lock held. 489 478 */ 490 479 void journal_unlock_updates (journal_t *journal) 491 480 { 492 481 J_ASSERT(journal->j_barrier_count != 0); 493 482 494 - mutex_unlock(&journal->j_barrier); 495 483 spin_lock(&journal->j_state_lock); 496 484 --journal->j_barrier_count; 497 485 spin_unlock(&journal->j_state_lock);
+16 -11
fs/reiserfs/super.c
··· 455 455 static void reiserfs_kill_sb(struct super_block *s) 456 456 { 457 457 if (REISERFS_SB(s)) { 458 - if (REISERFS_SB(s)->xattr_root) { 459 - d_invalidate(REISERFS_SB(s)->xattr_root); 460 - dput(REISERFS_SB(s)->xattr_root); 461 - REISERFS_SB(s)->xattr_root = NULL; 462 - } 463 - if (REISERFS_SB(s)->priv_root) { 464 - d_invalidate(REISERFS_SB(s)->priv_root); 465 - dput(REISERFS_SB(s)->priv_root); 466 - REISERFS_SB(s)->priv_root = NULL; 467 - } 458 + /* 459 + * Force any pending inode evictions to occur now. Any 460 + * inodes to be removed that have extended attributes 461 + * associated with them need to clean them up before 462 + * we can release the extended attribute root dentries. 463 + * shrink_dcache_for_umount will BUG if we don't release 464 + * those before it's called so ->put_super is too late. 465 + */ 466 + shrink_dcache_sb(s); 467 + 468 + dput(REISERFS_SB(s)->xattr_root); 469 + REISERFS_SB(s)->xattr_root = NULL; 470 + dput(REISERFS_SB(s)->priv_root); 471 + REISERFS_SB(s)->priv_root = NULL; 468 472 } 469 473 470 474 kill_block_super(s); ··· 1253 1249 kfree(REISERFS_SB(s)->s_qf_names[i]); 1254 1250 REISERFS_SB(s)->s_qf_names[i] = qf_names[i]; 1255 1251 } 1256 - REISERFS_SB(s)->s_jquota_fmt = *qfmt; 1252 + if (*qfmt) 1253 + REISERFS_SB(s)->s_jquota_fmt = *qfmt; 1257 1254 } 1258 1255 #endif 1259 1256
+3 -3
fs/udf/file.c
··· 125 125 err = udf_expand_file_adinicb(inode); 126 126 if (err) { 127 127 udf_debug("udf_expand_adinicb: err=%d\n", err); 128 - up_write(&iinfo->i_data_sem); 129 128 return err; 130 129 } 131 130 } else { ··· 132 133 iinfo->i_lenAlloc = pos + count; 133 134 else 134 135 iinfo->i_lenAlloc = inode->i_size; 136 + up_write(&iinfo->i_data_sem); 135 137 } 136 - } 137 - up_write(&iinfo->i_data_sem); 138 + } else 139 + up_write(&iinfo->i_data_sem); 138 140 139 141 retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); 140 142 if (retval > 0)
+33 -24
fs/udf/inode.c
··· 53 53 static void udf_fill_inode(struct inode *, struct buffer_head *); 54 54 static int udf_sync_inode(struct inode *inode); 55 55 static int udf_alloc_i_data(struct inode *inode, size_t size); 56 - static struct buffer_head *inode_getblk(struct inode *, sector_t, int *, 57 - sector_t *, int *); 56 + static sector_t inode_getblk(struct inode *, sector_t, int *, int *); 58 57 static int8_t udf_insert_aext(struct inode *, struct extent_position, 59 58 struct kernel_lb_addr, uint32_t); 60 59 static void udf_split_extents(struct inode *, int *, int, int, ··· 150 151 .bmap = udf_bmap, 151 152 }; 152 153 154 + /* 155 + * Expand file stored in ICB to a normal one-block-file 156 + * 157 + * This function requires i_data_sem for writing and releases it. 158 + * This function requires i_mutex held 159 + */ 153 160 int udf_expand_file_adinicb(struct inode *inode) 154 161 { 155 162 struct page *page; ··· 174 169 iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; 175 170 /* from now on we have normal address_space methods */ 176 171 inode->i_data.a_ops = &udf_aops; 172 + up_write(&iinfo->i_data_sem); 177 173 mark_inode_dirty(inode); 178 174 return 0; 179 175 } 176 + /* 177 + * Release i_data_sem so that we can lock a page - page lock ranks 178 + * above i_data_sem. i_mutex still protects us against file changes. 179 + */ 180 + up_write(&iinfo->i_data_sem); 180 181 181 182 page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS); 182 183 if (!page) ··· 198 187 SetPageUptodate(page); 199 188 kunmap(page); 200 189 } 190 + down_write(&iinfo->i_data_sem); 201 191 memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00, 202 192 iinfo->i_lenAlloc); 203 193 iinfo->i_lenAlloc = 0; ··· 208 196 iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; 209 197 /* from now on we have normal address_space methods */ 210 198 inode->i_data.a_ops = &udf_aops; 199 + up_write(&iinfo->i_data_sem); 211 200 err = inode->i_data.a_ops->writepage(page, &udf_wbc); 212 201 if (err) { 213 202 /* Restore everything back so that we don't lose data... */ 214 203 lock_page(page); 215 204 kaddr = kmap(page); 205 + down_write(&iinfo->i_data_sem); 216 206 memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr, 217 207 inode->i_size); 218 208 kunmap(page); 219 209 unlock_page(page); 220 210 iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; 221 211 inode->i_data.a_ops = &udf_adinicb_aops; 212 + up_write(&iinfo->i_data_sem); 222 213 } 223 214 page_cache_release(page); 224 215 mark_inode_dirty(inode); ··· 325 310 struct buffer_head *bh_result, int create) 326 311 { 327 312 int err, new; 328 - struct buffer_head *bh; 329 313 sector_t phys = 0; 330 314 struct udf_inode_info *iinfo; 331 315 ··· 337 323 338 324 err = -EIO; 339 325 new = 0; 340 - bh = NULL; 341 326 iinfo = UDF_I(inode); 342 327 343 328 down_write(&iinfo->i_data_sem); ··· 345 332 iinfo->i_next_alloc_goal++; 346 333 } 347 334 348 - err = 0; 349 335 350 - bh = inode_getblk(inode, block, &err, &phys, &new); 351 - BUG_ON(bh); 352 - if (err) 336 + phys = inode_getblk(inode, block, &err, &new); 337 + if (!phys) 353 338 goto abort; 354 - BUG_ON(!phys); 355 339 356 340 if (new) 357 341 set_buffer_new(bh_result); ··· 557 547 return err; 558 548 } 559 549 560 - static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, 561 - int *err, sector_t *phys, int *new) 550 + static sector_t inode_getblk(struct inode *inode, sector_t block, 551 + int *err, int *new) 562 552 { 563 553 static sector_t last_block; 564 - struct buffer_head *result = NULL; 565 554 struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]; 566 555 struct extent_position prev_epos, cur_epos, next_epos; 567 556 int count = 0, startnum = 0, endnum = 0; ··· 575 566 int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; 576 567 int lastblock = 0; 577 568 569 + *err = 0; 570 + *new = 0; 578 571 prev_epos.offset = udf_file_entry_alloc_offset(inode); 579 572 prev_epos.block = iinfo->i_location; 580 573 prev_epos.bh = NULL; ··· 646 635 brelse(cur_epos.bh); 647 636 brelse(next_epos.bh); 648 637 newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset); 649 - *phys = newblock; 650 - return NULL; 638 + return newblock; 651 639 } 652 640 653 641 last_block = block; ··· 674 664 brelse(cur_epos.bh); 675 665 brelse(next_epos.bh); 676 666 *err = ret; 677 - return NULL; 667 + return 0; 678 668 } 679 669 c = 0; 680 670 offset = 0; ··· 739 729 if (!newblocknum) { 740 730 brelse(prev_epos.bh); 741 731 *err = -ENOSPC; 742 - return NULL; 732 + return 0; 743 733 } 744 734 iinfo->i_lenExtents += inode->i_sb->s_blocksize; 745 735 } ··· 771 761 772 762 newblock = udf_get_pblock(inode->i_sb, newblocknum, 773 763 iinfo->i_location.partitionReferenceNum, 0); 774 - if (!newblock) 775 - return NULL; 776 - *phys = newblock; 777 - *err = 0; 764 + if (!newblock) { 765 + *err = -EIO; 766 + return 0; 767 + } 778 768 *new = 1; 779 769 iinfo->i_next_alloc_block = block; 780 770 iinfo->i_next_alloc_goal = newblocknum; ··· 785 775 else 786 776 mark_inode_dirty(inode); 787 777 788 - return result; 778 + return newblock; 789 779 } 790 780 791 781 static void udf_split_extents(struct inode *inode, int *c, int offset, ··· 1121 1111 if (bsize < 1122 1112 (udf_file_entry_alloc_offset(inode) + newsize)) { 1123 1113 err = udf_expand_file_adinicb(inode); 1124 - if (err) { 1125 - up_write(&iinfo->i_data_sem); 1114 + if (err) 1126 1115 return err; 1127 - } 1116 + down_write(&iinfo->i_data_sem); 1128 1117 } else 1129 1118 iinfo->i_lenAlloc = newsize; 1130 1119 }
+6
fs/udf/super.c
··· 1798 1798 le16_to_cpu(lvid->descTag.descCRCLength))); 1799 1799 1800 1800 lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag); 1801 + /* 1802 + * We set buffer uptodate unconditionally here to avoid spurious 1803 + * warnings from mark_buffer_dirty() when previous EIO has marked 1804 + * the buffer as !uptodate 1805 + */ 1806 + set_buffer_uptodate(bh); 1801 1807 mark_buffer_dirty(bh); 1802 1808 sbi->s_lvid_dirty = 0; 1803 1809 mutex_unlock(&sbi->s_alloc_mutex);
+10 -4
fs/udf/symlink.c
··· 41 41 pc = (struct pathComponent *)(from + elen); 42 42 switch (pc->componentType) { 43 43 case 1: 44 - if (pc->lengthComponentIdent == 0) { 45 - p = to; 46 - *p++ = '/'; 47 - } 44 + /* 45 + * Symlink points to some place which should be agreed 46 + * upon between originator and receiver of the media. Ignore. 47 + */ 48 + if (pc->lengthComponentIdent > 0) 49 + break; 50 + /* Fall through */ 51 + case 2: 52 + p = to; 53 + *p++ = '/'; 48 54 break; 49 55 case 3: 50 56 memcpy(p, "../", 3);
+1 -4
include/linux/jbd.h
··· 497 497 * @j_format_version: Version of the superblock format 498 498 * @j_state_lock: Protect the various scalars in the journal 499 499 * @j_barrier_count: Number of processes waiting to create a barrier lock 500 - * @j_barrier: The barrier lock itself 501 500 * @j_running_transaction: The current running transaction.. 502 501 * @j_committing_transaction: the transaction we are pushing to disk 503 502 * @j_checkpoint_transactions: a linked circular list of all transactions ··· 578 579 * Number of processes waiting to create a barrier lock [j_state_lock] 579 580 */ 580 581 int j_barrier_count; 581 - 582 - /* The barrier lock itself */ 583 - struct mutex j_barrier; 584 582 585 583 /* 586 584 * Transactions: The current running transaction... ··· 909 913 extern int journal_test_revoke(journal_t *, unsigned int, tid_t); 910 914 extern void journal_clear_revoke(journal_t *); 911 915 extern void journal_switch_revoke_table(journal_t *journal); 916 + extern void journal_clear_buffer_revoked_flags(journal_t *journal); 912 917 913 918 /* 914 919 * The log thread user interface: