From 3e2221c73cba7d33fd5706f9bc4906ffaf421478 Mon Sep 17 00:00:00 2001 From: Dave Kleikamp Date: Wed, 25 Apr 2007 09:36:20 -0500 Subject: Copy i_flags to jfs inode flags on write This mirrors Jan Kara's patches for ext3. This patch makes sure that changes made to inode->i_flags are reflected on disk for jfs. It also moves a call of jfs_set_inode_flags() to be more consistent with where jfs_get_inode_flags() is called. Signed-off-by: Dave Kleikamp --- fs/jfs/inode.c | 1 - fs/jfs/ioctl.c | 2 ++ fs/jfs/jfs_imap.c | 2 ++ fs/jfs/jfs_inode.c | 18 ++++++++++++++++++ fs/jfs/jfs_inode.h | 1 + 5 files changed, 23 insertions(+), 1 deletion(-) (limited to 'fs/jfs') diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index e285022f006c..3467dde27e5a 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -55,7 +55,6 @@ void jfs_read_inode(struct inode *inode) inode->i_op = &jfs_file_inode_operations; init_special_inode(inode, inode->i_mode, inode->i_rdev); } - jfs_set_inode_flags(inode); } /* diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c index ed814b1ff4d9..fe063af6fd2f 100644 --- a/fs/jfs/ioctl.c +++ b/fs/jfs/ioctl.c @@ -59,6 +59,7 @@ int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, switch (cmd) { case JFS_IOC_GETFLAGS: + jfs_get_inode_flags(jfs_inode); flags = jfs_inode->mode2 & JFS_FL_USER_VISIBLE; flags = jfs_map_ext2(flags, 0); return put_user(flags, (int __user *) arg); @@ -78,6 +79,7 @@ int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, if (!S_ISDIR(inode->i_mode)) flags &= ~JFS_DIRSYNC_FL; + jfs_get_inode_flags(jfs_inode); oldflags = jfs_inode->mode2; /* diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index aa5124b643b1..c465607be991 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c @@ -3078,6 +3078,7 @@ static int copy_from_dinode(struct dinode * dip, struct inode *ip) jfs_ip->fileset = le32_to_cpu(dip->di_fileset); jfs_ip->mode2 = le32_to_cpu(dip->di_mode); + jfs_set_inode_flags(ip); ip->i_mode = le32_to_cpu(dip->di_mode) & 0xffff; if (sbi->umask != -1) { @@ -3174,6 +3175,7 @@ static void copy_to_dinode(struct dinode * dip, struct inode *ip) dip->di_gid = cpu_to_le32(ip->i_gid); else dip->di_gid = cpu_to_le32(jfs_ip->saved_gid); + jfs_get_inode_flags(jfs_ip); /* * mode2 is only needed for storing the higher order bits. * Trust i_mode for the lower order ones diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index 4c67ed97682b..ed6574bee51a 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c @@ -45,6 +45,24 @@ void jfs_set_inode_flags(struct inode *inode) inode->i_flags |= S_SYNC; } +void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip) +{ + unsigned int flags = jfs_ip->vfs_inode.i_flags; + + jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_APPEND_FL | JFS_NOATIME_FL | + JFS_DIRSYNC_FL | JFS_SYNC_FL); + if (flags & S_IMMUTABLE) + jfs_ip->mode2 |= JFS_IMMUTABLE_FL; + if (flags & S_APPEND) + jfs_ip->mode2 |= JFS_APPEND_FL; + if (flags & S_NOATIME) + jfs_ip->mode2 |= JFS_NOATIME_FL; + if (flags & S_DIRSYNC) + jfs_ip->mode2 |= JFS_DIRSYNC_FL; + if (flags & S_SYNC) + jfs_ip->mode2 |= JFS_SYNC_FL; +} + /* * NAME: ialloc() * diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index 6802837f757e..2374b595f2e1 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h @@ -31,6 +31,7 @@ extern void jfs_truncate(struct inode *); extern void jfs_truncate_nolock(struct inode *, loff_t); extern void jfs_free_zero_link(struct inode *); extern struct dentry *jfs_get_parent(struct dentry *dentry); +extern void jfs_get_inode_flags(struct jfs_inode_info *); extern void jfs_set_inode_flags(struct inode *); extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int); -- cgit v1.2.3 From 3cbb1c8e1a4787d3dc2951b7615d7bb3788c49a0 Mon Sep 17 00:00:00 2001 From: Milind Arun Choudhary Date: Thu, 26 Apr 2007 07:30:29 -0500 Subject: JFS: use __set_current_state() use __set_current_state(TASK_*) instead of current->state = TASK_* Signed-off-by: Milind Arun Choudhary Signed-off-by: Andrew Morton Signed-off-by: Dave Kleikamp --- fs/jfs/jfs_lock.h | 2 +- fs/jfs/jfs_logmgr.c | 4 ++-- fs/jfs/jfs_txnmgr.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'fs/jfs') diff --git a/fs/jfs/jfs_lock.h b/fs/jfs/jfs_lock.h index df48ece4b7a3..ecf04882265e 100644 --- a/fs/jfs/jfs_lock.h +++ b/fs/jfs/jfs_lock.h @@ -45,7 +45,7 @@ do { \ io_schedule(); \ lock_cmd; \ } \ - current->state = TASK_RUNNING; \ + __set_current_state(TASK_RUNNING); \ remove_wait_queue(&wq, &__wait); \ } while (0) diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 5065baa530b6..ff7f1beec30d 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -1590,7 +1590,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait) set_current_state(TASK_UNINTERRUPTIBLE); LOGGC_UNLOCK(log); schedule(); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); LOGGC_LOCK(log); remove_wait_queue(&target->gcwait, &__wait); } @@ -2361,7 +2361,7 @@ int jfsIOWait(void *arg) } else { set_current_state(TASK_INTERRUPTIBLE); schedule(); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); } } while (!kthread_should_stop()); diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index 03893acbfda4..9b3de0aaa034 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c @@ -136,7 +136,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event) set_current_state(TASK_UNINTERRUPTIBLE); TXN_UNLOCK(); io_schedule(); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue(event, &wait); } @@ -2798,7 +2798,7 @@ int jfs_lazycommit(void *arg) set_current_state(TASK_INTERRUPTIBLE); LAZY_UNLOCK(flags); schedule(); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); remove_wait_queue(&jfs_commit_thread_wait, &wq); } } while (!kthread_should_stop()); @@ -2990,7 +2990,7 @@ int jfs_sync(void *arg) set_current_state(TASK_INTERRUPTIBLE); TXN_UNLOCK(); schedule(); - current->state = TASK_RUNNING; + __set_current_state(TASK_RUNNING); } } while (!kthread_should_stop()); -- cgit v1.2.3 From 05ec9e26be1f668ccba4ca54d9a4966c6208c611 Mon Sep 17 00:00:00 2001 From: Dave Kleikamp Date: Sat, 5 May 2007 14:24:05 -0500 Subject: JFS: Fix race waking up jfsIO kernel thread It's possible for a journal I/O request to be added to the log_redrive queue and the jfsIO thread to be awakened after the thread releases log_redrive_lock but before it sets its state to TASK_INTERRUPTIBLE. The jfsIO thread should set the state before giving up the spinlock, so the waking thread will really wake it. Signed-off-by: Dave Kleikamp --- fs/jfs/jfs_logmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/jfs') diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index ff7f1beec30d..16c62680fcd6 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -2354,12 +2354,13 @@ int jfsIOWait(void *arg) lbmStartIO(bp); spin_lock_irq(&log_redrive_lock); } - spin_unlock_irq(&log_redrive_lock); if (freezing(current)) { + spin_unlock_irq(&log_redrive_lock); refrigerator(); } else { set_current_state(TASK_INTERRUPTIBLE); + spin_unlock_irq(&log_redrive_lock); schedule(); __set_current_state(TASK_RUNNING); } -- cgit v1.2.3