Whamcloud - gitweb
b=5903
authornathan <nathan>
Fri, 25 Mar 2005 22:16:41 +0000 (22:16 +0000)
committernathan <nathan>
Fri, 25 Mar 2005 22:16:41 +0000 (22:16 +0000)
minor fix for 5903

lustre/mds/handler.c
lustre/mds/mds_lov.c
lustre/obdfilter/filter.c

index 2ebe618..d159139 100644 (file)
@@ -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);
index 7641aa3..a167f40 100644 (file)
@@ -513,6 +513,7 @@ int mds_lov_synchronize(void *data)
         sigfillset(&current->blocked);
         RECALC_SIGPENDING;
         SIGNAL_MASK_UNLOCK(current, flags);
+        unlock_kernel();
 
         obd = mlsi->mlsi_obd;
         uuid = mlsi->mlsi_uuid;
index ff6fe1e..647fe5e 100644 (file)
@@ -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);