If someone has a good way to test if this makes any difference to the corruption issue I would be appreciated.
cheers
Code: Select all
--- linux-2.6.16.28/fs/fatx/dir.c.orig 2006-09-14 11:19:24.000000000 +1000
+++ linux-2.6.16.28/fs/fatx/dir.c 2006-09-14 11:20:00.000000000 +1000
@@ -286,21 +286,23 @@
struct super_block *sb = dir->i_sb;
struct buffer_head *bh;
struct fatx_dir_entry *de, *endp;
- int err = 0, nr_slots;
+ int err = 0;
bh = NULL;
+ de = NULL;
if (fatx_get_entry(dir, &pos, &bh, &de) < 0) {
err = -EIO;
}
- endp = (struct fatx_dir_entry *)(bh->b_data + sb->s_blocksize);
- de->name_length = DELETED_FLAG;
- de++;
- nr_slots--;
- mark_buffer_dirty(bh);
- if (IS_DIRSYNC(dir))
- err = sync_dirty_buffer(bh);
- brelse(bh);
+ if ((bh != NULL) && (de != NULL)) {
+ endp = (struct fatx_dir_entry *)(bh->b_data + sb->s_blocksize);
+ de->name_length = DELETED_FLAG;
+ de++;
+ mark_buffer_dirty(bh);
+ if (IS_DIRSYNC(dir))
+ err = sync_dirty_buffer(bh);
+ brelse(bh);
+ }
return err;
}