aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/super.c
diff options
context:
space:
mode:
authorVahram Martirosyan <vmartirosyan@gmail.com>2013-05-24 04:57:12 -0400
committerDave Kleikamp <dave.kleikamp@oracle.com>2013-05-24 17:03:42 -0400
commite9b376671910d105c5e61103111b96209c729529 (patch)
tree1c52287d580870e8bec478aa698936d50d5d0a56 /fs/jfs/super.c
parent514e250f67d2b2a8ab08dc9c3650af19a411c926 (diff)
jfs: Several bugs in jfs_freeze() and jfs_unfreeze()
The mentioned functions do not pay attention to the error codes returned by the functions updateSuper(), lmLogInit() and lmLogShutdown(). It brings to system crash later when writing to log. The patch adds corresponding code to check and return the error codes and to print correct error messages in case of errors. Found by Linux File System Verification project (linuxtesting.org). Signed-off-by: Vahram Martirosyan <vahram.martirosyan@linuxtesting.org> Reviewed-by: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Diffstat (limited to 'fs/jfs/super.c')
-rw-r--r--fs/jfs/super.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 2003e830ed1c..788e0a9c1fb0 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -611,11 +611,28 @@ static int jfs_freeze(struct super_block *sb)
611{ 611{
612 struct jfs_sb_info *sbi = JFS_SBI(sb); 612 struct jfs_sb_info *sbi = JFS_SBI(sb);
613 struct jfs_log *log = sbi->log; 613 struct jfs_log *log = sbi->log;
614 int rc = 0;
614 615
615 if (!(sb->s_flags & MS_RDONLY)) { 616 if (!(sb->s_flags & MS_RDONLY)) {
616 txQuiesce(sb); 617 txQuiesce(sb);
617 lmLogShutdown(log); 618 rc = lmLogShutdown(log);
618 updateSuper(sb, FM_CLEAN); 619 if (rc) {
620 jfs_error(sb, "jfs_freeze: lmLogShutdown failed");
621
622 /* let operations fail rather than hang */
623 txResume(sb);
624
625 return rc;
626 }
627 rc = updateSuper(sb, FM_CLEAN);
628 if (rc) {
629 jfs_err("jfs_freeze: updateSuper failed\n");
630 /*
631 * Don't fail here. Everything succeeded except
632 * marking the superblock clean, so there's really
633 * no harm in leaving it frozen for now.
634 */
635 }
619 } 636 }
620 return 0; 637 return 0;
621} 638}
@@ -627,13 +644,18 @@ static int jfs_unfreeze(struct super_block *sb)
627 int rc = 0; 644 int rc = 0;
628 645
629 if (!(sb->s_flags & MS_RDONLY)) { 646 if (!(sb->s_flags & MS_RDONLY)) {
630 updateSuper(sb, FM_MOUNT); 647 rc = updateSuper(sb, FM_MOUNT);
631 if ((rc = lmLogInit(log))) 648 if (rc) {
632 jfs_err("jfs_unlock failed with return code %d", rc); 649 jfs_error(sb, "jfs_unfreeze: updateSuper failed");
633 else 650 goto out;
634 txResume(sb); 651 }
652 rc = lmLogInit(log);
653 if (rc)
654 jfs_error(sb, "jfs_unfreeze: lmLogInit failed");
655out:
656 txResume(sb);
635 } 657 }
636 return 0; 658 return rc;
637} 659}
638 660
639static struct dentry *jfs_do_mount(struct file_system_type *fs_type, 661static struct dentry *jfs_do_mount(struct file_system_type *fs_type,