fs/inode.c sync fix and fs/ext2/inode.c tidy

fs/inode.c sync fix and fs/ext2/inode.c tidy

Post by Benjamin LaHais » Sat, 09 Mar 2002 06:20:34



These patches can be pulled from bk://bcrlbits.bkbits.net/linux-2.5
First one: in fs/ext2/inode.c merge ext2_fsync_inode into ext2_sync_file
as that's the only place it can be called from.

Second one only touches fs/inode.c:sync_one to replace the if I_LOCK
check with a while.  Basically, the inode sync could end up deferring
to writeback if the inode is already locked.  This breaks things like
O_SYNC which assume the inode sync is synchronous and only returns
when the data is safely on disk.  This patch will need to go into 2.4
after a bit of testing for unexpected interactions.

Patches are included below for reading.

                -ben
--
"A man with a bass just walked in,
 and he's putting it down
 on the floor."

diff -Nru a/fs/ext2/ext2.h b/fs/ext2/ext2.h
--- a/fs/ext2/ext2.h    Thu Mar  7 16:02:59 2002

 /* fsync.c */
 extern int ext2_sync_file (struct file *, struct dentry *, int);
-extern int ext2_fsync_inode (struct inode *, int);

 /* ialloc.c */
 extern struct inode * ext2_new_inode (struct inode *, int);
diff -Nru a/fs/ext2/fsync.c b/fs/ext2/fsync.c
--- a/fs/ext2/fsync.c   Thu Mar  7 16:02:59 2002

 int ext2_sync_file(struct file * file, struct dentry *dentry, int datasync)
 {
        struct inode *inode = dentry->d_inode;
-       return ext2_fsync_inode(inode, datasync);
-}
-
-int ext2_fsync_inode(struct inode *inode, int datasync)
-{
        int err;

        err  = fsync_inode_buffers(inode);

diff -Nru a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c        Thu Mar  7 16:02:59 2002

 static inline void sync_one(struct inode *inode, int sync)
 {
-       if (inode->i_state & I_LOCK) {
+       while (inode->i_state & I_LOCK) {
                __iget(inode);
                spin_unlock(&inode_lock);
                __wait_on_inode(inode);
                iput(inode);
                spin_lock(&inode_lock);
-       } else {
-               __sync_one(inode, sync);
        }
+
+       __sync_one(inode, sync);
 }

 static inline void sync_list(struct list_head *head)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. 2.0.31-pre7 et al: EXT2-fs panic bad inode number: 0

Kernel panic: EXT2-fs panic (device 08:03): ext2_read_inode: bad inode number: 0

This is my /usr partition. This almost always happens during heavy SCSI
bus activity (often at 2AM when the incremental backup starts) Its
happened with 2.0.31pre5,6,7 and 2.0.30 & 29. I believe it started
somewhere in the 2.0.2x series. I am downloading those kernels now in an
effort to find out. It happens every few days. I searched dejanews for
this message and found one post with a kernel patch. That patch looked
to be incorporated in the 2.0.30 kernel so I upgraded from 2.0.29. It
seemed that the frequency went down to every few weeks at that point.
However the problem was worsened by my recently consolidating my
fulltime PPP connection and UUCP connections to this machine. It also
gets a small (100Mb/day) newsfeed.

This is a 486-66 VLB with a buslogic BT445S controller, HP 2Gb disk and
DAT tape, 32Mb parity RAM, WD8013 ethernet.

I never see any other error messages. I ran badblocks without error.  I
made it happen in a few minutes with 10 simultaneous 10Mb bonnies. The
second time I tried that (after a reboot) the machine locked up solid
(no disk activity)

My questions:

1) Can I supply more info to help track this down? Is it possibly a
hardware problem? (the message is always exactly the same) Any
particular kernel version to try?

2) How can I make the machine reboot when this happens? Regardless of
/proc/sys/kernel/panic the machine never reboots by itself. In fact all
attempts at soft rebooting fail. df, shutdown, sync, telinit and
ctl-alt-del all hang. My usual method is to kill crond, pppd and inn (in
an effort to close as many open files as possible) and then hit the
reset button. Do I need to use the software watchdog to force a reboot?  

Many thanks for any help.
Andrew Burgess

2. Turning off ping

3. PROBLEM: ext2-fs panic (inode=2, block=16777477)

4. Lo, for I have beheld the almighty ports tree, and I am in awe.

5. inode crashed root partition/EXT2-fs panic

6. NIS+, dumping

7. EXT2-fs warning: bit already cleared for inode XXXXX ?

8. Password change without shell access?

9. Fix fs/fat/inode.c when compiled with gcc-3.0.x

10. Linux 2.5.68 - Fix FreeXid after return in fs/cifs/inode.c

11. Fix compile error in fs/cramfs/inode.c in 2.5.66

12. HELP PLEASE: can't fix FS (inode count too big)

13. linux-2.5.18: fs/hfs/inode.c: PATCH to fix compilation error