From 32a4e45e0e5ce912b7a03c703f42a70fe5781084 Mon Sep 17 00:00:00 2001 From: "Andriy.Skulysh" Date: Tue, 30 Aug 2011 11:42:31 +0300 Subject: [PATCH] LU-836 ldiskfs: require ldiskfs filesystem has journal Add check for journal presence during ldiskfs mount Xyratex-Bug-Id: MRP-118 Change-Id: If26005f7b597ed8815991fac7cda80e1df2f36e9 Signed-off-by: Andriy Skulysh Reviewed-by: Alexey Lyashkov Reviewed-by: Andrew Perepechko Reviewed-on: http://review.whamcloud.com/1687 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/lvfs/fsfilt_ext3.c | 6 ++++++ lustre/mds/handler.c | 23 +++++++++++++++-------- lustre/mgc/mgc_request.c | 4 +++- lustre/mgs/mgs_fs.c | 4 +++- lustre/obdfilter/filter.c | 4 +++- lustre/tests/conf-sanity.sh | 16 ++++++++++++++++ 6 files changed, 46 insertions(+), 11 deletions(-) diff --git a/lustre/lvfs/fsfilt_ext3.c b/lustre/lvfs/fsfilt_ext3.c index 209f433..454bd3e 100644 --- a/lustre/lvfs/fsfilt_ext3.c +++ b/lustre/lvfs/fsfilt_ext3.c @@ -1450,6 +1450,12 @@ static int fsfilt_ext3_setup(struct super_block *sb) sbi->dx_unlock = fsfilt_ext3_dx_unlock; #endif #endif + if (!EXT3_HAS_COMPAT_FEATURE(sb, + EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { + CERROR("ext3 mounted without journal\n"); + return -EINVAL; + } + #ifdef S_PDIROPS CWARN("Enabling PDIROPS\n"); set_opt(sbi->s_mount_opt, PDIROPS); diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 35af1a9..2163dcd 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -262,22 +262,25 @@ struct lvfs_callback_ops mds_lvfs_ops = { l_fid2dentry: mds_lvfs_fid2dentry, }; -static void mds_init_ctxt(struct obd_device *obd, struct vfsmount *mnt) +static int mds_init_ctxt(struct obd_device *obd, struct vfsmount *mnt) { struct mds_obd *mds = &obd->u.mds; + int rc; mds->mds_obt.obt_vfsmnt = mnt; /* why not mnt->mnt_sb instead of mnt->mnt_root->d_inode->i_sb? */ obd->u.obt.obt_sb = mnt->mnt_root->d_inode->i_sb; obd->u.obt.obt_magic = OBT_MAGIC; - fsfilt_setup(obd, obd->u.obt.obt_sb); + rc = fsfilt_setup(obd, obd->u.obt.obt_sb); + if (rc) + return rc; OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt); obd->obd_lvfs_ctxt.pwdmnt = mnt; obd->obd_lvfs_ctxt.pwd = mnt->mnt_root; obd->obd_lvfs_ctxt.fs = get_ds(); obd->obd_lvfs_ctxt.cb_ops = mds_lvfs_ops; - return; + return 0; } /*mds still need lov setup here*/ @@ -316,14 +319,16 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg) cfs_init_rwsem(&mds->mds_notify_lock); obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd)); - mds_init_ctxt(obd, mnt); + rc = mds_init_ctxt(obd, mnt); + if (rc) + GOTO(err_putfs, rc); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); dentry = simple_mkdir(cfs_fs_pwd(current->fs), mnt, "OBJECTS", 0777, 1); if (IS_ERR(dentry)) { rc = PTR_ERR(dentry); CERROR("cannot create OBJECTS directory: rc = %d\n", rc); - GOTO(err_putfs, rc); + GOTO(err_pop, rc); } mds->mds_objects_dir = dentry; @@ -348,14 +353,16 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg) if (rc) GOTO(err_objects, rc); -err_pop: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - RETURN(rc); + RETURN(0); + err_objects: dput(mds->mds_objects_dir); +err_pop: + pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); err_putfs: fsfilt_put_ops(obd->obd_fsops); - goto err_pop; + return rc; } static int mds_cmd_cleanup(struct obd_device *obd) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 914b5be..18f93f9 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -633,7 +633,9 @@ static int mgc_fs_setup(struct obd_device *obd, struct super_block *sb, } cli->cl_mgc_vfsmnt = mnt; - fsfilt_setup(obd, mnt->mnt_sb); + err = fsfilt_setup(obd, mnt->mnt_sb); + if (err) + GOTO(err_ops, err); OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt); obd->obd_lvfs_ctxt.pwdmnt = mnt; diff --git a/lustre/mgs/mgs_fs.c b/lustre/mgs/mgs_fs.c index f414069..75d3781 100644 --- a/lustre/mgs/mgs_fs.c +++ b/lustre/mgs/mgs_fs.c @@ -162,7 +162,9 @@ int mgs_fs_setup(struct obd_device *obd, struct vfsmount *mnt) mgs->mgs_vfsmnt = mnt; mgs->mgs_sb = mnt->mnt_root->d_inode->i_sb; - fsfilt_setup(obd, mgs->mgs_sb); + rc = fsfilt_setup(obd, mgs->mgs_sb); + if (rc) + RETURN(rc); OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt); obd->obd_lvfs_ctxt.pwdmnt = mnt; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 63a0664..17ace2e 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -2038,7 +2038,9 @@ int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg, filter->fo_fstype = mnt->mnt_sb->s_type->name; CDEBUG(D_SUPER, "%s: mnt = %p\n", filter->fo_fstype, mnt); - fsfilt_setup(obd, obd->u.obt.obt_sb); + rc = fsfilt_setup(obd, obd->u.obt.obt_sb); + if (rc) + GOTO(err_ops, rc); OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt); obd->obd_lvfs_ctxt.pwdmnt = mnt; diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index b8bc4bb..36b2f97 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -2821,6 +2821,22 @@ test_61() { # LU-80 } run_test 61 "large xattr" +test_62() { + # MRP-118 + local mdsdev=$(mdsdevname 1) + local ostdev=$(ostdevname 1) + + echo "disable journal for mds" + do_facet mds tune2fs -O ^has_journal $mdsdev || error "tune2fs failed" + start_mds && error "MDT start should fail" + echo "disable journal for ost" + do_facet ost1 tune2fs -O ^has_journal $ostdev || error "tune2fs failed" + start_ost && error "OST start should fail" + cleanup || return $? + reformat_and_config +} +run_test 62 "start with disabled journal" + if ! combined_mgs_mds ; then stop mgs fi -- 1.8.3.1