ReiserFS 2.5 Update Patch Set 6 of 25
PATCH 1/1 ReiserFS 2.5 Update Patch Set 6 of 25
This set of patches of which this is one will update ReiserFS in 2.5 to contain all bugfixes applied to 2.4 plus allow relocating the journal plus uuid support plus fix the kdev_t compilation failure.
06-E-cleanup.diff
There is always place for Yet Another Cleanup of Reiserfs Code.
The other patches in this set are:
01-reiserfs-kdev-fixed.diff
kdev_t fixes to comply with new interface.
02-reiserfs-journal-relocation.diff
Support for relocated journals.
03-check_nlink_in_reiserfs_read_inode2.diff
It is possible that knfsd is trying to access inode of a file that is being removed from the disk by some other thread. As we update sd on unlink all that is required is to check for nlink here. This bug was first found by Sizif when debugging SquidNG/Butterfly, forgotten, and found again after Philippe Gramoulle <[email protected]> reproduced it.
More logical fix would require changes in fs/inode.c:iput() to remove inode from hash-table _after_ fs cleaned disk stuff up and in iget() to return NULL if I_FREEING inode is found in hash-table. We await Al Viro doing the more logical fix, and we provide this fix so that users can work while we wait for the better fix.
04-bitmap-range-checking.diff
Check that block number are going to free in a bitmap makes sense. This avoids oops after trying to access bitmap for wild block number.
05-prepare_for_delete_or_cut-cleanup.diff
Patch by Chris Mason <[email protected]>. prepare_for_delete_or_cut() tries to find the unformatted node in the buffer cache to make sure it isn't in use. Since unformatted nodes are never in the buffer cache, this check is useless. The page locking done by mm/vmscan.c:vmtruncate protects us from truncating away pages that are in use, so it is safe to just remove the bogus check from our code.
Since the get_hash_table was also the reason for the repeat loop, this patch removes it as well.
This should make file deletes faster, at the very least it cuts down on CPU overhead for deletes/truncates.
06-E-cleanup.diff
There is always place for Yet Another Cleanup of Reiserfs Code.
07-mmaped_data_loss_fix.diff
fixes a bug first noticed using a Freebsd nfs testing tool. When writing to a previously mmaped-filled hole in file, and then writing with write() there again, page that write() hits loses mmap-written content.
08-unlink-truncate-opened.diff
Fixes long-standing problem in reiserfs, when disk space gets leaked if crash occurred when some process hold a reference to unlinked file.
It's possible to unlink file that is still opened by some process. In this case, body of file is actually removed at the time of last close. If crash occurs in between last unlink (when directory entry for this file is removed) and last close, body doesn't get unlinked and "disk-space-leak" occurs. To prevent this, unlink-truncate-opened patch stores in the tree a special record at the time of last unlink. This record is a form of logical logging and will be either removed during following close, or replayed during next mount after a crash.
09-chown-32-bit-fix.diff
Reiserfs 3.5 disk format can only store 16 bit uid/gid inside stat-data. This patch adds error checking so that EINVAL is returned on attempt to change uid/gid of an old file to value that doesn't fit into 16 bit, in stead of silently truncating it into 16 bit.
10-journal-preallocated.diff
Patch by Chris Mason for bug found and debugged by Anne Milicia ([email protected]): don't run preallocated blocks through journal_mark_freed() and don't corrupt i_prealloc_block during __discard_prealloc().
11-double-replay.diff
Patch by Chris Mason to avoid duplicate replay of last flushed transaction.
12-infinite-replay.diff
Patch to break infinite loop in journal_read() in the case when the journal log area is completely filled with transactions.
13-scan_magic_cleanup.diff
Fixes a problem with v3.6 fs mounted readonly and then remounted rw.
14-map_block_for_writepage_highmem_fix.diff
Fixes erroroneous page access before making sure page is really accessable. Bug can be triggered only on highmem sysetms.
15-long_symlinks_fix.diff
Symlink-body length check was made against an incorrect value, allowing for too long nodes to be inserted into tree. This might lead to obscure warnings in some cases.
16-tail_data_corruption_on_mempressure.diff
Fixes a bug when mmap-write to a file tail and subsequent read cause written data to be lost due to page-cache interacting mistake in low number of free buffers situation.
17-kreiserfsd-sleep-timeout.diff
Correct a typo in fs/reiserfs/journal.c:
interruptible_sleep_on_timeout() takes timeout in jiffies, rather than seconds.
18-corrupted_fs_panic_on_lookup_fix.diff
Certain disk corruptions and i/o errors may cause lookup() to panic, which is wrong.
19-big-endian-const.diff
Suppress compilation warnings on big endian platform.
20-rename_stale_item_bug.diff
This patch fixes 2 bugs in reiserfs_rename(). First one being attempt to access item before verifying it was not moved since last access. Second is a window, where old filename may be written to disk with 'visible' flag unset without these changes be journaled.
21-reiserfs-inode_cache-fixed.diff
reiserfs_inode_cache seems to be too long. converting it to reiser_inode_cache.
22-expanding-truncate-5.diff
This patch makes sure that indirect pointers for holes are correctly filled in by zeroes at
hole-creation time. (Author is Chris Mason. fs/buffer.c (generic_cont_expand) were written by Alexander Viro)
23-romount-nobug-onclose.diff
Somebody introduced a bug in reiserfs_release_file() leading to corrupting journal for ro filesystems.
24-reiserfs-boot-verbose.diff
Do not print unsuccesful superblocks read warnings (if old or new one cannot be found). Print verbose journal info. Convert warnings to standard format.
25-mount-convert-fix.diff
Fixes a case where v3.6 filesystem can get wrong magic after converting from v3.5 one.
fs/reiserfs/bitmap.c +1 -7
@@ -498,12 +498,7 @@** to be grouped towards the start of the border */ border =le32_to_cpu (INODE_PKEY (p_s_inode)->k_dir_id) % (SB_BLOCK_COUNT (th->t_super) - bstart -1 ) ; - }else { -/* why would we want to delcare a local variable to this if statement -** name border????? -chris -** unsigned long border = 0; -*/ -if (!reiserfs_hashed_relocation (th->t_super)) { + }else if (!reiserfs_hashed_relocation (th->t_super)) { hash_in =le32_to_cpu ((INODE_PKEY (p_s_inode))->k_dir_id);/* I wonder if the CPU cost of the hash will obscure the layout
@@ -513,7 +508,6 @@ hash_out =keyed_hash (((char *) (&hash_in)),4 ); border = hash_out % (SB_BLOCK_COUNT (th->t_super) - bstart -1 ) ; - } } border += bstart ; allocated[0 ] =0 ;/* important. Allows a check later on to see if at
fs/reiserfs/buffer2.c +0 -285
309 lines not on this page · raw message
fs/reiserfs/dir.c +68 -16
94 lines not on this page · raw message
fs/reiserfs/do_balan.c +0 -7
@@ -274,13 +274,6 @@int pos_in_item;int zeros_num; -#if 0 -if (tb->insert_size [0 ] %4 ) { -reiserfs_panic (tb->tb_sb,"balance_leaf: wrong insert_size %d" , - tb->insert_size [0 ]); - } -#endif -PROC_INFO_INC ( tb -> tb_sb, balance_at[0 ] );/* Make balance in case insert_size[0] < 0 */
fs/reiserfs/fix_node.c +1 -27
@@ -806,7 +806,7 @@RFALSE ( ! *p_n_blocknr,"PAP-8135: reiserfs_new_blocknrs failed when got new blocks" ); - p_s_new_bh =reiserfs_getblk (p_s_sb, *p_n_blocknr); + p_s_new_bh =sb_getblk (p_s_sb, *p_n_blocknr);if (atomic_read (&(p_s_new_bh->b_count)) >1 ) {/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ /*
@@ -2021,23 +2021,6 @@// entry would eat 2 byte of virtual node space return sb->s_blocksize; -#if 0 - size =sizeof (struct virtual_node ) +sizeof (struct virtual_item ); - ih =B_N_PITEM_HEAD (bh,0 ); - nr_items =B_NR_ITEMS (bh); -for (i =0 ; i < nr_items; i ++, ih ++) { -/* each item occupies some space in virtual node */ - size +=sizeof (struct virtual_item ); -if (is_direntry_le_ih (ih)) -/* each entry and new one occupeis 2 byte in the virtual node */ - size += (ih_entry_count (ih) +1 ) *sizeof ( __u16 ); - } - -/* 1 bit for each bitmap block to note whether bitmap block was -dirtied in the operation */ -/* size += (SB_BMAP_NR (sb) * 2 / 8 + 4);*/ -return size; -#endif }
@@ -2342,15 +2325,6 @@reiserfs_panic (p_s_tb->tb_sb,"PAP-8320: fix_nodes: S[0] (%b %z) is not uptodate " "at the beginning of fix_nodes or not in tree (mode %c)" , p_s_tbS0, p_s_tbS0, n_op_mode); } - -// FIXME: new items have to be of 8 byte multiples. Including new -// directory items those look like old ones -/* -if (p_s_tb->insert_size[0] % 8) -reiserfs_panic (p_s_tb->tb_sb, "vs-: fix_nodes: incorrect insert_size %d, " -"mode %c", -p_s_tb->insert_size[0], n_op_mode); -*/ /* Check parameters. */ switch (n_op_mode) {
fs/reiserfs/inode.c +3 -21
@@ -17,6 +17,8 @@#define GET_BLOCK_READ_DIRECT 4/* read the tail if indirect item not found */ #define GET_BLOCK_NO_ISEM 8/* i_sem is not held, don't preallocate */ +static int reiserfs_get_block (struct inode * inode,sector_t block, +struct buffer_head * bh_result,int create);// // initially this function was derived from minix or ext2's analog and // evolved as the prototype did
@@ -1183,7 +1185,7 @@ }struct dentry *reiserfs_fh_to_dentry (struct super_block *sb,__u32 *data, -int len,int fhtype,int parent) { +int len,int fhtype,int parent) {struct cpu_key key ;struct inode *inode =NULL ;struct list_head *lp;
@@ -1323,26 +1325,6 @@unlock_kernel () ; } } - -void reiserfs_dirty_inode (struct inode * inode) { -struct reiserfs_transaction_handle th ; - -if (inode->i_sb->s_flags &MS_RDONLY ) { -reiserfs_warning ("clm-6006: writing inode %lu on readonly FS\n" , - inode->i_ino) ; -return ; - } -lock_kernel () ; - -/* this is really only used for atime updates, so they don't have -** to be included in O_SYNC or fsync -*/ -journal_begin (&th, inode->i_sb,1 ) ; -reiserfs_update_sd (&th, inode); -journal_end (&th, inode->i_sb,1 ) ; -unlock_kernel () ; -} -/* FIXME: no need any more. right? */ int reiserfs_sync_inode (struct reiserfs_transaction_handle *th,struct inode * inode)
fs/reiserfs/journal.c +0 -14
@@ -2522,20 +2522,6 @@int show_reiserfs_locks (void ) {dump_journal_writers () ; -#if 0 /* debugging code for when we are compiled static don't delete */ - p_s_sb =sb_entry (super_blocks.next); -while (p_s_sb !=sb_entry (&super_blocks)) { -if (reiserfs_is_super (p_s_sb)) { -printk ("journal lock is %d, join lock is %d, writers %d must wait is %d\n" , -atomic_read (&(SB_JOURNAL (p_s_sb)->j_wlock)), -atomic_read (&(SB_JOURNAL (p_s_sb)->j_jlock)), -atomic_read (&(SB_JOURNAL (p_s_sb)->j_wcount)), -SB_JOURNAL (p_s_sb)->j_must_wait) ; -printk ("used cnodes %d, free cnodes %d\n" ,SB_JOURNAL (p_s_sb)->j_cnode_used,SB_JOURNAL (p_s_sb)->j_cnode_free) ; - } - p_s_sb =sb_entry (p_s_sb->s_list.next); - } -#endif return 0 ; }
fs/reiserfs/namei.c +29 -30
147 lines not on this page · raw message
fs/reiserfs/stree.c +4 -13
@@ -604,7 +604,7 @@if (blocknr ==0 )return ; - bh =reiserfs_getblk (s, blocknr); + bh =sb_getblk (s, blocknr);if (!buffer_uptodate (bh)) {ll_rw_block (READA ,1 , &bh);
@@ -1328,13 +1328,13 @@while (1 ) { retval =search_item (th->t_super, &cpu_key, &path);if (retval ==IO_ERROR ) { -reiserfs_warning ("vs-: reiserfs_delete_solid_item: " +reiserfs_warning ("vs-5350: reiserfs_delete_solid_item: " "i/o failure occurred trying to delete %K\n" , &cpu_key);break ; }if (retval !=ITEM_FOUND ) {pathrelse (&path); -reiserfs_warning ("vs-: reiserfs_delete_solid_item: %k not found" , +reiserfs_warning ("vs-5355: reiserfs_delete_solid_item: %k not found" , key);break ; }
@@ -1354,7 +1354,7 @@ }// IO_ERROR, NO_DISK_SPACE, etc -reiserfs_warning ("vs-: reiserfs_delete_solid_item: " +reiserfs_warning ("vs-5360: reiserfs_delete_solid_item: " "could not delete %K due to fix_nodes failure\n" , &cpu_key);unfix_nodes (&tb);break ;
@@ -1371,15 +1371,6 @@/* for directory this deletes item containing "." and ".." */ reiserfs_do_truncate (th, inode,NULL ,0 /*no timestamp updates*/ ); -/* delete stat data */ -/* this debug code needs to go away. Trying to find a truncate race -** -- clm -- 4/1/2000 -*/ -#if 0 -if (inode->i_nlink !=0 ) { -reiserfs_warning ("clm-4001: deleting inode with link count==%d\n" , inode->i_nlink) ; - } -#endif #if defined(USE_INODE_GENERATION_COUNTER )if ( !old_format_only ( th -> t_super ) ) {
fs/reiserfs/super.c +29 -6
@@ -55,6 +55,9 @@ is_reiserfs_jr (rs)); } +static int reiserfs_remount (struct super_block * s,int * flags,char * data); +static int reiserfs_statfs (struct super_block * s,struct statfs * buf); +// // a portion of this function, particularly the VFS interface portion, // was derived from minix or ext2's analog and evolved as the
@@ -62,7 +65,7 @@// at the ext2 code and comparing. It's subfunctions contain no code // used as a template unless they are so labeled. // -void reiserfs_write_super (struct super_block * s) +static void reiserfs_write_super (struct super_block * s) {int dirty =0 ;
@@ -81,7 +84,7 @@// at the ext2 code and comparing. It's subfunctions contain no code // used as a template unless they are so labeled. // -void reiserfs_write_super_lockfs (struct super_block * s) +static void reiserfs_write_super_lockfs (struct super_block * s) {int dirty =0 ;
@@ -109,7 +112,7 @@// at the ext2 code and comparing. It's subfunctions contain no code // used as a template unless they are so labeled. // -void reiserfs_put_super (struct super_block * s) +static void reiserfs_put_super (struct super_block * s) {int i;struct reiserfs_transaction_handle th ;
@@ -196,6 +199,26 @@printk (KERN_INFO "reiserfs_inode_cache: not all structures were freed\n" ); } +/* we don't mark inodes dirty, we just log them */ +static void reiserfs_dirty_inode (struct inode * inode) { +struct reiserfs_transaction_handle th ; + +if (inode->i_sb->s_flags &MS_RDONLY ) { +reiserfs_warning ("clm-6006: writing inode %lu on readonly FS\n" , + inode->i_ino) ; +return ; + } +lock_kernel () ; + +/* this is really only used for atime updates, so they don't have +** to be included in O_SYNC or fsync +*/ +journal_begin (&th, inode->i_sb,1 ) ; +reiserfs_update_sd (&th, inode); +journal_end (&th, inode->i_sb,1 ) ; +unlock_kernel () ; +} +struct super_operations reiserfs_sops = { alloc_inode: reiserfs_alloc_inode,
@@ -313,7 +336,7 @@// at the ext2 code and comparing. It's subfunctions contain no code // used as a template unless they are so labeled. // -int reiserfs_remount (struct super_block * s,int * flags,char * data) +static int reiserfs_remount (struct super_block * s,int * flags,char * data) {struct reiserfs_super_block * rs;struct reiserfs_transaction_handle th ;
@@ -690,7 +713,7 @@// at the ext2 code and comparing. It's subfunctions contain no code // used as a template unless they are so labeled. // -struct super_block *reiserfs_read_super (struct super_block * s,void * data,int silent) +static struct super_block *reiserfs_read_super (struct super_block * s,void * data,int silent) {int size;struct inode *root_inode;
@@ -855,7 +878,7 @@// at the ext2 code and comparing. It's subfunctions contain no code // used as a template unless they are so labeled. // -int reiserfs_statfs (struct super_block * s,struct statfs * buf) +static int reiserfs_statfs (struct super_block * s,struct statfs * buf) {struct reiserfs_super_block * rs =SB_DISK_SUPER_BLOCK (s);
include/linux/reiserfs_fs.h +64 -359
606 lines not on this page · raw message
fs/reiserfs/resize.c +1 -1
@@ -111,7 +111,7 @@for (i =0 ; i < bmap_nr; i++) bitmap[i] =SB_AP_BITMAP (s)[i];for (i = bmap_nr; i < bmap_nr_new; i++) { - bitmap[i] =reiserfs_getblk (s, i * s->s_blocksize *8 ); + bitmap[i] =sb_getblk (s, i * s->s_blocksize *8 );memset (bitmap[i]->b_data,0 ,sb_blocksize (sb));reiserfs_test_and_set_le_bit (0 , bitmap[i]->b_data);