Whamcloud - gitweb
b=16895
authorgirish <girish>
Wed, 21 Jan 2009 18:38:25 +0000 (18:38 +0000)
committergirish <girish>
Wed, 21 Jan 2009 18:38:25 +0000 (18:38 +0000)
i=adilger (o=johann)
i=girish

don't LASSERT on read-only device

lustre/mgs/mgs_handler.c
lustre/obdfilter/filter.c

index 581f1e1..c91fac8 100644 (file)
@@ -220,7 +220,11 @@ static int mgs_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
                            "mgs_ldlm_client", &obd->obd_ldlm_client);
 
-        LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb)));
+        if (lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb))) {
+                CERROR("%s: Underlying device is marked as read-only. "
+                       "Setup failed\n", obd->obd_name);
+                GOTO(err_ops, rc = -EROFS);
+        }
 
         rc = mgs_fs_setup(obd, mnt);
         if (rc) {
index 4b925a9..c258b8f 100644 (file)
@@ -2012,7 +2012,11 @@ int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg,
         if (rc != 0)
                 GOTO(err_ops, rc);
 
-        LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb)));
+        if (lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb))) {
+                CERROR("%s: Underlying device is marked as read-only. "
+                       "Setup failed\n", obd->obd_name);
+                GOTO(err_ops, rc = -EROFS);
+        }
 
         /* failover is the default */
         obd->obd_replayable = 1;