Whamcloud - gitweb
LU-6601 osp: update obd status while osp status changed
[fs/lustre-release.git] / lustre / osp / osp_dev.c
index 2a9d30f..510e310 100644 (file)
 #define DEBUG_SUBSYSTEM S_MDS
 
 #include <linux/kthread.h>
-#include <obd_class.h>
+
 #include <lustre_ioctl.h>
-#include <lustre_param.h>
 #include <lustre_log.h>
+#include <lustre_obdo.h>
+#include <lustre_param.h>
+#include <obd_class.h>
 
 #include "osp_internal.h"
 
@@ -719,9 +721,13 @@ static int osp_statfs(const struct lu_env *env, struct dt_device *dev,
                      struct obd_statfs *sfs)
 {
        struct osp_device *d = dt2osp_dev(dev);
+       struct obd_import *imp = d->opd_obd->u.cli.cl_import;
 
        ENTRY;
 
+       if (imp->imp_state == LUSTRE_IMP_CLOSED)
+               RETURN(-ESHUTDOWN);
+
        if (unlikely(d->opd_imp_active == 0))
                RETURN(-ENOTCONN);
 
@@ -752,17 +758,7 @@ static int osp_statfs(const struct lu_env *env, struct dt_device *dev,
               LPU64" files, "LPU64" free files\n", d->opd_obd->obd_name,
               sfs->os_blocks, sfs->os_bfree, sfs->os_bavail,
               sfs->os_files, sfs->os_ffree);
-
-       /* ENOSPC could be for two reasons,
-        * 1) not enough inodes 2) not enough blocks
-        * for 1) lod should use preallocated objects
-        * and for 2) shouldn`t. So, here for ENOSPC
-        * different values is returned to spend preallocated.
-        */
-       if (d->opd_pre_status == -ENOSPC && sfs->os_ffree < 32)
-               RETURN(0);
-
-       RETURN(d->opd_pre_status);
+       RETURN(0);
 }
 
 static int osp_sync_timeout(void *data)
@@ -1597,6 +1593,7 @@ static int osp_import_event(struct obd_device *obd, struct obd_import *imp,
        case IMP_EVENT_INACTIVE:
                d->opd_imp_active = 0;
                d->opd_imp_connected = 0;
+               d->opd_obd->obd_inactive = 1;
                if (d->opd_connect_mdt)
                        break;
 
@@ -1614,6 +1611,7 @@ static int osp_import_event(struct obd_device *obd, struct obd_import *imp,
                        d->opd_new_connection = 1;
                d->opd_imp_connected = 1;
                d->opd_imp_seen_connected = 1;
+               d->opd_obd->obd_inactive = 0;
                if (d->opd_connect_mdt)
                        break;
 
@@ -1624,6 +1622,9 @@ static int osp_import_event(struct obd_device *obd, struct obd_import *imp,
                CDEBUG(D_HA, "got connected\n");
                break;
        case IMP_EVENT_INVALIDATE:
+               if (d->opd_connect_mdt)
+                       osp_invalidate_request(d);
+
                if (obd->obd_namespace == NULL)
                        break;
                ldlm_namespace_cleanup(obd->obd_namespace, LDLM_FL_LOCAL_ONLY);
@@ -1657,7 +1658,7 @@ static int osp_import_event(struct obd_device *obd, struct obd_import *imp,
  * \retval negative    negative errno if the ioctl handling failed.
  */
 static int osp_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
-                        void *karg, void *uarg)
+                        void *karg, void __user *uarg)
 {
        struct obd_device       *obd = exp->exp_obd;
        struct osp_device       *d;