Whamcloud - gitweb
LU-4277 lod: handle os_state as a flag, check READONLY
[fs/lustre-release.git] / lustre / lod / lod_qos.c
index e7b1de0..51d6603 100644 (file)
@@ -159,6 +159,10 @@ static int lod_statfs_and_check(const struct lu_env *env, struct lod_device *d,
        if (rc && rc != -ENOTCONN)
                CERROR("%s: statfs: rc = %d\n", lod2obd(d)->obd_name, rc);
 
        if (rc && rc != -ENOTCONN)
                CERROR("%s: statfs: rc = %d\n", lod2obd(d)->obd_name, rc);
 
+       /* If the OST is readonly then we can't allocate objects there */
+       if (sfs->os_state & OS_STATE_READONLY)
+               rc = -EROFS;
+
        /* check whether device has changed state (active, inactive) */
        if (rc != 0 && ost->ltd_active) {
                /* turned inactive? */
        /* check whether device has changed state (active, inactive) */
        if (rc != 0 && ost->ltd_active) {
                /* turned inactive? */
@@ -771,7 +775,7 @@ repeat_find:
                /*
                 * try to use another OSP if this one is degraded
                 */
                /*
                 * try to use another OSP if this one is degraded
                 */
-               if (sfs->os_state == OS_STATE_DEGRADED && speed < 2) {
+               if (sfs->os_state & OS_STATE_DEGRADED && speed < 2) {
                        QOS_DEBUG("#%d: degraded\n", ost_idx);
                        continue;
                }
                        QOS_DEBUG("#%d: degraded\n", ost_idx);
                        continue;
                }