Skip to content

Commit

Permalink
Sanitize qnx4 fsync handling
Browse files Browse the repository at this point in the history
* have directory operations use mark_buffer_dirty_inode(),
  so that sync_mapping_buffers() would get those.
* make qnx4_write_inode() honour its last argument.
* get rid of insane copies of very ancient "walk the indirect blocks"
  in qnx4/fsync - they never matched the actual fs layout and, fortunately,
  never'd been called.  Again, all this junk is not needed; ->fsync()
  should just do sync_mapping_buffers + sync_inode (and if we implement
  block allocation for qnx4, we'll need to use mark_buffer_dirty_inode()
  for extent blocks)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jun 12, 2009
1 parent d5aacad commit 79d2576
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 202 deletions.
2 changes: 1 addition & 1 deletion fs/qnx4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

obj-$(CONFIG_QNX4FS_FS) += qnx4.o

qnx4-objs := inode.o dir.o namei.o file.o bitmap.o truncate.o fsync.o
qnx4-objs := inode.o dir.o namei.o file.o bitmap.o truncate.o
2 changes: 1 addition & 1 deletion fs/qnx4/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const struct file_operations qnx4_dir_operations =
{
.read = generic_read_dir,
.readdir = qnx4_readdir,
.fsync = file_fsync,
.fsync = simple_fsync,
};

const struct inode_operations qnx4_dir_inode_operations =
Expand Down
2 changes: 1 addition & 1 deletion fs/qnx4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const struct file_operations qnx4_file_operations =
#ifdef CONFIG_QNX4FS_RW
.write = do_sync_write,
.aio_write = generic_file_aio_write,
.fsync = qnx4_sync_file,
.fsync = simple_fsync,
#endif
};

Expand Down
169 changes: 0 additions & 169 deletions fs/qnx4/fsync.c

This file was deleted.

38 changes: 12 additions & 26 deletions fs/qnx4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/smp_lock.h>
#include <linux/pagemap.h>
#include <linux/buffer_head.h>
#include <linux/writeback.h>
#include <linux/vfs.h>
#include <asm/uaccess.h>

Expand All @@ -34,31 +35,6 @@ static const struct super_operations qnx4_sops;

#ifdef CONFIG_QNX4FS_RW

int qnx4_sync_inode(struct inode *inode)
{
int err = 0;
# if 0
struct buffer_head *bh;

bh = qnx4_update_inode(inode);
if (bh && buffer_dirty(bh))
{
sync_dirty_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh))
{
printk ("IO error syncing qnx4 inode [%s:%08lx]\n",
inode->i_sb->s_id, inode->i_ino);
err = -1;
}
brelse (bh);
} else if (!bh) {
err = -1;
}
# endif

return err;
}

static void qnx4_delete_inode(struct inode *inode)
{
QNX4DEBUG(("qnx4: deleting inode [%lu]\n", (unsigned long) inode->i_ino));
Expand All @@ -70,7 +46,7 @@ static void qnx4_delete_inode(struct inode *inode)
unlock_kernel();
}

static int qnx4_write_inode(struct inode *inode, int unused)
static int qnx4_write_inode(struct inode *inode, int do_sync)
{
struct qnx4_inode_entry *raw_inode;
int block, ino;
Expand Down Expand Up @@ -107,6 +83,16 @@ static int qnx4_write_inode(struct inode *inode, int unused)
raw_inode->di_ctime = cpu_to_le32(inode->i_ctime.tv_sec);
raw_inode->di_first_xtnt.xtnt_size = cpu_to_le32(inode->i_blocks);
mark_buffer_dirty(bh);
if (do_sync) {
sync_dirty_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh)) {
printk("qnx4: IO error syncing inode [%s:%08x]\n",
inode->i_sb->s_id, ino);
brelse(bh);
unlock_kernel();
return -EIO;
}
}
brelse(bh);
unlock_kernel();
return 0;
Expand Down
4 changes: 2 additions & 2 deletions fs/qnx4/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ int qnx4_rmdir(struct inode *dir, struct dentry *dentry)
de->di_status = 0;
memset(de->di_fname, 0, sizeof de->di_fname);
de->di_mode = 0;
mark_buffer_dirty(bh);
mark_buffer_dirty_inode(bh, dir);
clear_nlink(inode);
mark_inode_dirty(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
Expand Down Expand Up @@ -232,7 +232,7 @@ int qnx4_unlink(struct inode *dir, struct dentry *dentry)
de->di_status = 0;
memset(de->di_fname, 0, sizeof de->di_fname);
de->di_mode = 0;
mark_buffer_dirty(bh);
mark_buffer_dirty_inode(bh, dir);
dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
mark_inode_dirty(dir);
inode->i_ctime = dir->i_ctime;
Expand Down
2 changes: 0 additions & 2 deletions include/linux/qnx4_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ extern void qnx4_truncate(struct inode *inode);
extern void qnx4_free_inode(struct inode *inode);
extern int qnx4_unlink(struct inode *dir, struct dentry *dentry);
extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry);
extern int qnx4_sync_file(struct file *file, struct dentry *dentry, int);
extern int qnx4_sync_inode(struct inode *inode);

static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb)
{
Expand Down

0 comments on commit 79d2576

Please sign in to comment.