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

don't LASSERT on read-only device

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

index 3dceb6b..92fc846 100644 (file)
@@ -1989,7 +1989,11 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
 
         CDEBUG(D_SUPER, "%s: mnt = %p\n", lustre_cfg_string(lcfg, 1), mnt);
 
-        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);
+        }
 
         sema_init(&mds->mds_epoch_sem, 1);
         spin_lock_init(&mds->mds_transno_lock);
index d906c40..facf13a 100644 (file)
@@ -1890,7 +1890,11 @@ int filter_common_setup(struct obd_device *obd, obd_count len, void *buf,
         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;