From 9126c8d93bbd3d33cbb9bede5180dfeeb5756433 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 25 Mar 2005 22:16:41 +0000 Subject: [PATCH] b=5903 minor fix for 5903 --- lustre/mds/handler.c | 12 ++++++++++-- lustre/mds/mds_lov.c | 1 + lustre/obdfilter/filter.c | 13 +++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 2ebe618c..d159139 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -1674,6 +1674,7 @@ static int mds_cleanup(struct obd_device *obd) { struct mds_obd *mds = &obd->u.mds; ll_sbdev_type save_dev; + int must_relock = 0; ENTRY; if (mds->mds_sb == NULL) @@ -1694,7 +1695,12 @@ static int mds_cleanup(struct obd_device *obd) } mds_fs_cleanup(obd); - unlock_kernel(); + /* We can only unlock kernel if we are in the context of sys_ioctl, + otherwise we never called lock_kernel */ + if (kernel_locked()) { + unlock_kernel(); + must_relock++; + } /* 2 seems normal on mds, (may_umount() also expects 2 fwiw), but we only see 1 at this point in obdfilter. */ @@ -1718,7 +1724,9 @@ static int mds_cleanup(struct obd_device *obd) ll_clear_rdonly(save_dev); - lock_kernel(); + if (must_relock) + lock_kernel(); + fsfilt_put_ops(obd->obd_fsops); LCONSOLE_INFO("MDT %s has stopped.\n", obd->obd_name); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 7641aa3..a167f40 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -513,6 +513,7 @@ int mds_lov_synchronize(void *data) sigfillset(¤t->blocked); RECALC_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags); + unlock_kernel(); obd = mlsi->mlsi_obd; uuid = mlsi->mlsi_uuid; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index ff6fe1e..647fe5e 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1352,6 +1352,7 @@ static int filter_cleanup(struct obd_device *obd) { struct filter_obd *filter = &obd->u.filter; ll_sbdev_type save_dev; + int must_relock = 0; ENTRY; if (obd->obd_fail) @@ -1385,7 +1386,13 @@ static int filter_cleanup(struct obd_device *obd) obd->obd_name, filter->fo_vfsmnt, atomic_read(&filter->fo_vfsmnt->mnt_count)); - unlock_kernel(); + /* We can only unlock kernel if we are in the context of sys_ioctl, + otherwise we never called lock_kernel */ + if (kernel_locked()) { + unlock_kernel(); + must_relock++; + } + mntput(filter->fo_vfsmnt); //destroy_buffers(filter->fo_sb->s_dev); filter->fo_sb = NULL; @@ -1394,8 +1401,10 @@ static int filter_cleanup(struct obd_device *obd) ll_clear_rdonly(save_dev); + if (must_relock) + lock_kernel(); + fsfilt_put_ops(obd->obd_fsops); - lock_kernel(); LCONSOLE_INFO("OST %s has stopped.\n", obd->obd_name); -- 1.8.3.1